<?php
	session_start();
	
	if ($_GET['bouton'] == 0) //initialisation
	{
		$_SESSION['mimichant_strength'] = 5;
		$_SESSION['mimichant_const'] = 5;
		$_SESSION['mimichant_dext'] = 5;
		$_SESSION['mimichant_psy'] = 5;
		$_SESSION['mimichant_pointsrestants'] = 10;
	}
	
	if ($_SESSION['mimichant_pointsrestants']>0) {
		switch ($_GET['bouton'])
		{
			case 2:$_SESSION['mimichant_strength']++;$_SESSION['mimichant_pointsrestants']--;break;
			case 4:$_SESSION['mimichant_const']++;$_SESSION['mimichant_pointsrestants']--;break;
			case 6:$_SESSION['mimichant_dext']++;$_SESSION['mimichant_pointsrestants']--;break;
			case 8:$_SESSION['mimichant_psy']++;$_SESSION['mimichant_pointsrestants']--;break;
		}
	}
	
	$MINIMUM_CARAC = 3;
	switch ($_GET['bouton'])
	{
		case 1:if ($_SESSION['mimichant_strength'] > $MINIMUM_CARAC) 
			{$_SESSION['mimichant_strength']--;$_SESSION['mimichant_pointsrestants']++;}break;
		case 3:if ($_SESSION['mimichant_const'] > $MINIMUM_CARAC) 
			{$_SESSION['mimichant_const']--;$_SESSION['mimichant_pointsrestants']++;}break;
		case 5:if ($_SESSION['mimichant_dext'] > $MINIMUM_CARAC) 
			{$_SESSION['mimichant_dext']--;$_SESSION['mimichant_pointsrestants']++;}break;
		case 7:if ($_SESSION['mimichant_psy'] > $MINIMUM_CARAC) 
			{$_SESSION['mimichant_psy']--;$_SESSION['mimichant_pointsrestants']++;}break;
	}
	
/*************
affichage
*************/

	header('Content-Type: text/html');

	echo 'Il vous reste '.$_SESSION['mimichant_pointsrestants'].' points &agrave; attribuer ';
	echo '<br /><br /><b><u>Les Attributs :</u></b>';
	echo '<ul>';
	echo '<li>Force : '.$_SESSION['mimichant_strength'].'</li>';
	echo '<li>Constitution : '.$_SESSION['mimichant_const'].'</li>';
	echo '<li>Dexterit&eacute; : '.$_SESSION['mimichant_dext'].'</li>';
	echo '<li>Psychisme : '.$_SESSION['mimichant_psy'].'</li>';
	echo '</ul>';
?>
