Exemple #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);
            }
        }
Exemple #2
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));
     }
 }
Exemple #3
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);
     }
 }
Exemple #4
0
        public IComponent Copy()
        {
            CreatureComponent copy = new CreatureComponent(BaseAttack, BaseHealth);

            copy.CurrentAttack = CurrentAttack;
            copy.MaxHealth     = MaxHealth;
            copy.CurrentHealth = CurrentHealth;

            return(copy);
        }
Exemple #5
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;
            }
        }
Exemple #6
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;
                }
            }
        }