public bool takeDamage(List <DirectedAttack> attack) { foreach (DirectedAttack atk in attack) { atk.decreaseDamage(moat.getDefenseDmg()); foreach (Tower tower in towers) { tower.dealDamage(atk); } foreach (Wall wall in walls) { wall.dealDamage(atk); } } 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); }