Beispiel #1
0
 public function attack(\Core\CanFightInterface $target)
 {
     if ($target->isAlive()) {
         echo $this->getName() . " (" . $this->getHp() . ") attacks " . $target->getName() . " (" . $target->getHp() . ")\n";
         echo $this->getName() . " hits " . $this->getStrength() . " damage to " . $target->getName() . "\n";
         $target->takeDamage($this->getStrength());
     } else {
         echo $target->getName() . " is already dead !\n";
     }
 }
Beispiel #2
0
 public function attack(CanFightInterface $target)
 {
     $target->takeDamage(1);
 }
Beispiel #3
0
 public function attack(\Core\CanFightInterface $target)
 {
     $this->setDamage(mt_rand(5, 15));
     echo $this->getName() . " attaque et inflige " . $this->getDamage() . " dommages a " . $target->getName() . "(" . $target->getHp() . ")\n";
     $target->takeDamage($this->getDamage());
 }