From f033a2b87224f31bbef5629ff81064fae7cead98 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 27 Aug 2014 01:43:13 -0400 Subject: [PATCH] V0.2.0: fixed a save/load issue with Cloak of Shadows --- .../shatteredpixeldungeon/actors/Char.java | 6 +++--- .../items/artifacts/CloakOfShadows.java | 19 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 4f64e7fec..31e9ee244 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -378,7 +378,7 @@ public abstract class Char extends Actor { sprite.add( CharSprite.State.LEVITATING ); } else if (buff instanceof Frost) { sprite.add( CharSprite.State.FROZEN ); - } else if (buff instanceof Invisibility) { + } else if (buff instanceof Invisibility || buff instanceof CloakOfShadows.cloakStealth) { if (!(buff instanceof Shadows)) { sprite.showStatus( CharSprite.POSITIVE, "invisible" ); } @@ -396,7 +396,7 @@ public abstract class Char extends Actor { sprite.remove( CharSprite.State.BURNING ); } else if (buff instanceof Levitation) { sprite.remove( CharSprite.State.LEVITATING ); - } else if (buff instanceof Invisibility || buff instanceof CloakOfShadows.cloakStealth && invisible <= 0) { + } else if ((buff instanceof Invisibility || buff instanceof CloakOfShadows.cloakStealth) && invisible <= 0) { sprite.remove( CharSprite.State.INVISIBLE ); } else if (buff instanceof Paralysis) { sprite.remove( CharSprite.State.PARALYSED ); @@ -424,7 +424,7 @@ public abstract class Char extends Actor { sprite.add( CharSprite.State.BURNING ); } else if (buff instanceof Levitation) { sprite.add( CharSprite.State.LEVITATING ); - } else if (buff instanceof Invisibility) { + } else if (buff instanceof Invisibility || buff instanceof CloakOfShadows.cloakStealth) { sprite.add( CharSprite.State.INVISIBLE ); } else if (buff instanceof Paralysis) { sprite.add( CharSprite.State.PARALYSED ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java index 43d95c7c8..f14e51187 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java @@ -96,6 +96,15 @@ public class CloakOfShadows extends Artifact { + } + + @Override + public void activate(Char ch){ + super.activate(ch); + if (stealthed){ + activeBuff = activeBuff(); + activeBuff.attachTo(ch); + } } @Override @@ -221,15 +230,5 @@ public class CloakOfShadows extends Artifact { public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); stealthed = bundle.getBoolean("stealthed"); - if (stealthed) { - Hero hero = Dungeon.hero; - activeBuff = activeBuff(); - activeBuff.attachTo(hero); - if (hero.sprite.parent != null) { - hero.sprite.parent.add(new AlphaTweener(hero.sprite, 0.4f, 0.4f)); - } else { - hero.sprite.alpha(0.4f); - } - } } }