예제 #1
0
        public override int OnTakeDamage(int amount, BaseAction.ActionType actionType)
        {
            if (!UsedReaction && (actionType == BaseAction.ActionType.MeleeAttack || actionType == BaseAction.ActionType.RangedAttack))
            {
                bool shouldUseEvasion = false;

                int currentHP = Health + TempHitPoints;

                // if this would kill me, evade!
                if (amount >= currentHP)
                {
                    shouldUseEvasion = true;
                }

                // if this takes away half my health or more, evade!
                if (amount >= (int)Math.Floor(currentHP / 2.0))
                {
                    shouldUseEvasion = true;
                }

                if (shouldUseEvasion)
                {
                    amount       = (int)Math.Floor(amount / 2.0);
                    UsedReaction = true;
                }
            }

            return(base.OnTakeDamage(amount, actionType));
        }
예제 #2
0
        public bool TakeDamage(int amount, BaseAction.ActionType actionType)
        {
            amount = OnTakeDamage(amount, actionType);

            if (TempHitPoints > 0)
            {
                if (amount >= TempHitPoints)
                {
                    amount       -= TempHitPoints;
                    TempHitPoints = 0;
                }
                else
                {
                    TempHitPoints -= amount;
                    return(true);
                }
            }

            Health -= amount;
            if (Health <= 0)
            {
                Health = 0;
                Alive  = false;
                OnDeath();

                if (MyType == CreatureType.Summon)
                {
                    BeenSummoned = false;
                }

                return(false);
            }

            return(true);
        }
예제 #3
0
 public virtual int OnTakeDamage(int amount, BaseAction.ActionType actionType)
 {
     return(amount);
 }