diff --git a/assets/buffs.png b/assets/buffs.png index e809c1aa3..b4f605681 100644 Binary files a/assets/buffs.png and b/assets/buffs.png differ diff --git a/assets/large_buffs.png b/assets/large_buffs.png index bf930a9f9..8da29c514 100644 Binary files a/assets/large_buffs.png and b/assets/large_buffs.png differ diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java new file mode 100644 index 000000000..37ec1dfde --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java @@ -0,0 +1,113 @@ +package com.shatteredpixel.shatteredpixeldungeon.items.artifacts; + +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; +import com.watabou.utils.Random; + +/** + * Created by debenhame on 03/09/2014. + */ +public class CapeOfThorns extends Artifact { + //TODO: add polish, testing + + { + name = "Cape of Thorns"; + image = ItemSpriteSheet.ARTIFACT_CAPE; + level = 0; + levelCap = 10; + charge = 0; + chargeCap = 100; + //partialcharge is unused + } + + private int timer = 0; + + private int exp = 0; + + @Override + public String status() { + if (timer == 0) + return Utils.format("%d%", charge); + else + return Utils.format("%d", timer); + } + + @Override + protected ArtifactBuff passiveBuff() { + return new Thorns(); + } + + @Override + public String desc() { + //TODO: add description + return ""; + } + + public class Thorns extends ArtifactBuff{ + + @Override + public boolean act(){ + if (timer > 0) + timer--; + else if (charge > 0) + charge--; + return true; + } + + public int proc(int damage, Char attacker){ + if (timer == 0){ + charge += damage/(4f - level*0.1); + if (charge > chargeCap){ + charge = 0; + timer = 5+level; + } + } + + if (timer != 0){ + int deflected = Random.NormalIntRange(0, (int)(damage*0.66)); + damage -= deflected; + + attacker.damage(deflected, this); + + exp+= deflected; + + if (exp >= (level+1)*10 && level < levelCap){ + exp -= (level+1)*10; + level++; + GLog.p("Your Cape grows stronger!"); + } + + } + return damage; + } + + @Override + public String toString() { + return "Thorns"; + } + + @Override + public int icon() { + if (timer == 0) + return BuffIndicator.NONE; + else + return BuffIndicator.THORNS; + } + + @Override + public void detach(){ + timer = 0; + charge = 0; + } + + } + + +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java index 2e26e817d..adb11e43c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -64,6 +64,7 @@ public class BuffIndicator extends Component { public static final int DEFERRED = 28; public static final int DROWSY = 29; public static final int MAGIC_SLEEP = 30; + public static final int THORNS = 31; public static final int SIZE = 7;