TraitementDebutDeCombat2.php
4a503405
 <?php
 session_start();
 include('fonctions.php');
 connectionBDD();
 	//creation des variables contenant les caracteristiques de l'ennemi
 	$resultat = mysql_query("SELECT * FROM ennemi WHERE id_monstre = '".$_GET['ennemi']."'");
 	$tableauReponse = mysql_fetch_assoc($resultat);
 	$_SESSION['ennemiNom'] = $tableauReponse['nom'];
 	$_SESSION['ennemiDescription'] = $tableauReponse['description'];
 	$_SESSION['ennemiVit'] = $tableauReponse['Vitalite'];
 	$_SESSION['ennemiVitAct'] = $_SESSION['ennemiVit'];
 	$_SESSION['ennemiFor'] = $tableauReponse['Forc'];
 	$_SESSION['ennemiInt'] = $tableauReponse['Intelligence'];
 	$_SESSION['ennemiCha'] = $tableauReponse['Charisme'];
 	$_SESSION['ennemiSag'] = $tableauReponse['Sagesse'];
 	$_SESSION['ennemiDex'] = $tableauReponse['Dexterite'];
 	$_SESSION['ennemiOr'] = $tableauReponse['OrLaisse'];
 	$_SESSION['ennemiObjetLaisse'] = $tableauReponse['ObjetLaisse'];
 	$_SESSION['ennemiPoucentObjet'] = $tableauReponse['PourcentObjet'];
 	$_SESSION['ennemiXp'] = $tableauReponse['XpLaisse'];
 	$_SESSION['ennemiImage'] = $tableauReponse['image'];
 	$_SESSION['varEnnemi'] = $tableauReponse['varEnnemi'];
 	//creationde la fatigue du monstre
 	$_SESSION['ennemiFatigue'] = $tableauReponse['Fatigue'] + rand(0,25);
 	$_SESSION['ennemiFatigueMax'] = $tableauReponse['Fatigue'] + 25;
 	//choix de l'iniative
 	$initiativePerso  = $_SESSION['Int'] + $_SESSION['For'] + $_SESSION['Dex'] + $_SESSION['Cha'] + $_SESSION['Sag'] + $_SESSION['VitActuelle'] + rand(0,100);
 	$initiativeMonstre = 	$_SESSION['ennemiVit'] + $_SESSION['ennemiFor'] + $_SESSION['ennemiInt'] + $_SESSION['ennemiCha'] + $_SESSION['ennemiSag'] + $_SESSION['ennemiDex'] + rand(0,100);
 	if($initiativeMonstre > $initiativePerso){
 		$_SESSION['initiative'] = 1;
 	}else{
 		$_SESSION['initiative'] = 0;
 	}
 	//recup de la page precent le combat
 	$_SESSION['pageprecedentCombat'] = $_GET['pagereference'];
 	//$_SESSION['pageprecedentCombat'] = $_SERVER['HTTP_REFERER'];
 
 	header("location:ennemi2.php");
 mysql_close();
 ?>