4a503405 |
<?php
session_start();
include('fonctions.php');
connectionBDD();
$obj = 'objets'.$_GET['ObjetNum'];
$_SESSION[$obj]=0;
//Pour une partie de la journ�e (petitmatin,matin�e,apresmidi,soir�e) 3 encas sont possible avant de changer l'heure...
$_SESSION['enCas']++;
if($_SESSION['enCas']>3){
ChangementHeureJournee();
}
//augmentation des caracteristiques
$_SESSION['Aug_Int'] += $_GET['augInt'];
$_SESSION['Aug_For'] += $_GET['augFor'];
$_SESSION['Aug_Vit'] += $_GET['augVit'];
$_SESSION['Aug_Cha'] += $_GET['augCha'];
$_SESSION['Aug_Dex'] += $_GET['augDex'];
$_SESSION['Aug_Sag'] += $_GET['augSag'];
CalculCaractAugmentee(FALSE);
//changement des pr�f�rences
switch($_GET['typeObjet']){
case 1:
$_SESSION['VitActuelleAug']+=($_SESSION['N_pomme']/2);
$_SESSION['VitActuelle']+=($_SESSION['N_pomme']/2);
$_SESSION['FatigueActuelle']+=$_SESSION['N_pomme'];
$_SESSION['N_pomme'] += 10;
$_SESSION['N_viandeSeche'] -= 8;
$_SESSION['N_orange'] += 5;
$_SESSION['N_pain'] -= 4;
$_SESSION['N_chocolat'] += 2;
$_SESSION['N_lait'] -= 2;
break;
case 2:
$_SESSION['VitActuelleAug']+=($_SESSION['N_viandeSeche']/2);
$_SESSION['VitActuelle']+=($_SESSION['N_viandeSeche']/2);
$_SESSION['FatigueActuelle']+=$_SESSION['N_viandeSeche'];
$_SESSION['N_pomme'] -= 8;
$_SESSION['N_viandeSeche'] += 10;
$_SESSION['N_orange'] -= 4;
$_SESSION['N_pain'] += 5;
$_SESSION['N_chocolat'] -= 2;
$_SESSION['N_lait'] += 2;
break;
case 3:
$_SESSION['VitActuelleAug']+=($_SESSION['N_orange']/2);
$_SESSION['VitActuelle']+=($_SESSION['N_orange']/2);
$_SESSION['FatigueActuelle']+=$_SESSION['N_orange'];
$_SESSION['N_pomme'] += 2;
$_SESSION['N_viandeSeche'] -= 4;
$_SESSION['N_orange'] += 10;
$_SESSION['N_pain'] -= 2;
$_SESSION['N_chocolat'] += 5;
$_SESSION['N_lait'] -= 8;
break;
case 4:
$_SESSION['VitActuelleAug']+=($_SESSION['N_pain']/2);
$_SESSION['VitActuelle']+=($_SESSION['N_pain']/2);
$_SESSION['FatigueActuelle']+=$_SESSION['N_pain'];
$_SESSION['N_pomme'] -= 8;
$_SESSION['N_viandeSeche'] -= 2;
$_SESSION['N_orange'] -= 4;
$_SESSION['N_pain'] += 10;
$_SESSION['N_chocolat'] += 2;
$_SESSION['N_lait'] += 5;
break;
case 5:
$_SESSION['VitActuelleAug']+=($_SESSION['N_chocolat']/2);
$_SESSION['VitActuelle']+=($_SESSION['N_chocolat']/2);
$_SESSION['FatigueActuelle']+=$_SESSION['N_chocolat'];
$_SESSION['N_pomme'] -= 2;
$_SESSION['N_viandeSeche'] -= 8;
$_SESSION['N_orange'] -= 4;
$_SESSION['N_pain'] += 5;
$_SESSION['N_chocolat'] += 10;
$_SESSION['N_lait'] += 2;
break;
case 6:
$_SESSION['VitActuelleAug']+=($_SESSION['N_lait']/2);
$_SESSION['VitActuelle']+=($_SESSION['N_lait']/2);
$_SESSION['FatigueActuelle']+=$_SESSION['N_lait'];
$_SESSION['N_pomme'] += 5;
$_SESSION['N_viandeSeche'] += 2;
$_SESSION['N_orange'] -= 2;
$_SESSION['N_pain'] -= 4;
$_SESSION['N_chocolat'] -= 8;
$_SESSION['N_lait'] += 10;
break;
default:
}
//coh�rence des pr�f�rences
if($_SESSION['N_pomme']>100){
$_SESSION['N_pomme']=100;
}else if($_SESSION['N_pomme']<0){
$_SESSION['N_pomme']=0;
}
if($_SESSION['N_viandeSeche']>100){
$_SESSION['N_viandeSeche']=100;
}else if($_SESSION['N_viandeSeche']<0){
$_SESSION['N_viandeSeche']=0;
}
if($_SESSION['N_orange']>100){
$_SESSION['N_orange']=100;
}else if($_SESSION['N_orange']<0){
$_SESSION['N_orange']=0;
}
if($_SESSION['N_pain']>100){
$_SESSION['N_pain']=100;
}else if($_SESSION['N_pain']<0){
$_SESSION['N_pain']=0;
}
if($_SESSION['N_chocolat']>100){
$_SESSION['N_chocolat']=100;
}else if($_SESSION['N_chocolat']<0){
$_SESSION['N_chocolat']=0;
}
if($_SESSION['N_lait']>100){
$_SESSION['N_lait']=100;
}else if($_SESSION['N_lait']<0){
$_SESSION['N_lait']=0;
}
//augmentation de la fatigue et coh�rence
$_SESSION['FatigueActuelle'] += $_GET['augFat'];
if($_SESSION['FatigueActuelle']>100){
$_SESSION['FatigueActuelle']=100;
}else if($_SESSION['FatigueActuelle']<1){
$_SESSION['FatigueActuelle']=0;
header("location:fatigue.php");
}
//coh�rence des points de vie
if($_SESSION['VitActuelle']>$_SESSION['Vit']){
$_SESSION['VitActuelle']=$_SESSION['Vit'];
}
if($_SESSION['VitActuelleAug']>$_SESSION['VitAug']){
$_SESSION['VitActuelleAug']=$_SESSION['VitAug'];
}else if($_SESSION['VitActuelleAug']<0){
$_SESSION['VitActuelleAug']=0;
header("location:mort.php");
}
//la page prec�dente..
$pageprecedente=$_GET['pageprecedente'];
if(strpos($_GET['pageprecedente'],'?') === FALSE){
$pageprecedente .= "?etat=1";
}else{
if(strpos($_GET['pageprecedente'],'etat=1') === FALSE){
$pageprecedente .= "&etat=1";
}
}
//retour a la page precedente
if($_GET['Retour']==0){
header("location:FicheDSac.php?pageprecedente=".$pageprecedente);
}else if($_GET['Retour']==1){
header("location:D_echoppe_marchand.php?dialogueMarchand=6");
}
mysql_close();
?>
|