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 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; } } }
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); }
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 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; }