Exemplo n.º 1
0
        bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            var selectedCard = parameters.TargetPlayer.PickCardFromHand();

            if (selectedCard == null)
            {
                return(false);
            }

            Return.Action(selectedCard, parameters.Game);

            if (!selectedCard.Age.Equals(10))
            {
                return(true);
            }

            for (var i = 0; i < parameters.TargetPlayer.Tableau.ScorePile.Select(c => c.Age).Distinct().Count(); i++)
            {
                Draw.Action(10, parameters.Game);
            }

            return(true);
        }
Exemplo n.º 2
0
        public void DrawAction_RequestedDeckEmpty()
        {
            var drawnCard = Draw.Action(2, testGame);

            Assert.IsNotNull(drawnCard);
            Assert.AreEqual(3, drawnCard.Age);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            List <ICard> cardsToReturn = parameters.TargetPlayer.PickMultipleCards(parameters.TargetPlayer.Hand, 0, parameters.TargetPlayer.Hand.Count).ToList();

            if (cardsToReturn.Count == 0)
            {
                return(false);
            }


            foreach (ICard card in cardsToReturn)
            {
                parameters.TargetPlayer.Hand.Remove(card);
                Return.Action(card, parameters.Game);
            }

            int differentAges = cardsToReturn.Select(x => x.Age).Distinct().Count();

            for (int i = 0; i < differentAges; i++)
            {
                Score.Action(Draw.Action(2, parameters.Game), parameters.TargetPlayer);
            }

            return(true);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        public void DrawAction_MultipleDecksEmpty()
        {
            var drawnCard = Draw.Action(4, testGame);

            Assert.IsNotNull(drawnCard);
            Assert.AreEqual(7, drawnCard.Age);
        }
Exemplo n.º 7
0
        bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            //Draw and reveal a [4] for every three [TOWER] on your board.
            var cardsDrawn          = new List <ICard>();
            var numberOfCardsToDraw = parameters.TargetPlayer.Tableau.GetSymbolCount(Symbol.Tower) / 3;

            if (numberOfCardsToDraw == 0)
            {
                return(false);
            }

            for (int i = 0; i < numberOfCardsToDraw; i++)
            {
                ICard card = Draw.Action(4, parameters.Game);
                parameters.TargetPlayer.RevealCard(card);
                parameters.TargetPlayer.Hand.Add(card);
                cardsDrawn.Add(card);
            }

            //If any of the drawn cards are red, return the cards drawn and return all cards in your hand. Otherwise, keep them.
            if (cardsDrawn.Any(c => c.Color == Color.Red))
            {
                parameters.TargetPlayer.Hand.ForEach(c => Return.Action(c, parameters.Game));
                parameters.TargetPlayer.Hand.RemoveRange(0, parameters.TargetPlayer.Hand.Count());
            }

            return(true);
        }
Exemplo n.º 8
0
        public void DrawAction_Base()
        {
            var drawnCard = Draw.Action(1, testGame);

            Assert.IsNotNull(drawnCard);
            Assert.AreEqual(1, drawnCard.Age);
        }
Exemplo n.º 9
0
        private bool Action2(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            List <ICard> ageThreeCardsInHand = parameters.TargetPlayer.Hand.Where(x => x.Age == 3).ToList();

            if (ageThreeCardsInHand.Count == 0)
            {
                return(false);
            }

            ICard cardToReturn = parameters.TargetPlayer.PickCard(ageThreeCardsInHand);

            if (cardToReturn == null)
            {
                return(false);
            }

            parameters.TargetPlayer.Hand.Remove(cardToReturn);
            Return.Action(cardToReturn, parameters.Game);

            parameters.TargetPlayer.Hand.Add(Draw.Action(1, parameters.Game));
            parameters.TargetPlayer.Hand.Add(Draw.Action(1, parameters.Game));
            parameters.TargetPlayer.Hand.Add(Draw.Action(1, parameters.Game));

            return(true);
        }
Exemplo n.º 10
0
        private bool Action2(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            parameters.TargetPlayer.Hand.Add(Draw.Action(1, parameters.Game));

            return(true);
        }
Exemplo n.º 11
0
        private bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            Meld.Action(Draw.Action(1, parameters.Game), parameters.TargetPlayer);

            return(true);
        }
Exemplo n.º 12
0
        bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            Score.Action(Draw.Action(10, parameters.Game), parameters.TargetPlayer);

            return(true);
        }
Exemplo n.º 13
0
        bool Action2(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            Tuck.Action(Draw.Action(1, parameters.Game), parameters.TargetPlayer);

            return(true);
        }
Exemplo n.º 14
0
        bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            int numberOfLeafs = parameters.TargetPlayer.Tableau.GetSymbolCount(Symbol.Leaf);

            for (int i = 0; i < numberOfLeafs / 2; i++)
            {
                parameters.TargetPlayer.Hand.Add(Draw.Action(2, parameters.Game));
            }

            return(numberOfLeafs >= 2);
        }
Exemplo n.º 15
0
        private bool Action2(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            if ((bool)parameters.Game.GetPropertyBagValue("OarsAction1Taken"))
            {
                return(false);
            }

            parameters.TargetPlayer.Hand.Add(Draw.Action(1, parameters.Game));

            return(true);
        }
Exemplo n.º 16
0
        bool Action2(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            Score.Action(Draw.Action(6, parameters.Game), parameters.TargetPlayer);

            if (!parameters.Game.Players.Exists(p => p.Tableau.GetSymbolCount(Symbol.Leaf) > p.Tableau.GetSymbolCount(Symbol.Factory)))
            {
                parameters.Game.TriggerEndOfGame(parameters.Game.Players.OrderByDescending(p => p.Tableau.GetScore()).ToList().First());
            }

            return(true);
        }
Exemplo n.º 17
0
        bool Action2(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            if (!(bool)parameters.Game.GetPropertyBagValue("MapmakingAction1Taken"))
            {
                return(false);
            }

            Score.Action(Draw.Action(1, parameters.Game), parameters.TargetPlayer);

            return(true);
        }
Exemplo n.º 18
0
        private bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            parameters.TargetPlayer.Hand.Add(Draw.Action(1, parameters.Game));

            var highestAgeInHand = parameters.TargetPlayer.Hand.Max(c => c.Age);
            var highestCards     = parameters.TargetPlayer.Hand.Where(c => c.Age.Equals(highestAgeInHand)).ToList();

            ICard selectedCard = parameters.TargetPlayer.PickCard(highestCards);

            parameters.TargetPlayer.Hand.Remove(selectedCard);
            parameters.ActivePlayer.Hand.Add(selectedCard);

            return(true);
        }
Exemplo n.º 19
0
        bool Action2(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            List <Color> targetPlayerTopCardColors = parameters.TargetPlayer.Tableau.GetStackColors();
            List <Color> otherPlayerTopCardColors  = parameters.Game.Players.Where(p => p != parameters.TargetPlayer).SelectMany(r => r.Tableau.GetStackColors()).Distinct().ToList();

            var numberOfCardsToDraw = targetPlayerTopCardColors.Count(x => !otherPlayerTopCardColors.Contains(x));

            for (var i = 0; i < numberOfCardsToDraw; i++)
            {
                Score.Action(Draw.Action(1, parameters.Game), parameters.TargetPlayer);
            }

            return(numberOfCardsToDraw > 0);
        }
Exemplo n.º 20
0
        bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            int cardsInScorePile = parameters.TargetPlayer.Tableau.ScorePile.Count;
            int cardsInHand      = parameters.TargetPlayer.Hand.Count;

            if (cardsInScorePile <= cardsInHand)
            {
                return(false);
            }

            parameters.TargetPlayer.Hand.Add(Draw.Action(3, parameters.Game));
            parameters.TargetPlayer.Hand.Add(Draw.Action(3, parameters.Game));

            return(true);
        }
Exemplo n.º 21
0
        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);
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
        private bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            if (parameters.TargetPlayer.Tableau.GetSymbolCount(Symbol.Tower) < 4)
            {
                return(false);
            }

            List <ICard> topCardsWithTowers = new List <ICard>();

            foreach (Stack stack in parameters.TargetPlayer.Tableau.Stacks.Values)
            {
                ICard card = stack.GetTopCard();
                if (card != null)
                {
                    if (card.HasSymbol(Symbol.Tower))
                    {
                        topCardsWithTowers.Add(card);
                    }
                }
            }

            if (topCardsWithTowers.Count == 0)
            {
                return(false);
            }


            ICard cardToMove = parameters.TargetPlayer.PickCard(topCardsWithTowers);

            // remove from TargetPlayer's board
            parameters.TargetPlayer.Tableau.Stacks[cardToMove.Color].RemoveCard(cardToMove);

            // add to ActivePlayer's board - doesn't say meld, so just add it
            parameters.ActivePlayer.Tableau.Stacks[cardToMove.Color].AddCardToTop(cardToMove);

            // if you do, draw a 1
            parameters.TargetPlayer.Hand.Add(Draw.Action(1, parameters.Game));

            return(true);
        }
Exemplo n.º 24
0
        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);
        }
Exemplo n.º 25
0
        private bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            var card = Draw.Action(1, parameters.Game);

            parameters.TargetPlayer.RevealCard(card);

            while (card.HasSymbol(Symbol.Tower))
            {
                Score.Action(card, parameters.TargetPlayer);

                card = Draw.Action(1, parameters.Game);
                parameters.TargetPlayer.RevealCard(card);
            }

            parameters.TargetPlayer.Hand.Add(card);

            return(true);
        }
Exemplo n.º 26
0
        private bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            ICard selectedCard = parameters.TargetPlayer.PickCardFromHand();

            if (selectedCard == null)
            {
                return(false);
            }

            parameters.TargetPlayer.Hand.Remove(selectedCard);
            Return.Action(selectedCard, parameters.Game);

            int ageToDraw   = selectedCard.Age + 1;
            var cardToScore = Draw.Action(ageToDraw, parameters.Game);

            Score.Action(cardToScore, parameters.TargetPlayer);

            return(true);
        }
Exemplo n.º 27
0
        bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            int numberOfCardsToTransfer = Math.Min(parameters.TargetPlayer.Hand.Count, 2);

            if (numberOfCardsToTransfer > 0)
            {
                List <ICard> cardsToTransfer = parameters.TargetPlayer.PickMultipleCards(parameters.TargetPlayer.Hand, numberOfCardsToTransfer, numberOfCardsToTransfer).ToList();

                foreach (ICard card in cardsToTransfer)
                {
                    parameters.TargetPlayer.Hand.Remove(card);
                    parameters.ActivePlayer.Hand.Add(card);
                }
            }

            parameters.TargetPlayer.Hand.Add(Draw.Action(2, parameters.Game));

            return(true);
        }
Exemplo n.º 28
0
        bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            List <Color> activePlayerTopColors = parameters.ActivePlayer.Tableau.GetStackColors();
            List <ICard> possibleTransferCards = parameters.TargetPlayer.Tableau.GetTopCards().Where(x => !activePlayerTopColors.Contains(x.Color)).ToList();

            if (possibleTransferCards.Count == 0)
            {
                return(false);
            }

            ICard cardToTransfer = parameters.TargetPlayer.PickCard(possibleTransferCards);

            parameters.TargetPlayer.Tableau.Stacks[cardToTransfer.Color].RemoveCard(cardToTransfer);
            parameters.ActivePlayer.Tableau.ScorePile.Add(cardToTransfer);

            Tuck.Action(Draw.Action(1, parameters.Game), parameters.TargetPlayer);

            return(true);
        }
Exemplo n.º 29
0
        private bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            var selectedCards = parameters.TargetPlayer.PickMultipleCards(parameters.TargetPlayer.Hand, 0, 3).ToList();

            if (selectedCards.Count == 0)
            {
                return(false);
            }

            foreach (ICard card in selectedCards)
            {
                parameters.TargetPlayer.Hand.Remove(card);
                Return.Action(card, parameters.Game);
            }

            Score.Action(Draw.Action(selectedCards.Count, parameters.Game), parameters.TargetPlayer);

            return(true);
        }
Exemplo n.º 30
0
        private bool Action1(CardActionParameters parameters)
        {
            ValidateParameters(parameters);

            List <ICard> cardsWithCrowns = parameters.TargetPlayer.Hand.Where(x => x.HasSymbol(Symbol.Crown)).ToList();

            if (cardsWithCrowns.Count == 0)
            {
                parameters.Game.StashPropertyBagValue("OarsAction1Taken", false);
                return(false);
            }

            ICard card = parameters.TargetPlayer.PickCard(cardsWithCrowns);

            parameters.TargetPlayer.Hand.Remove(card);
            Score.Action(card, parameters.ActivePlayer);

            parameters.TargetPlayer.Hand.Add(Draw.Action(1, parameters.Game));

            parameters.Game.StashPropertyBagValue("OarsAction1Taken", true);

            return(true);
        }