Example #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);
            }
        }
Example #2
0
 /// <summary>
 /// Увеличивает максимальное количество здоровья карты, но не повышает текущее здоровье.
 /// </summary>
 /// <param name="card"></param>
 /// <param name="value"></param>
 public static void IncreaseCreatureMaxHealth(Card card, int value)
 {
     if (card != null && card.HasComponent <CreatureComponent>())
     {
         card.GetComponent <CreatureComponent>().MaxHealth += value;
     }
 }
Example #3
0
 /// <summary>
 /// Восстанавливает здоровье карты не выше, чем до изначального максимума.
 /// </summary>
 /// <param name="card"></param>
 /// <param name="value"></param>
 public static void LimitedHealCreature(Card card, int value)
 {
     if (card != null && card.HasComponent <CreatureComponent>())
     {
         CreatureComponent creature = card.GetComponent <CreatureComponent>();
         CardManager.CardSetHealth(card, GameMath.Clamp(creature.CurrentHealth + value, 0, creature.BaseHealth));
     }
 }
Example #4
0
 public static void DamageCreature(Card card, int value)
 {
     if (card != null && card.HasComponent <CreatureComponent>())
     {
         CreatureComponent creature = card.GetComponent <CreatureComponent>();
         CardManager.CardSetHealth(card, creature.CurrentHealth - value);
     }
 }
Example #5
0
 public static int GetHealth(Card card)
 {
     if (card.HasComponent <CreatureComponent>())
     {
         return(SetAffects(card).GetComponent <CreatureComponent>().CurrentHealth);
     }
     else
     {
         return(0);
     }
 }
Example #6
0
        public static void ResetCard(Card card)
        {
            card.IsTurned = false;

            if (card.HasComponent <CreatureComponent>())
            {
                CreatureComponent creatureComponent = card.GetComponent <CreatureComponent>();

                creatureComponent.CurrentAttack = creatureComponent.BaseAttack;
                creatureComponent.CurrentHealth = creatureComponent.BaseHealth;
            }
        }
Example #7
0
        public static void SetCreatureAttack(Card card, int value)
        {
            if (card != null && card.HasComponent <CreatureComponent>())
            {
                var creature = card.GetComponent <CreatureComponent>();
                creature.CurrentAttack -= value;

                if (creature.CurrentAttack < 0)
                {
                    creature.CurrentAttack = 0;
                }
            }
        }
Example #8
0
        /// <summary>
        /// Уменьшает максимальное количество здоровья карты.
        /// Если текущее здоровье оказывается больше максимального,
        /// то текущее здоровье понижается до нового значения максимального.
        /// </summary>
        /// <param name="card"></param>
        /// <param name="value"></param>
        public static void DecreaseCreatureMaxHealth(Card card, int value)
        {
            if (card != null && card.HasComponent <CreatureComponent>())
            {
                CreatureComponent creature = card.GetComponent <CreatureComponent>();

                creature.MaxHealth -= value;

                if (creature.CurrentHealth > creature.MaxHealth)
                {
                    creature.CurrentHealth = creature.MaxHealth;
                }
            }
        }