Пример #1
0
 public function startFight()
 {
     $this->shuffleWarriours();
     while ($this->warrior1->isAlive() && $this->warrior2->isAlive()) {
         $this->attack($this->warrior1, $this->warrior2);
         if ($this->warrior2->isAlive()) {
             $this->attack($this->warrior2, $this->warrior1);
         }
         $this->addToFightLog($this->warrior1->name . ' HP: ' . $this->warrior1->ability['maxHp'] . '/' . $this->warrior1->ability['stamina'] . "<br>");
         $this->addToFightLog($this->warrior2->name . ' HP: ' . $this->warrior2->ability['maxHp'] . '/' . $this->warrior2->ability['stamina'] . "<br>");
         if (!$this->warrior1->isAlive()) {
             $this->setWinner($this->warrior2);
         } elseif (!$this->warrior2->isAlive()) {
             $this->setWinner($this->warrior1);
         }
         $this->addToFightLog('<hr>');
     }
 }