Esempio n. 1
0
        public static void CardSetHealth(Card card, int value)
        {
            if (card.HasComponent <CreatureComponent>())
            {
                CreatureComponent creature = card.GetComponent <CreatureComponent>();

                if (creature.CurrentHealth < value)
                {
                    foreach (var ability in card.GetAbilities())
                    {
                        ability.DoCardGetDamage();
                    }
                }

                if (creature.CurrentHealth > value && creature.CurrentHealth < creature.MaxHealth)
                {
                    foreach (var ability in card.GetAbilities())
                    {
                        ability.DoCardGetHeal();
                    }
                }

                creature.CurrentHealth = GameMath.Clamp(value, 0, creature.MaxHealth);
            }
        }
Esempio n. 2
0
        public static void ReplaceCard(Card card, InGamePosition inGamePosition)
        {
            switch (card.Position)
            {
            case InGamePosition.Unknown:
                break;

            case InGamePosition.Deck:
                card.Owner.Deck.Remove(card);
                break;

            case InGamePosition.Hand:
                card.Owner.Hand.Remove(card);
                break;

            case InGamePosition.Table:
                card.Owner.Table.Remove(card);
                card.GetAbilities().ForEach(a => a.DoCardLeaveFromTable());
                break;

            case InGamePosition.Graveyard:
                card.Owner.Graveyard.Remove(card);
                break;
            }

            switch (inGamePosition)
            {
            case InGamePosition.Unknown:
                card.Position = InGamePosition.Unknown;
                break;

            case InGamePosition.Deck:
                card.Owner.Deck.Add(card);
                card.Position = InGamePosition.Deck;
                break;

            case InGamePosition.Hand:
                card.Owner.Hand.Add(card);
                card.Position = InGamePosition.Hand;
                break;

            case InGamePosition.Table:
                card.Owner.Table.Add(card);
                card.GetAbilities().ForEach(a => a.DoCardPutOnTable());
                card.Position = InGamePosition.Table;
                break;

            case InGamePosition.Graveyard:
                card.Owner.Graveyard.Add(card);
                card.Position = InGamePosition.Graveyard;
                break;
            }
        }
Esempio n. 3
0
        public void PlayTurn(Player me, Player enemy)
        {
            while (GameManager.CanPutCardOnTable)
            {
                Card card = CardManager.GetRandCard(PlayerType.CurrentPlayer, InGamePosition.Hand);

                if (card == null)
                {
                    break;
                }
                else
                {
                    CardManager.UseAbility(card.GetAbilities()[0]);
                }
            }

            while (true)
            {
                Card card = CardManager.GetPlaifulCard(me);

                if (card == null)
                {
                    break;
                }

                var ability = CardManager.GetRandAvaliableAbility(card);
                CardManager.UseAbility(ability);
            }

            GameManager.EndTurn();
        }
Esempio n. 4
0
 public static List <Ability> GetAvaliableManualAbilities(Card card)
 {
     return((from a in card.GetAbilities()
             where IsCanAbilityManualUsedNow(a)
             select a).ToList());
 }
Esempio n. 5
0
 public static IEnumerable <Ability> GetCardAbilities(Card card, InGamePosition zoneOfUse)
 {
     return(card.GetAbilities().FindAll(a => a.ZoneOfUse == zoneOfUse));
 }