Example #1
0
             $fighters[$currentturn]['mp'] = min($fighters[$currentturn]['maxmp'], $fighters[$currentturn]['mp'] + $fighters[$currentturn]['mpreg'] + $status[$currentturn]['mpreg']);
         }
         if ($fighters[$currentturn]['hp'] < 1) {
             KillFighter($currentturn);
             continue;
         }
         for ($acts = 0; $acts < $fighters[$currentturn]['act']; $acts++) {
             $j = -1;
             do {
                 $j++;
             } while (!condition($currentturn, $j));
             action($currentturn, $j);
             //if(onlyOneTeam() || $currTurn >= $maxTurns) {
             //  break 2;
             //}
             if (onlyOneTeam() == $fighters[0]['party'] && $currTurn < $maxTurns) {
                 $reportintro .= "Victory!";
                 break 2;
             }
         }
     }
     updateMap($roomstats[$key]['length'], $roomstats[$key]['width'], $roomstats[$key]['floor']);
     DevalueStatus();
     $currTurn++;
 }
 // getTurnOrder();
 /*if(onlyOneTeam() == $fighters[0]['party'] && $currTurn < $maxTurns) {
     $reportintro .= "Victory!";
   } else {
     $reportintro .= "Defeat!";
     exit;
                    $j++;
                } while (!testSwitch1($currentturn, $j));
                testSwitch2($currentturn, $j);
                if (onlyOneTeam()) {
                    break 2;
                }
            }
        }
        updateMap($roomstats[$key]['length'], $roomstats[$key]['width'], $roomstats[$key]['floor']);
        $report .= "|";
    }
    // getTurnOrder();
    // updateMap($roomstats[$key]['length'], $roomstats[$key]['width']);
    $maxturns--;
    echo "Turns left: " . $maxturns . "<br>";
    if (onlyOneTeam() == $fighters[0]['party'] && $maxturns > 0) {
        $report .= "<center><h2>Victory!</h2></center>";
    } else {
        $report .= "<center><h2>Defeat!</h2></center>";
        giveXp();
        exit;
    }
    $report .= "|";
    foreach ($fighters as $ind => $fighter) {
        if ($fighter['party'] != $hero['party']) {
            echo "Unsetting: " . $fighter['name'] . "<br>";
            unset($fighters[$ind]);
        }
    }
    $partyfighters = $fighters;
}