diff options
author | alexichi <alexbankai96@gmail.com> | 2016-05-11 11:56:19 +0200 |
---|---|---|
committer | alexichi <alexbankai96@gmail.com> | 2016-05-11 11:56:19 +0200 |
commit | 35efaf74e828b738a20324a664cf9c2e08ef47d4 (patch) | |
tree | 183b4704c87c61b690010efbd6f3b30218328bcc /inc/perso.inc | |
parent | 2350d43a09495db18b22b86ffc815a84eeb35579 (diff) | |
parent | 1158d2063f00f38de19a4600566b244a942d86ba (diff) | |
download | candybox-35efaf74e828b738a20324a664cf9c2e08ef47d4.tar.gz candybox-35efaf74e828b738a20324a664cf9c2e08ef47d4.tar.bz2 candybox-35efaf74e828b738a20324a664cf9c2e08ef47d4.tar.xz candybox-35efaf74e828b738a20324a664cf9c2e08ef47d4.zip |
Merge branch 'master' of piernov.org:candybox into alexichialexichi
Conflicts:
inc/perso.inc
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; |