diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index b2ef41719..c76683c38 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -895,11 +895,6 @@ public class Hero extends Char { @Override public int defenseProc( Char enemy, int damage ) { - CapeOfThorns.Thorns thorns = buff( CapeOfThorns.Thorns.class ); - if (thorns != null) { - damage = thorns.proc(damage, enemy); - } - Earthroot.Armor armor = buff( Earthroot.Armor.class ); if (armor != null) { damage = armor.absorb( damage ); @@ -932,6 +927,11 @@ public class Hero extends Char { GLog.w("The pain helps you resist the urge to sleep."); } + CapeOfThorns.Thorns thorns = buff( CapeOfThorns.Thorns.class ); + if (thorns != null) { + dmg = thorns.proc(dmg, (src instanceof Char ? (Char)src : null), this); + } + int tenacity = 0; for (Buff buff : buffs(RingOfTenacity.Tenacity.class)) { tenacity += ((RingOfTenacity.Tenacity)buff).level; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java index 809653aed..91e614363 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java @@ -2,6 +2,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -40,10 +41,10 @@ public class CapeOfThorns extends Artifact { desc += "\n\n"; if (cooldown == 0) desc += "The cape feels reassuringly heavy on your shoulders. You're not sure if it will directly " + - "help you in a fight, but it seems to be gaining energy from the physical damage you take."; + "help you in a fight, but it seems to be gaining energy from the damage you take."; else - desc += "The cape seems to be releasing some stored energy, it is radiating power at all angles. " + - "You feel very confident that the cape can protect you from nearby enemies right now."; + desc += "The cape seems to be releasing some stored energy, " + + "it is radiating a protective power at all angles. "; } return desc; @@ -65,7 +66,7 @@ public class CapeOfThorns extends Artifact { return true; } - public int proc(int damage, Char attacker){ + public int proc(int damage, Char attacker, Char defender){ if (cooldown == 0){ charge += damage*(0.5+level*0.05); if (charge >= chargeCap){ @@ -80,7 +81,9 @@ public class CapeOfThorns extends Artifact { int deflected = Random.NormalIntRange(0, damage); damage -= deflected; - attacker.damage(deflected, this); + if (attacker != null && Level.adjacent(attacker.pos, defender.pos)) { + attacker.damage(deflected, this); + } exp+= deflected;