Ejemplo n.º 1
0
        public Card DiscardCard(Card parent)
        {
            if (Name == "Human Player")
            {
                Card cardToRemove = null;
                var  cardNames    = parent == null ? new string[Hand.Count] : new string[Hand.Count - 1];
                var  counter      = 0;
                foreach (var card in Hand)
                {
                    if (!card.Equals(parent))
                    {
                        cardNames[counter] = card.Name;
                        counter++;
                    }
                }
                var form = new UserChoiceForm("Choose the card you want to discard", cardNames);
                form.ShowDialog();

                if (form.DialogResult == DialogResult.OK)
                {
                    foreach (var card in Hand)
                    {
                        if (card.Name == form.GetCmbBoxSelectedContent())
                        {
                            cardToRemove = card;
                        }
                    }
                    Hand.Remove(cardToRemove);
                    _gameEngine.DiscardedDeck.Add(cardToRemove);
                }
                return(cardToRemove);
            }
            LoseCard(parent);
            return(null);
        }
        public Card DiscardCard(Card parent)
        {
            if (Name == "Human Player")
            {
                Card cardToRemove = null;
                var cardNames = parent == null ? new string[Hand.Count] : new string[Hand.Count - 1];
                var counter = 0;
                foreach (var card in Hand)
                {
                    if (!card.Equals(parent))
                    {
                        cardNames[counter] = card.Name;
                        counter++;
                    }
                }
                var form = new UserChoiceForm("Choose the card you want to discard", cardNames);
                form.ShowDialog();

                if (form.DialogResult == DialogResult.OK)
                {
                    foreach (var card in Hand)
                    {
                        if (card.Name == form.GetCmbBoxSelectedContent())
                            cardToRemove = card;
                    }
                    Hand.Remove(cardToRemove);
                    _gameEngine.DiscardedDeck.Add(cardToRemove);
                }
                return cardToRemove;
            }
            LoseCard(parent);
            return null;
        }
Ejemplo n.º 3
0
        public void GetAChipOfHisChoice()
        {
            if (Equals(_gameEngine.PlayersList[0]))
            {
                var form = new UserChoiceForm("Select the chip you want",
                                              new[] { "Learning Chip", "Craft Chip", "Integrity Chip" });
                form.ShowDialog();

                if (form.DialogResult == DialogResult.OK)
                {
                    switch (form.GetCmbBoxSelectedContent())
                    {
                    case "Learning Chip":
                        LearningChips++;
                        break;

                    case "Craft Chip":
                        CraftChips++;
                        break;

                    case "Integrity Chip":
                        IntegrityChips++;
                        break;
                    }
                }
            }
            else
            {
                // If the player is AI, do it randomly.
                var bonus = new Random().Next(3);
                switch (bonus)
                {
                case 0:
                    LearningChips++;
                    break;

                case 1:
                    CraftChips++;
                    break;

                case 2:
                    IntegrityChips++;
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        public override bool Play(Player player)
        {
            if (player.Name == "Human Player")
            {
                var form = new UserChoiceForm("Select the chip you want", new[] { "Learning Chip", "Integrity Chip" });
                form.ShowDialog();
                if (form.DialogResult == DialogResult.OK)
                {
                    switch (form.GetCmbBoxSelectedContent())
                    {
                    case "Learning Chip":
                        _reward = "1 Learning Chip";
                        player.LearningChips++;
                        break;

                    case "Integrity Chip":
                        _reward = "1 Integrity Chip";
                        player.IntegrityChips++;
                        break;
                    }
                }
            }
            else
            {
                var bonus = new Random().Next(2);
                switch (bonus)
                {
                case 0:
                    _reward = "1 Learning Chip";
                    player.LearningChips++;
                    break;

                case 1:
                    _reward = "1 Integrity Chip";
                    player.IntegrityChips++;
                    break;
                }
            }
            return(true);
        }
Ejemplo n.º 5
0
 public override bool Play(Player player)
 {
     if (player.Name == "Human Player")
     {
         var form = new UserChoiceForm("Select the chip you want", new[] { "Learning Chip", "Craft Chip" });
         form.ShowDialog();
         if (form.DialogResult == DialogResult.OK)
         {
             switch (form.GetCmbBoxSelectedContent())
             {
                 case "Learning Chip":
                     _reward = "1 Learning Chip";
                     player.LearningChips++;
                     break;
                 case "Craft Chip":
                     _reward = "1 Craft Chip";
                     player.CraftChips++;
                     break;
             }
         }
     }
     else
     {
         var bonus = new Random().Next(2);
         switch (bonus)
         {
             case 0:
                 _reward = "1 Learning Chip";
                 player.LearningChips++;
                 break;
             case 1:
                 _reward = "1 Craft Chip";
                 player.CraftChips++;
                 break;
         }
     }
     return true;
 }
        public void GetAChipOfHisChoice()
        {
            if (Equals(_gameEngine.PlayersList[0]))
            {
                var form = new UserChoiceForm("Select the chip you want",
                    new[] { "Learning Chip", "Craft Chip", "Integrity Chip" });
                form.ShowDialog();

                if (form.DialogResult == DialogResult.OK)
                {
                    switch (form.GetCmbBoxSelectedContent())
                    {
                        case "Learning Chip":
                            LearningChips++;
                            break;
                        case "Craft Chip":
                            CraftChips++;
                            break;
                        case "Integrity Chip":
                            IntegrityChips++;
                            break;
                    }
                }
            }
            else
            {
                // If the player is AI, do it randomly.
                var bonus = new Random().Next(3);
                switch (bonus)
                {
                    case 0:
                        LearningChips++;
                        break;
                    case 1:
                        CraftChips++;
                        break;
                    case 2:
                        IntegrityChips++;
                        break;
                }
            }
        }