diff options
Diffstat (limited to 'inc/perso.inc')
-rw-r--r-- | inc/perso.inc | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/inc/perso.inc b/inc/perso.inc index ecf2a99..aaf7b1b 100644 --- a/inc/perso.inc +++ b/inc/perso.inc @@ -1,13 +1,29 @@ <?php +/** + * Manages player's stats: life, experience, level. + * + * @package inc\perso.inc + * @author Alexandre Renoux + * @author Pierre-Emmanuel Novac + */ -require_once("Inventory.inc"); - +/** + * Returns all player's stats after initializing them if needed. + * + * @return int[] arrays containing player's stats + */ function sendPerso() { if(empty($_SESSION["perso"])) initPerso(); return $_SESSION["perso"]; } +/** + * Increases a player's stat. + * + * @param int $prop stat to increase + * @return void + */ function increasePerso($prop, $num) { if(empty($_SESSION["perso"])) initPerso(); @@ -77,6 +93,11 @@ function reusable(){ //echo json_encode($_SESSION["usedItem"]); } +/** + * Copies stats given in POST request to session. + * + * @return void + */ function updatePerso(){ $hp = $_POST["hp"]; $maxHP = $_POST["maxHP"]; @@ -92,6 +113,11 @@ function updatePerso(){ $_SESSION["perso"]["bonusPower"] = +$bonusPower; } +/** + * Initializes the player's stats. + * + * @return void + */ function initPerso(){ $_SESSION["perso"]["hp"] = 5; $_SESSION["perso"]["maxHP"] = 5; |