public PlayerManagementForm(Player playerToManage, IEnumerable<string> validLocations, string currentPlayerLocation )
 {
     InitializeComponent();
     _playerToManage = playerToManage;
     _playerToManage.Cards.Sort();
     PlayerNameLabel.Text = _playerToManage.PlayerName;
     CharacterNameLabel.Text = _playerToManage.Character.CharacterName;
     PlayerCardListBox.DataSource = _playerToManage.Cards;
     PlayerCardListBox.SelectedIndex = -1;
     var specialCards = new List<BaseCard>();
     specialCards.AddRange(_playerToManage.QuorumHand ?? new List<QuorumCard>());
     specialCards.AddRange(_playerToManage.SuperCrisisCards ?? new List<SuperCrisisCard>());
     specialCards.AddRange(_playerToManage.LoyaltyCards ?? new List<LoyaltyCard>());
     SpecialCardListBox.DataSource = specialCards;
     SpecialCardListBox.SelectedIndex = -1;
     LocationComboBox.DataSource = validLocations;
     LocationComboBox.SelectedItem = currentPlayerLocation;
     OpgCheckbox.Checked = playerToManage.OncePerGamePower;
 }
Esempio n. 2
0
 public BaseNode GetPlayerLocation(Player player)
 {
     return GetPlayerLocation(player.PlayerName);
 }
Esempio n. 3
0
 /// <summary>
 /// Moves the title designation from one player to another, along with any hands or tokens for that title
 /// </summary>
 /// <param name="title">The title to be transferred</param>
 /// <param name="newHolder">The player who should now possess the title</param>
 public void ChangePlayerTitle(Titles title, Player newHolder)
 { }
Esempio n. 4
0
 public void PlayerRemoveCard(Player player, IEnumerable<BaseCard> cards)
 {
     foreach (BaseCard card in cards)
         PlayerRemoveCard(player, card);
 }
Esempio n. 5
0
 /// <summary>
 /// Removes the card from the players hand. This can be used to move cards between players.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="card"></param>
 public void PlayerRemoveCard(Player player, BaseCard card)
 {
     switch (card.CardType)
     {
         case CardType.Skill:
             player.Cards.Remove((SkillCard)card);
             break;
         case CardType.Quorum:
             player.QuorumHand.Remove((QuorumCard)card);
             break;
         case CardType.Loyalty:
             player.LoyaltyCards.Remove((LoyaltyCard)card);
             break;
         case CardType.SuperCrisis:
             player.SuperCrisisCards.Remove((SuperCrisisCard)card);
             break;
         case CardType.Mutiny:
             player.MutinyHand.Remove((MutinyCard)card);
             break;
     }
 }
Esempio n. 6
0
 public void GiveCardToPlayer(Player player, IEnumerable<BaseCard> cards)
 {
     foreach (var card in cards)
         GiveCardToPlayer(player, card);
 }
Esempio n. 7
0
 protected bool Equals(Player other)
 {
     return string.Equals(PlayerName, other.PlayerName);
 }
Esempio n. 8
0
        private void SubmitButtonClick(object sender, EventArgs e)
        {
            var crisisResults = SkillCheck.EvalSkillCheck(CrisisContributions.Select(x => x.Item1), _crisis, null);

            var resultOutput = new StringBuilder();

            var totalPower = 0;
            foreach (var contribution in CrisisContributions.OrderBy(x => x.Item1.CardColor))
            {
                var appliedPower = _crisis.PositiveColors.Contains(contribution.Item1.CardColor) ? contribution.Item1.CardPower : contribution.Item1.CardPower * -1;
                resultOutput.AppendLine(string.Format(FinalFormat, appliedPower, contribution.Item1.Heading));
                totalPower += appliedPower;
            } 
            resultOutput.AppendLine(@"\b--------------------\b0");
            foreach (var consequence in crisisResults)
            {
                resultOutput.AppendLine(string.Format(OutputResultFormat, totalPower, consequence.Threshold,consequence.ConditionText));
            }
            resultOutput.Replace(Environment.NewLine, @" \line ");
            resultOutput.Insert(0, @"{\rtf1\ansi ");
            resultOutput.Append(@"}");

            Result = resultOutput.ToString();

            if (PlayerTakeCardsCheckBox.Checked)
                PlayerTakingCards = (Player)PlayerTakeCardsDropdown.SelectedItem;

            DialogResult = DialogResult.OK;
            Close();
        }
Esempio n. 9
0
 public void DrawCards(IEnumerable<BaseCard> cards, Player player = null)
 {
     foreach (var card in cards)
         DrawCard(card, player);
 }
Esempio n. 10
0
 public void DrawCards(CardType cardType, int count, Player player = null)
 {
     DrawCards(Enumerable.Repeat(BaseCard.ReturnBaseCardFromCardType(cardType), count), player);
 }
Esempio n. 11
0
        public IEnumerable<SkillCard> DrawSkillCards(SkillCardColor color, int count, Player player = null)
        {
            List<SkillCard> ret;
            switch (color)
            {
                case SkillCardColor.Engineering:
                    ret = CurrentGameState.EngineeringDeck.DrawMany(count).ToList();
                    break;
                case SkillCardColor.Leadership:
                    ret = CurrentGameState.LeadershipDeck.DrawMany(count).ToList();
                    break;
                case SkillCardColor.Piloting:
                    ret = CurrentGameState.PilotingDeck.DrawMany(count).ToList();
                    break;
                case SkillCardColor.Politics:
                    ret = CurrentGameState.PoliticsDeck.DrawMany(count).ToList();
                    break;
                case SkillCardColor.Tactics:
                    ret = CurrentGameState.TacticsDeck.DrawMany(count).ToList();
                    break;
                case SkillCardColor.Treachery:
                    ret = CurrentGameState.TreacheryDeck.DrawMany(count).ToList();
                    break;
                default:
                    return new List<SkillCard>();
            }

            if (player != null)
                player.TakeCard(ret);
            return ret;
        }
Esempio n. 12
0
 public SkillCard DrawSkillCard(SkillCardColor color, Player player = null)
 {
     return DrawSkillCards(color, 1, player).FirstOrDefault();
 }
Esempio n. 13
0
 public void DiscardCard(BaseCard card, Player player = null)
 {  
     // discards the passed card into its appropriate deck
     switch (card.CardType)
     {
         case CardType.Quorum:
             CurrentGameState.QuorumDeck.Discard((QuorumCard)card);
             break;
         case CardType.Skill:
             var skillCard = (SkillCard) card;
             switch (skillCard.CardColor)
             {
                 case SkillCardColor.Politics:
                     CurrentGameState.PoliticsDeck.Discard(skillCard);
                     break;
                 case SkillCardColor.Leadership:
                     CurrentGameState.LeadershipDeck.Discard(skillCard);
                     break;
                 case SkillCardColor.Tactics:
                     CurrentGameState.TacticsDeck.Discard(skillCard);
                     break;
                 case SkillCardColor.Engineering:
                     CurrentGameState.EngineeringDeck.Discard(skillCard);
                     break;
                 case SkillCardColor.Piloting:
                     CurrentGameState.PilotingDeck.Discard(skillCard);
                     break;
                 case SkillCardColor.Treachery:
                     CurrentGameState.TreacheryDeck.Discard(skillCard);
                     break;
             }
             break;
         case CardType.SuperCrisis:
             CurrentGameState.SuperCrisisDeck.Discard((SuperCrisisCard) card);
             break;
         case CardType.Loyalty:
             CurrentGameState.LoyaltyDeck.Discard((LoyaltyCard) card);
             break;
     }
     if (player != null)
         player.Discard(card);
 }
Esempio n. 14
0
 public void DoPlayerDraw(Player player, int drawIndex = 0)
 {
     try
     {
         AddToTurnLog(player.Character.CharacterName + " draws " + player.SkillCardString(player.SkillCardDraws.ElementAt(drawIndex)) + "!");
         foreach (var color in player.SkillCardDraws.ElementAt(drawIndex))
         {
             switch (color)
             {
                 case SkillCardColor.Engineering:
                     player.Cards.Add(CurrentGameState.EngineeringDeck.Draw());
                     break;
                 case SkillCardColor.Leadership:
                     player.Cards.Add(CurrentGameState.LeadershipDeck.Draw());
                     break;
                 case SkillCardColor.Piloting:
                     player.Cards.Add(CurrentGameState.PilotingDeck.Draw());
                     break;
                 case SkillCardColor.Tactics:
                     player.Cards.Add(CurrentGameState.TacticsDeck.Draw());
                     break;
                 case SkillCardColor.Politics:
                     player.Cards.Add(CurrentGameState.PoliticsDeck.Draw());
                     break;
             }
         }
     }
     catch (Exception e)
     {
         _logger.Error("Error when executing player draw.", e);
         throw;
     }
 }
Esempio n. 15
0
 private void AttemptToPlacePlayer(Player player)
 {
     foreach (var location in CurrentGameState.Boards.Select(board => board.Locations.FirstOrDefault(x => x.Name == player.Character.SetupLocation)).Where(location => location != null))
     {
         location.PlayersPresent.Add(player.PlayerName);
         return;
     }
 }
Esempio n. 16
0
 public IEnumerable<BaseCard> GetPlayerHand(Player player)
 {
     return GetPlayerHand(player.PlayerName);
 }
Esempio n. 17
0
        private void AddPlayerButtonClick(object sender, EventArgs e)
        {
            var character = (Character) characterListBox.SelectedItem;

            if (character == null)
            {
                MessageBox.Show(Resources.PlayerRosterForm_CharacterDetailButtonClick_No_Character_selected, Resources.PlayerRosterForm_AddPlayerButton_Text);
                return;
            }

            var playerName = playerNameTextBox.Text;
            if (string.IsNullOrWhiteSpace(playerName) || default(Player) != Players.FirstOrDefault(x => x.PlayerName == playerName))
            {
                MessageBox.Show(Resources.PlayerRosterForm_AddPlayerButtonClick_NoPlayerName, Resources.PlayerRosterForm_AddPlayerButton_Text);
                return;
            }
            

            var colorDraw = character.DefaultDrawColors.First();
            if (Players.Count != 0)
            {
                if (initialDrawComboBox1.SelectedItem == null || initialDrawComboBox2.SelectedItem == null || initialDrawComboBox3.SelectedItem == null)
                {
                    MessageBox.Show(Resources.PlayerRosterForm_AddPlayerButtonClick_NoDrawSelected, Resources.PlayerRosterForm_AddPlayerButton_Text);
                    return;
                }
                colorDraw = new List<SkillCardColor>
                    {
                        (SkillCardColor) initialDrawComboBox1.SelectedItem,
                        (SkillCardColor) initialDrawComboBox2.SelectedItem,
                        (SkillCardColor) initialDrawComboBox3.SelectedItem
                    };
                foreach (var color in colorDraw.Distinct().Where(color => character.ColorMax(color) < colorDraw.Count(x => x == color)))
                {
                    MessageBox.Show(string.Format( Resources.PlayerRosterForm_AddPlayerButtonClick_InvalidColors, color), Resources.PlayerRosterForm_AddPlayerButton_Text);
                    return;
                }
            }

            var player = new Player {Character = character, PlayerName = playerName, CustomDraws = new List<List<SkillCardColor>>{colorDraw}, TurnPosition = Players.Count+1};
            playerRosterListBox.Items.Add(player);
            Players.Add(player);
            characterListBox.Items.Remove(character);
            if (Players.Count > 2)
                doneButton.Enabled = true;

            playerNameTextBox.Text = string.Empty;
            characterListBox.ClearSelected();
            initialDrawComboBox1.SelectedIndex = -1;
            initialDrawComboBox2.SelectedIndex = -1;
            initialDrawComboBox3.SelectedIndex = -1;
            playerNameTextBox.Focus();
        }
Esempio n. 18
0
        public BaseCard DrawCard(BaseCard card, Player player = null)
        {
            // todo each discard creates new gamestate? that would let us implement undos
            // discards the passed card into its appropriate deck
            BaseCard ret = new SkillCard();
            switch (card.CardType)
            {
                case CardType.Crisis:
                    ret = CurrentGameState.CrisisDeck.Draw();
                    break;
                case CardType.Quorum:
                    ret = CurrentGameState.QuorumDeck.Draw();
                    break;
                case CardType.Skill:
                    var skillCard = (SkillCard)card;
                    switch (skillCard.CardColor)
                    {
                        case SkillCardColor.Politics:
                            ret = CurrentGameState.PoliticsDeck.Draw();
                            break;
                        case SkillCardColor.Leadership:
                            ret = CurrentGameState.LeadershipDeck.Draw();
                            break;
                        case SkillCardColor.Tactics:
                            ret = CurrentGameState.TacticsDeck.Draw();
                            break;
                        case SkillCardColor.Engineering:
                            ret = CurrentGameState.EngineeringDeck.Draw();
                            break;
                        case SkillCardColor.Piloting:
                            ret = CurrentGameState.PilotingDeck.Draw();
                            break;
                        case SkillCardColor.Treachery:
                            ret = CurrentGameState.TreacheryDeck.Draw();
                            break;
                    }
                    break;
                case CardType.SuperCrisis:
                    ret = CurrentGameState.SuperCrisisDeck.Draw();
                    break;
                case CardType.Loyalty:
                    ret = CurrentGameState.LoyaltyDeck.Draw();
                    break;
            }
            if (player != null)
                player.TakeCard(ret);

            return ret;
        }
Esempio n. 19
0
        // todo may want to add logging to these
        /// <summary>
        /// Inserts the card into the player's appropriate hand
        /// </summary>
        /// <param name="toPlayer">The player to give the cards to.</param>
        /// <param name="card">The card to give them.</param>
        /// <param name="fromPlayer">The player who is giving the card (if applicable)</param>
        public void GiveCardToPlayer(Player toPlayer, BaseCard card, Player fromPlayer = null)
        {
            switch (card.CardType)
            {
                case CardType.Skill:
                    toPlayer.Cards.Add((SkillCard)card);
                    break;
                case CardType.Quorum:
                    toPlayer.QuorumHand.Add((QuorumCard)card);
                    break;
                case CardType.Loyalty:
                    toPlayer.LoyaltyCards.Add((LoyaltyCard)card);
                    break;
                case CardType.SuperCrisis:
                    toPlayer.SuperCrisisCards.Add((SuperCrisisCard)card);
                    break;
                case CardType.Mutiny:
                    toPlayer.MutinyHand.Add((MutinyCard)card);
                    break;
            }

            if (fromPlayer != null)
                fromPlayer.Discard(card);
        }
Esempio n. 20
0
 // todo quorum card text too long for listbox. override measure/draw events
 
 private void CharacterListBoxSelectedIndexChanged(object sender, EventArgs e)
 {
     _currentPlayer = (Player)characterListBox.SelectedItem;
     UpdatePlayerHandControls();
 }