Browse code

Version initiale du programme sous forme de boucle conditionnelle

Emmanuel ROY authored on 01/05/2022 12:54:29
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,40 @@
1
+<?php
2
+session_start();
3
+include('fonctions.php');
4
+connectionBDD();
5
+	//creation des variables contenant les caracteristiques de l'ennemi
6
+	$resultat = mysql_query("SELECT * FROM ennemi WHERE id_monstre = '".$_GET['ennemi']."'");
7
+	$tableauReponse = mysql_fetch_assoc($resultat);
8
+	$_SESSION['ennemiNom'] = $tableauReponse['nom'];
9
+	$_SESSION['ennemiDescription'] = $tableauReponse['description'];
10
+	$_SESSION['ennemiVit'] = $tableauReponse['Vitalite'];
11
+	$_SESSION['ennemiVitAct'] = $_SESSION['ennemiVit'];
12
+	$_SESSION['ennemiFor'] = $tableauReponse['Forc'];
13
+	$_SESSION['ennemiInt'] = $tableauReponse['Intelligence'];
14
+	$_SESSION['ennemiCha'] = $tableauReponse['Charisme'];
15
+	$_SESSION['ennemiSag'] = $tableauReponse['Sagesse'];
16
+	$_SESSION['ennemiDex'] = $tableauReponse['Dexterite'];
17
+	$_SESSION['ennemiOr'] = $tableauReponse['OrLaisse'];
18
+	$_SESSION['ennemiObjetLaisse'] = $tableauReponse['ObjetLaisse'];
19
+	$_SESSION['ennemiPoucentObjet'] = $tableauReponse['PourcentObjet'];
20
+	$_SESSION['ennemiXp'] = $tableauReponse['XpLaisse'];
21
+	$_SESSION['ennemiImage'] = $tableauReponse['image'];
22
+	$_SESSION['varEnnemi'] = $tableauReponse['varEnnemi'];
23
+	//creationde la fatigue du monstre
24
+	$_SESSION['ennemiFatigue'] = $tableauReponse['Fatigue'] + rand(0,25);
25
+	$_SESSION['ennemiFatigueMax'] = $tableauReponse['Fatigue'] + 25;
26
+	//choix de l'iniative
27
+	$initiativePerso  = $_SESSION['Int'] + $_SESSION['For'] + $_SESSION['Dex'] + $_SESSION['Cha'] + $_SESSION['Sag'] + $_SESSION['VitActuelle'] + rand(0,100);
28
+	$initiativeMonstre = 	$_SESSION['ennemiVit'] + $_SESSION['ennemiFor'] + $_SESSION['ennemiInt'] + $_SESSION['ennemiCha'] + $_SESSION['ennemiSag'] + $_SESSION['ennemiDex'] + rand(0,100);
29
+	if($initiativeMonstre > $initiativePerso){
30
+		$_SESSION['initiative'] = 1;
31
+	}else{
32
+		$_SESSION['initiative'] = 0;
33
+	}
34
+	//recup de la page precent le combat
35
+	$_SESSION['pageprecedentCombat'] = $_GET['pagereference'];
36
+	//$_SESSION['pageprecedentCombat'] = $_SERVER['HTTP_REFERER'];
37
+
38
+	header("location:ennemi.php");
39
+mysql_close();
40
+?>
0 41
\ No newline at end of file