public function applyEffect(Fish &$fish)
 {
     // As it's too low, it's getting worse for it's life
     if ($fish->getHunger() <= 2) {
         $fish->setHealth($fish->getHealth() - 5);
     }
     // As it's too high, it's getting worse for it's life
     if ($fish->getHunger() >= 8) {
         $fish->setHealth($fish->getHealth() - 10);
     }
 }
Пример #2
0
 public function applyEffect(Fish &$fish)
 {
     // time goes by, health is going down
     $fish->setHealth($fish->getHealth() - 1);
     $fish->addLifeTick();
     $fish->setHunger($fish->getHunger() + 1);
     $fish->setSleepiness($fish->getSleepiness() + 0.5);
     $fish->setPlayfull($fish->getPlayfull() + 3);
 }