diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AscensionChallenge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AscensionChallenge.java index 7ae16a488..d63da02d8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AscensionChallenge.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AscensionChallenge.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.*; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper; import com.shatteredpixel.shatteredpixeldungeon.items.Amulet; import com.shatteredpixel.shatteredpixeldungeon.messages.Languages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -206,6 +207,14 @@ public class AscensionChallenge extends Buff { } } + if (Statistics.highestAscent < 20){ + for (Mob m : Dungeon.level.mobs.toArray(new Mob[0])){ + if (m instanceof Shopkeeper){ + ((Shopkeeper) m).flee(); + } + } + } + } public void saySwitch(){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java index 636261a24..39073e463 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java @@ -23,10 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge; -import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; -import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; -import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle; -import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ImpSprite; @@ -49,22 +45,7 @@ public class ImpShopkeeper extends Shopkeeper { } seenBefore = true; } - + return super.act(); } - - @Override - public void flee() { - for (Heap heap: Dungeon.level.heaps.valueList()) { - if (heap.type == Heap.Type.FOR_SALE) { - CellEmitter.get( heap.pos ).burst( ElmoParticle.FACTORY, 4 ); - heap.destroy(); - } - } - - destroy(); - - sprite.emitter().burst( Speck.factory( Speck.WOOL ), 15 ); - sprite.killAndErase(); - } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java index feeaaf96a..4277720ab 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge; @@ -55,10 +56,10 @@ public class Shopkeeper extends NPC { Notes.add(Notes.Landmark.SHOP); } - if (Statistics.highestAscent < 20 && Dungeon.hero.buff(AscensionChallenge.class) != null){ + /*if (Statistics.highestAscent < 20 && Dungeon.hero.buff(AscensionChallenge.class) != null){ flee(); return true; - } + }*/ sprite.turnTo( pos, Dungeon.hero.pos ); spend( TICK ); @@ -79,9 +80,11 @@ public class Shopkeeper extends NPC { destroy(); Notes.remove(Notes.Landmark.SHOP); - - sprite.killAndErase(); - CellEmitter.get( pos ).burst( ElmoParticle.FACTORY, 6 ); + + if (sprite != null) { + sprite.killAndErase(); + CellEmitter.get(pos).burst(ElmoParticle.FACTORY, 6); + } } @Override @@ -89,7 +92,9 @@ public class Shopkeeper extends NPC { super.destroy(); for (Heap heap: Dungeon.level.heaps.valueList()) { if (heap.type == Heap.Type.FOR_SALE) { - CellEmitter.get( heap.pos ).burst( ElmoParticle.FACTORY, 4 ); + if (ShatteredPixelDungeon.scene() instanceof GameScene) { + CellEmitter.get(heap.pos).burst(ElmoParticle.FACTORY, 4); + } if (heap.size() == 1) { heap.destroy(); } else {