From f734770dd4fe464a8c263218efa90fd487c6a608 Mon Sep 17 00:00:00 2001 From: piernov Date: Sun, 8 May 2016 14:41:25 +0200 Subject: Add feature attribute to Item class + add consume() method to use those features + use coercion on updatePerso() values --- inc/Item.inc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'inc/Item.inc') diff --git a/inc/Item.inc b/inc/Item.inc index 907872e..f01b709 100644 --- a/inc/Item.inc +++ b/inc/Item.inc @@ -1,16 +1,29 @@ name = $name; $this->cost = $cost; $this->icon = $icon; $this->desc = $desc; + $this->feat = $feat; + } + + function consume() { + foreach($this->feat as $k => $v) { + switch($k) { + case "hp": increasePerso("hp", +$v); break; + case "power": break; + } + } } function addToXML($root, $count) { -- cgit v1.2.3-54-g00ecf