Beispiel #1
0
        public override void DoAction(GameStateContext c, string s)
        {
            string cardName = actionDictionary[s];
            if ("" == cardName)
            {

            }
            else
            {
                Card card = game.ActivePlayer.Hand.Remove(cardName);
                discards.Add(card);
            }

            if (cardName == "" || (game.ActivePlayer.Hand.Cards.Count() == 0))
            {
                game.ActivePlayer.ExpandHand(discards.Count);
                foreach (Card card in discards)
                {
                    game.ActivePlayer.Discard.Gain(card);
                }
                c.State = ActionState.NextState(game);
            }
            else
            {
                c.State = this;
            }
        }
Beispiel #2
0
        public override void DoAction(GameStateContext c, string s)
        {
            string cardName = actionDictionary[s];
            if ("" == cardName)
            {

            }
            else
            {
                Card card = player.RemoveFromHand(cardName);
                discards.Add(card);
            }

            if ( cardName == "" || (player.GetHandCards().Count == 0) )
            {
                player.ExpandHand(discards.Count);
                foreach (Card card in discards)
                {
                    player.Gain(card);
                }
                c.State = ActionState.NextState(player, supply);
            }
            else
            {
                c.State = this;
            }
        }
Beispiel #3
0
        public override void DoAction(GameStateContext c, string s)
        {
            game.Turn.NumBuys--;

            Card card = Actions.Gain.GainInDiscard(actionDictionary, game.ActivePlayer, game.Supply, s);

            if (card != null)
            {
                game.Turn.DecreaseMoneyAvailable( card.Price );

                if (game.Supply.IsGameOver())
                {
                    c.State = new GameOverState();
                }
                else if (game.Turn.NumBuys > 0)
                {
                    c.State = new BuyState(game);
                }
                else
                {
                    game.CleanUp();
                    c.State = new ActionState(game);
                }
            }
            else
            {
                game.CleanUp();
                c.State = new ActionState(game);
            }
        }
Beispiel #4
0
 public override void DoAction(GameStateContext c, string s)
 {
     if (s == SHUFFLE)
     {
         var deckCards = game.ActivePlayer.Deck.RemoveAll();
         foreach (Card card in deckCards)
         {
             game.ActivePlayer.Discard.Gain(card);
         }
     }
     c.State = ActionState.NextState(game);
 }
Beispiel #5
0
 public override void DoAction(GameStateContext c, string s)
 {
     switch (remodelState)
     {
         case RState.PICK_TRASH:
             DoTrashAction(c, s);
             break;
         case RState.PICK_GAIN:
             DoGainAction(c, s);
             break;
     }
 }
Beispiel #6
0
        public override void DoAction(GameStateContext c, string s)
        {
            Actions.Gain.GainInDiscard(actionDictionary, player, supply, s);

            if (supply.IsGameOver())
            {
                c.State = new GameOverState();
            }
            else
            {
                c.State = ActionState.NextState(player, supply);
            }
        }
Beispiel #7
0
        public Game()
        {
            player = new Player();
            supply = new Supply();

            for(int i =0; i < 7; i++)
            {
                player.Gain( supply.Release("Copper"));
            }
            Card e = new Estate();
            for(int i =0; i < 3; i++)
            {
                player.Gain( e );
            }

            gameState = new GameStateContext(player, supply);
            gameState.StateChange += () =>
                {
                    OnStateChange();
                };

            player.NewHand();
        }
Beispiel #8
0
        private void DoTrashAction(GameStateContext c, string s)
        {
            var trashName = actionDictionary[s];

            var trashCard = game.ActivePlayer.Hand.Remove(trashName);

            game.Trash.Add(trashCard);

            gainValue = 2 + trashCard.Price;

            remodelState = RState.PICK_GAIN;
            c.State = this;
        }
Beispiel #9
0
        private void DoGainAction(GameStateContext c, string s)
        {
            Actions.Gain.GainInDiscard(actionDictionary, game.ActivePlayer, game.Supply, s);

            if (game.Supply.IsGameOver())
            {
                c.State = new GameOverState();
            }
            else
            {
                c.State = ActionState.NextState(game);
            }
        }
Beispiel #10
0
 public override void DoAction(GameStateContext c, string s)
 {
 }
Beispiel #11
0
 public abstract void DoAction(GameStateContext c, string s);