From 2f32bc3153b7f2c2561e4603f912573921e6449f Mon Sep 17 00:00:00 2001 From: alexichi Date: Mon, 9 May 2016 20:26:51 +0200 Subject: add the use of the objects and the feature power and maxHP --- inc/Inventory.inc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'inc/Inventory.inc') 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 @@ 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; -- cgit v1.2.3-54-g00ecf