} } $achilleas = new human(100, 10); $achilleas->setUtilityDamage(1.2); $achilleas->setCritChance(10); $achilleas->setRagePower(2); $superman = new kryptonian(100, 10); $superman->setHeatRay(18); $superman->setCritChance(20); $br = 0; while ($achilleas->getHP() && $superman->getHP() > 0) { $br++; if ($br % 2 == 0) { if (rand(0, 1) < 1) { $achilleas->useRagePower(); $achilleas->attack($superman); if ($superman->getHP() > 0) { $superman->useHeatRay($achilleas); $superman->attack($achilleas); } } else { $superman->useHeatRay($achilleas); $superman->attack($achilleas); if ($achilleas->getHP() > 0) { $achilleas->useRagePower(); $achilleas->attack($superman); } } } else { if (rand(0, 1) < 1) { $achilleas->attack($superman);
{ $remaining = $target->getHP() - $this->heatRay; // $superman->setHP(90); $target->setHP($remaining); } } $batman = new human(100, 10, 4); $batman->setUtilityDamage(1.2); $batman->setBatarangsDamage(4); $batman->setCritChance(10); $superman = new kryptonian(200, 10, 3); $superman->setHeatRay(18); $superman->setCritChance(20); do { if ($batman->speed > $superman->speed) { $batman->attack($superman); $superman->attack($batman); $batman->useBelt(); $batman->useBatarangs(); $superman->useHeatRay($batman); } elseif ($batman->speed == $superman->speed) { do { $batman = rand(0, 100); $superman = rand(0, 100); } while ($batman == $superman); if ($batman > $superman) { $batman->attack($superman); $superman->attack($batman); $batman->useBelt(); $batman->useBatarangs(); $superman->useHeatRay($batman);