/** * Attack an opposing army. * * @param Army $enemy An opposing army that will soon be crushed in defeat * * @return void */ public function attack(Army $enemy) { $this->herald->announce("Attack the vile {$enemy->name}!"); $victory = $this->strength() > $enemy->strength(); $this->sustainDamage($victory); $enemy->sustainDamage($victory); if ($victory) { $this->rejoice(); $this->demandSurrender($enemy); } else { $this->wallow(); $enemy->demandSurrender($this); } return; }