public function counterAttack(Unit $enemy) { try { $this->ensureIsAlive(); $enemy->takeDamage($this->damage / 2); } catch (Exception $a) { echo "my target is dead" . PHP_EOL; } }