V0.2.0: further implemented armband, not yet tied to game logic.

This commit is contained in:
Evan Debenham 2014-09-05 17:27:18 -04:00
parent e650767d29
commit ff560b46a3

View File

@ -3,6 +3,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.utils.Random; import com.watabou.utils.Random;
@ -20,10 +21,25 @@ public class MasterThievesArmband extends Artifact {
//partialcharge and chargeCap are unused //partialcharge and chargeCap are unused
} }
private int exp = 0;
@Override @Override
public String status() { public String status() {
if (charge > 0) if (charge > 0)
return Utils.format("%d", charge); 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{ public class Thievery extends ArtifactBuff{
@ -34,8 +50,7 @@ public class MasterThievesArmband extends Artifact {
public boolean steal(Item item){ public boolean steal(Item item){
if (item.price() <= charge){ if (item.price() <= charge){
charge -= item.price(); charge -= item.price();
//gainExp(item.price()); exp += item.price();
return true;
} else { } else {
float chance = stealChance(item.price()); float chance = stealChance(item.price());
if (Random.Float() > chance) if (Random.Float() > chance)
@ -46,17 +61,21 @@ public class MasterThievesArmband extends Artifact {
else else
//removes the charge it took you to reach 100% //removes the charge it took you to reach 100%
charge -= charge/chance; charge -= charge/chance;
//gainExp(item.price()); exp += item.price();
}
}
while(exp >= 1000 && level < levelCap) {
exp -= 1000;
level++;
}
return true; return true;
} }
}
}
public float stealChance(int value){ public float stealChance(int value){
//get lvl*100 gold or lvl*5% item value of free charge, whichever is less. //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);
} }
} }
} }