Ouais, le souci que j'avais au début c'était pour comprendre le truc.
Après, quand il m'a parlé de jeté de dé, c'était beaucoup plus clair
Donc en gros c'est fait comme ça :
Code://les infos des chances des marchands : $nom_marchand = $vmarchand->nom; $banal = $vmarchand->banal; $tres_courant = $vmarchand->tres_courant; $courant = $vmarchand->courant; $assez_courant = $vmarchand->assez_courant; $inhabituel = $vmarchand->inhabituel; $rare = $vmarchand->rare; $tres_rare = $vmarchand->tres_rare; //fonction qui va tirer un nombre au pif entre 0 et 100 function chance_objet($fortune_par_rarete_marchand) { $chance = mt_rand(1,100); if($chance <= $fortune_par_rarete_marchand) { return(1); } else { if($chance - $fortune_par_rarete_marchand <= 30) { $augmentation_prix = $chance - $fortune_par_rarete_marchand; return($augmentation_prix); } else { return(0); } } } //Dans la boucle des objets, on teste selon la rareté de l'objet en cours if($rarete == 7) { $pv0 = chance_objet($tres_rare); } elseif($rarete == 6) { $pv0 = chance_objet($rare); } ... et enfin if($pv0 > 0) { if($pv0 == 1) { $pv = $v->prix; $augmentation_texte = 0; } else { $pv = $v->prix * (1 + $pv0 / 100); $augmentation_texte = $pv0; }