コード例 #1
0
ファイル: Traits.cs プロジェクト: DaedalusGame/7DRL_2020
        public IEnumerable <Wait> Devour(Attack attack)
        {
            Creature      attacker = attack.Attacker;
            IEffectHolder defender = attack.Defender;

            int traitLvl = attacker.GetTrait(this);

            if (defender is Creature targetCreature && defender.HasFamily(Family.Slime) && targetCreature.CurrentHP / targetCreature.GetStat(Stat.HP) <= traitLvl * 0.2)
            {
                attacker.Heal(20 * traitLvl);
                targetCreature.TakeDamage(targetCreature.GetStat(Stat.HP), Element.Healing, null);
            }

            yield return(Wait.NoWait);
        }