private bool Action1(CardActionParameters parameters) { ValidateParameters(parameters); if (parameters.TargetPlayer.Hand.Count < 3) { return(false); } List <ICard> cardsToReturn = parameters.TargetPlayer.PickMultipleCards(parameters.TargetPlayer.Hand, 3, 3).ToList(); if (cardsToReturn.Count == 0) { return(false); } foreach (ICard card in cardsToReturn) { parameters.TargetPlayer.Hand.Remove(card); Return.Action(card, parameters.Game); } Meld.Action(Draw.Action(3, parameters.Game), parameters.TargetPlayer); return(true); }
bool Action1(CardActionParameters parameters) { ValidateParameters(parameters); //Score your top green card. var topGreenCard = parameters.TargetPlayer.Tableau.Stacks[Color.Green].GetTopCard(); if (topGreenCard != null) { Score.Action(topGreenCard, parameters.TargetPlayer); parameters.TargetPlayer.Tableau.Stacks[Color.Green].RemoveCard(topGreenCard); } //Draw and meld a [10] var drawnCard = Draw.Action(10, parameters.Game); if (drawnCard == null) { return(true); } Meld.Action(drawnCard, parameters.TargetPlayer); foreach (var cardAction in drawnCard.Actions) { if (cardAction.ActionType != ActionType.Demand) { cardAction.ActionHandler(new CardActionParameters { ActivePlayer = parameters.TargetPlayer, TargetPlayer = parameters.TargetPlayer, Game = parameters.Game, PlayerSymbolCounts = parameters.PlayerSymbolCounts }); } } return(true); }
public void MeldAction_Base() { Meld.Action(testCard, testPlayer); Assert.AreEqual(testCard, testPlayer.Tableau.Stacks[Color.Blue].GetTopCard()); Assert.AreEqual(6, testPlayer.Tableau.GetSymbolCount(Symbol.Tower)); Assert.AreEqual(0, testPlayer.Tableau.GetSymbolCount(Symbol.Leaf)); }
private bool Action1(CardActionParameters parameters) { ValidateParameters(parameters); var cardsWithTowers = parameters.TargetPlayer.Hand.Where(c => c.HasSymbol(Symbol.Tower)).ToList(); if (cardsWithTowers.Count == 0) { return(false); } var selectedCards = parameters.TargetPlayer.PickMultipleCards(cardsWithTowers, 0, cardsWithTowers.Count).ToList(); foreach (var card in selectedCards) { parameters.TargetPlayer.Hand.Remove(card); Meld.Action(card, parameters.TargetPlayer); } if (selectedCards.Count > 4) { throw new NotImplementedException("Monument Achievement"); // TODO::achieve Monument. Special achievements need a larger framework and some discussion } return(selectedCards.Count > 0); }
private bool Action1(CardActionParameters parameters) { ValidateParameters(parameters); Meld.Action(Draw.Action(1, parameters.Game), parameters.TargetPlayer); return(true); }
private bool Action1(CardActionParameters parameters) { ValidateParameters(parameters); if (parameters.TargetPlayer.Hand.Any()) { var lowestAgeInHand = parameters.TargetPlayer.Hand.Min(c => c.Age); var lowestCards = parameters.TargetPlayer.Hand.Where(c => c.Age.Equals(lowestAgeInHand)).ToList(); ICard cardToMeld = parameters.TargetPlayer.PickCard(lowestCards); parameters.TargetPlayer.Hand.Remove(cardToMeld); Meld.Action(cardToMeld, parameters.TargetPlayer); } parameters.TargetPlayer.Hand.Add(Draw.Action(1, parameters.Game)); return(true); }
private bool Action1(CardActionParameters parameters) { ValidateParameters(parameters); List <Color> topCardColors = parameters.TargetPlayer.Tableau.GetStackColors(); List <ICard> cardsToMeld = parameters.TargetPlayer.Hand.Where(x => !topCardColors.Contains(x.Color)).ToList(); if (cardsToMeld.Count == 0) { return(false); } ICard card = parameters.TargetPlayer.PickCard(cardsToMeld); parameters.TargetPlayer.Hand.Remove(card); Meld.Action(card, parameters.TargetPlayer); return(true); }
bool Action1(CardActionParameters parameters) { ValidateParameters(parameters); ICard card = parameters.TargetPlayer.PickCardFromHand(); if (card == null) { return(false); } parameters.TargetPlayer.Hand.Remove(card); Return.Action(card, parameters.Game); Meld.Action(Draw.Action(card.Age + 1, parameters.Game), parameters.TargetPlayer); return(true); }
bool Action2(CardActionParameters parameters) { ValidateParameters(parameters); if (!parameters.TargetPlayer.Hand.Any()) { return(false); } var cardChosen = parameters.TargetPlayer.PickCardFromHand(); Meld.Action(cardChosen, parameters.TargetPlayer); parameters.TargetPlayer.Hand.Remove(cardChosen); cardChosen = parameters.TargetPlayer.PickCardFromHand(); Score.Action(cardChosen, parameters.TargetPlayer); parameters.TargetPlayer.Hand.Remove(cardChosen); return(true); }
private bool Action1(CardActionParameters parameters) { ValidateParameters(parameters); ICard card = Draw.Action(1, parameters.Game); parameters.TargetPlayer.RevealCard(card); if (parameters.TargetPlayer.Tableau.GetStackColors().Contains(card.Color)) { Meld.Action(card, parameters.TargetPlayer); parameters.TargetPlayer.Hand.Add(Draw.Action(1, parameters.Game)); } else { parameters.TargetPlayer.Hand.Add(card); } return(true); }
bool Action1(CardActionParameters parameters) { ValidateParameters(parameters); if (parameters.TargetPlayer.Hand.Count > 0) { List <ICard> cardsToMeld = parameters.TargetPlayer.PickMultipleCards(parameters.TargetPlayer.Hand, 1, 2).ToList(); foreach (ICard card in cardsToMeld) { parameters.TargetPlayer.Hand.Remove(card); Meld.Action(card, parameters.TargetPlayer); } if (cardsToMeld.Count == 2) { if (parameters.TargetPlayer.AskQuestion("Do you want to transfer your top red card to another player's board? If you do, transfer that player's top green card to your board.")) { ICard topRedCard = parameters.TargetPlayer.Tableau.GetTopCards().Where(x => x.Color == Color.Red).FirstOrDefault(); if (topRedCard != null) { IPlayer playerToTransferTo = parameters.TargetPlayer.PickPlayer(parameters.Game.Players.Where(x => x != parameters.TargetPlayer).ToList()); parameters.TargetPlayer.Tableau.Stacks[Color.Red].Cards.Remove(topRedCard); playerToTransferTo.Tableau.Stacks[Color.Red].AddCardToTop(topRedCard); ICard topGreenCard = playerToTransferTo.Tableau.GetTopCards().Where(x => x.Color == Color.Green).FirstOrDefault(); if (topGreenCard != null) { playerToTransferTo.Tableau.Stacks[Color.Green].Cards.Remove(topGreenCard); parameters.TargetPlayer.Tableau.Stacks[Color.Green].AddCardToTop(topGreenCard); } } } } return(true); } return(false); }