From 7212451d57f8da9bc0855c9b31b29f3d3e1e8383 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 11 Dec 2014 23:24:21 -0500 Subject: [PATCH] v0.2.3: sad ghost now disappears as you move between floors --- .../shatteredpixeldungeon/actors/hero/Hero.java | 13 +++++++++---- .../shatteredpixeldungeon/items/LloydsBeacon.java | 8 ++++++-- .../levels/features/Chasm.java | 7 +++++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 5325f3c7f..9e404c748 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -63,6 +63,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CapeOfThorns; +import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey; @@ -753,8 +754,10 @@ public class Hero extends Char { } Buff buff = buff(TimekeepersHourglass.timeFreeze.class); - if (buff != null) - buff.detach(); + if (buff != null) buff.detach(); + + for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) + if (mob instanceof DriedRose.GhostHero) mob.destroy(); InterlevelScene.mode = InterlevelScene.Mode.DESCEND; Game.switchScene( InterlevelScene.class ); @@ -796,8 +799,10 @@ public class Hero extends Char { } Buff buff = buff(TimekeepersHourglass.timeFreeze.class); - if (buff != null) - buff.detach(); + if (buff != null) buff.detach(); + + for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) + if (mob instanceof DriedRose.GhostHero) mob.destroy(); InterlevelScene.mode = InterlevelScene.Mode.ASCEND; Game.switchScene( InterlevelScene.class ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/LloydsBeacon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/LloydsBeacon.java index ccdc59c2c..6ff5f668e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/LloydsBeacon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/LloydsBeacon.java @@ -22,6 +22,8 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlink; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; @@ -139,8 +141,10 @@ public class LloydsBeacon extends Item { } else { Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); - if (buff != null) - buff.detach(); + if (buff != null) buff.detach(); + + for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) + if (mob instanceof DriedRose.GhostHero) mob.destroy(); InterlevelScene.mode = InterlevelScene.Mode.RETURN; InterlevelScene.returnDepth = returnDepth; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java index 8ecc4da4b..47d1b27bd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java @@ -17,6 +17,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.levels.features; +import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.watabou.noosa.Camera; import com.watabou.noosa.Game; @@ -70,8 +71,10 @@ public class Chasm { Sample.INSTANCE.play( Assets.SND_FALLING ); Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); - if (buff != null) - buff.detach(); + if (buff != null) buff.detach(); + + for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) + if (mob instanceof DriedRose.GhostHero) mob.destroy(); if (Dungeon.hero.isAlive()) { Dungeon.hero.interrupt();