public bool takeDamage(DirectedAttack attack)
 {
     if (attack.damage == 0)
     {
         return(false);
     }
     if (isGateOpen)
     {
         return(true);
     }
     dealDamage(attack);
     return(isDestroyed());
 }
        public bool takeDamage(DirectedAttack attack)
        {
            bool result = false;

            if (isBridgeDown)
            {
                if (isTarTrapSet)
                {
                    attack.decreaseDamage(tarDamage);
                    isTarTrapSet = false;
                }
            }
            attack.decreaseDamage(moat.getDefenseDmg());
            result = result || gate.takeDamage(attack);
            return(result);
        }
Example #3
0
 public virtual void dealDamage(DirectedAttack atk)
 {
     if (atk.direction != position)
     {
         return;
     }
     atk.decreaseDamage(dmgPerGuardian * guard_count);
     if (atk.damage <= 0)
     {
         return;
     }
     if (atk.damage < defense)
     {
         defense -= atk.damage;
     }
     else
     {
         defense = 0;
     }
 }