예제 #1
0
function getBornesCaracsParOrigineEtMetier($origine, $metier)
{
    $caracs = array("FO", "AD", "INT", "CHA", "COU");
    $limitesOrigine = getBornesCaracsParOrigine($origine);
    $limitesMetier = getBornesCaracsParMetier($metier);
    $limites = array();
    foreach ($caracs as $carac) {
        $min = $carac . "MIN";
        $max = $carac . "MAX";
        if ($limitesOrigine[$min] > $limitesMetier[$min]) {
            $limites[$min] = $limitesOrigine[$min];
        } else {
            $limites[$min] = $limitesMetier[$min];
        }
        if ($limitesOrigine[$max] < $limitesMetier[$max]) {
            $limites[$max] = $limitesOrigine[$max];
        } else {
            $limites[$max] = $limitesMetier[$max];
        }
    }
    return $limites;
}
예제 #2
0
     $limites = getBornesCaracsParOrigineEtMetier($origine, $metier);
     $aventurier->COU = rand($limites["COUMIN"], $limites["COUMAX"]);
     $aventurier->INT = rand($limites["INTMIN"], $limites["INTMAX"]);
     $aventurier->FO = rand($limites["FOMIN"], $limites["FOMAX"]);
     $aventurier->CHA = rand($limites["CHAMIN"], $limites["CHAMAX"]);
     $aventurier->AD = rand($limites["ADMIN"], $limites["ADMAX"]);
     $_SESSION["birdibeuk_aventurier"] = serialize($aventurier);
     $listeOrigines = array($origine);
     $listeMetiers = array($metier);
     include "view/nouvelAventurierOrigineEtMetier.php";
     include "view/cadrePDF.php";
 } else {
     if (isset($_GET["metier"])) {
         //On a choisi un metier specifique
         $metier = new Metier($_GET["metier"]);
         $limites = getBornesCaracsParMetier($metier);
         $aventurier->COU = rand($limites["COUMIN"], $limites["COUMAX"]);
         $aventurier->INT = rand($limites["INTMIN"], $limites["INTMAX"]);
         $aventurier->FO = rand($limites["FOMIN"], $limites["FOMAX"]);
         $aventurier->CHA = rand($limites["CHAMIN"], $limites["CHAMAX"]);
         $aventurier->AD = rand($limites["ADMIN"], $limites["ADMAX"]);
         $_SESSION["birdibeuk_aventurier"] = serialize($aventurier);
         $listeOrigines = Origine::getOriginesPossibles($aventurier->COU, $aventurier->CHA, $aventurier->INT, $aventurier->AD, $aventurier->FO);
         $listeMetiers = array($metier);
         include "view/nouvelAventurierOrigineEtMetier.php";
         include "view/cadrePDF.php";
     } else {
         if (isset($_GET["origine"])) {
             //On a choisi un origine specifique
             $origine = new Origine($_GET["origine"]);
             $limites = getBornesCaracsParOrigine($origine);