Ejemplo n.º 1
0
 public void DealFirstCards()
 {
     for (int i = 0; i < 2; i++)
     {
         foreach (Player player in Players)
         {
             player.Hand.Push(GameDeck.DrawCard());
         }
     }
 }
Ejemplo n.º 2
0
        public void ExecuteAbilities(Card playedCard)
        {
            foreach (CardAbility ability in playedCard.Abilities)
            {
                if (ability.Type == AbilityType.Damage)
                {
                    foreach (Player player in Players)
                    {
                        if (player.ActivePlayer == false)
                        {
                            player.LifePoints -= ability.Value;
                        }
                    }
                }

                if (ability.Type == AbilityType.DrawCard)
                {
                    foreach (Player player in Players)
                    {
                        if (player.ActivePlayer == true)
                        {
                            for (int i = 0; i < ability.Value; i++)
                            {
                                player.CardsInHand.Add(GameDeck.DrawCard());
                            }
                        }
                    }
                }

                if (ability.Type == AbilityType.LifeGain)
                {
                    foreach (Player player in Players)
                    {
                        if (player.ActivePlayer == true)
                        {
                            player.LifePoints += ability.Value;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void GameLoop()
        {
            while (true)
            {
                foreach (Player activePlayer in Players)
                {
                    activePlayer.ActivePlayer = true;
                    activePlayer.CardsInHand.Add(GameDeck.DrawCard());
                    ConsoleKey menuChoice = ConsoleKey.A;

                    while (menuChoice != ConsoleKey.D3)
                    {
                        _print.Battlefield(this);
                        _print.PlayChoices();
                        menuChoice = Console.ReadKey().Key;

                        switch (menuChoice)
                        {
                        case ConsoleKey.D1:
                            Card playedCard = activePlayer.PlayCard();
                            if (playedCard.Abilities.Count() > 0)
                            {
                                ExecuteAbilities(playedCard);
                            }
                            break;

                        case ConsoleKey.D2:
                            int attackingCreatureIndex = activePlayer.SelectAttacker();
                            ExecuteFight(attackingCreatureIndex);
                            break;

                        default:
                            break;
                        }
                    }
                    activePlayer.Resources++;
                    activePlayer.ActivePlayer = false;
                }
            }
        }