From 2350d43a09495db18b22b86ffc815a84eeb35579 Mon Sep 17 00:00:00 2001 From: alexichi Date: Wed, 11 May 2016 11:53:06 +0200 Subject: add longevity feature to items --- data/items.xml | 3 +++ inc/perso.inc | 21 ++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/data/items.xml b/data/items.xml index 4448b1c..e122826 100644 --- a/data/items.xml +++ b/data/items.xml @@ -7,6 +7,7 @@ +1 1 + 2 A sword that beginners need to use to improve their skills @@ -17,6 +18,7 @@ +3 1 + 2 A sword which are often use buy skilled knight. The material is very good and the sword is very powerful @@ -38,6 +40,7 @@ +2 3 + 1 🍶 If used, you have 20% more chance to hit your enemy during the battle diff --git a/inc/perso.inc b/inc/perso.inc index 9293d3c..ecf2a99 100644 --- a/inc/perso.inc +++ b/inc/perso.inc @@ -1,5 +1,7 @@ feat["limit"])) return true; else if(empty($_SESSION["usedItem"])){ initUsedItem(); + $_SESSION["usedItem"][$n] = array(); $_SESSION["usedItem"][$n]["nbUse"]=1; return true; } @@ -39,13 +42,17 @@ function limitUse($item){ } } -function initUsedItem(){ - $_SESSION["usedItem"]["Strength Bottle"]["longevity"] = 0;//if longevity equals 2, it means that the item was used during 2 battles - $_SESSION["usedItem"]["Wooden Sword"]["longevity"] = 0; - $_SESSION["usedItem"]["Metal Sword"]["longevity"] = 0; - $_SESSION["usedItem"]["Strength Bottle"]["nbUse"] = 0; - $_SESSION["usedItem"]["Wooden Sword"]["nbUse"] = 0; - $_SESSION["usedItem"]["Metal Sword"]["nbUse"] = 0; +function initUsedItem(){ + $_SESSION["usedItem"]=array(); +} + +function resetUsedItem($item){ + $it = $_SESSION["usedItem"][$item]; + foreach($it as $k => $v){ + foreach($v as $val){ + $val = 0; + } + } } function reusable(){ -- cgit v1.2.3-70-g09d2