Exemple #1
0
    {
        $this->heatRay = $h;
    }
    public function getHeatRay()
    {
        return $this->heatRay;
    }
    public function useHeatRay(&$target)
    {
        $remaining = $target->getHP() - $this->heatRay;
        // $superman->setHP(90);
        $target->setHP($remaining);
    }
}
$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);
Exemple #2
0
    {
        $this->heatRay = $h;
    }
    public function getHeatRay()
    {
        return $this->heatRay;
    }
    public function useHeatRay(&$target)
    {
        $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);