From ff560b46a3e4854cf685170e34e9f6525c750d71 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 5 Sep 2014 17:27:18 -0400 Subject: [PATCH] V0.2.0: further implemented armband, not yet tied to game logic. --- .../items/artifacts/MasterThievesArmband.java | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java index bfd1a20fe..ceb169a7d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java @@ -3,6 +3,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; import com.watabou.utils.Random; @@ -20,10 +21,25 @@ public class MasterThievesArmband extends Artifact { //partialcharge and chargeCap are unused } + private int exp = 0; + @Override public String status() { if (charge > 0) return Utils.format("%d", charge); + else + return null; + } + + @Override + protected ArtifactBuff passiveBuff() { + return new Thievery(); + } + + @Override + public String desc() { + //TODO: add description + return ""; } public class Thievery extends ArtifactBuff{ @@ -34,8 +50,7 @@ public class MasterThievesArmband extends Artifact { public boolean steal(Item item){ if (item.price() <= charge){ charge -= item.price(); - //gainExp(item.price()); - return true; + exp += item.price(); } else { float chance = stealChance(item.price()); if (Random.Float() > chance) @@ -46,17 +61,21 @@ public class MasterThievesArmband extends Artifact { else //removes the charge it took you to reach 100% charge -= charge/chance; - //gainExp(item.price()); - return true; + exp += item.price(); } } + while(exp >= 1000 && level < levelCap) { + exp -= 1000; + level++; + } + return true; } public float stealChance(int value){ //get lvl*100 gold or lvl*5% item value of free charge, whichever is less. - int chargebonus = Math.min(level*100, (value*level)/20); + int chargeBonus = Math.min(level*100, (value*level)/20); - return (((float)charge + chargebonus)/value); + return (((float)charge + chargeBonus)/value); } } }