diff options
author | alexichi <alexbankai96@gmail.com> | 2016-05-09 20:26:51 +0200 |
---|---|---|
committer | alexichi <alexbankai96@gmail.com> | 2016-05-09 20:26:51 +0200 |
commit | 2f32bc3153b7f2c2561e4603f912573921e6449f (patch) | |
tree | 87419a11e12f5b7433459fcb5cb9da5211dcbd9e /inc/Inventory.inc | |
parent | f1677164c3f46785f6d9380b68cdeba58a680404 (diff) | |
download | candybox-2f32bc3153b7f2c2561e4603f912573921e6449f.tar.gz candybox-2f32bc3153b7f2c2561e4603f912573921e6449f.tar.bz2 candybox-2f32bc3153b7f2c2561e4603f912573921e6449f.tar.xz candybox-2f32bc3153b7f2c2561e4603f912573921e6449f.zip |
add the use of the objects and the feature power and maxHP
Diffstat (limited to 'inc/Inventory.inc')
-rw-r--r-- | inc/Inventory.inc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/inc/Inventory.inc b/inc/Inventory.inc index 2be48f8..3e0137d 100644 --- a/inc/Inventory.inc +++ b/inc/Inventory.inc @@ -1,5 +1,7 @@ <?php +require_once("perso.inc"); + class Inventory { public $items = array(); @@ -55,12 +57,14 @@ class Inventory { foreach($this->items as $k => $object){ if($object[0] == $item) { $nb = $this->items[$k][1]; - if($nb > 0) { - $this->items[$k][0]->consume(); - $this->items[$k][1]--; + if(limitUse($this->items[$k][0])){ + if($nb > 0) { + $this->items[$k][0]->consume(); + $this->items[$k][1]--; + } + if($nb-1 <= 0) $this->_removeItem($item); + return array($object[0], $nb-1); } - if($nb-1 <= 0) $this->_removeItem($item); - return array($object[0], $nb-1); } } return false; |