v1.4.1: fixed exploits during ascent where shopkeepers could still exist

This commit is contained in:
Evan Debenham
2022-10-07 14:17:50 -04:00
parent b105e10ca0
commit 6c99da7c68
3 changed files with 21 additions and 26 deletions
@@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.*; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.*;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper;
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet; import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
import com.shatteredpixel.shatteredpixeldungeon.messages.Languages; import com.shatteredpixel.shatteredpixeldungeon.messages.Languages;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; 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(){ public void saySwitch(){
@@ -23,10 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge; 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.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ImpSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ImpSprite;
@@ -52,19 +48,4 @@ public class ImpShopkeeper extends Shopkeeper {
return super.act(); 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();
}
} }
@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs; package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
@@ -55,10 +56,10 @@ public class Shopkeeper extends NPC {
Notes.add(Notes.Landmark.SHOP); 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(); flee();
return true; return true;
} }*/
sprite.turnTo( pos, Dungeon.hero.pos ); sprite.turnTo( pos, Dungeon.hero.pos );
spend( TICK ); spend( TICK );
@@ -80,8 +81,10 @@ public class Shopkeeper extends NPC {
Notes.remove(Notes.Landmark.SHOP); Notes.remove(Notes.Landmark.SHOP);
sprite.killAndErase(); if (sprite != null) {
CellEmitter.get( pos ).burst( ElmoParticle.FACTORY, 6 ); sprite.killAndErase();
CellEmitter.get(pos).burst(ElmoParticle.FACTORY, 6);
}
} }
@Override @Override
@@ -89,7 +92,9 @@ public class Shopkeeper extends NPC {
super.destroy(); super.destroy();
for (Heap heap: Dungeon.level.heaps.valueList()) { for (Heap heap: Dungeon.level.heaps.valueList()) {
if (heap.type == Heap.Type.FOR_SALE) { 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) { if (heap.size() == 1) {
heap.destroy(); heap.destroy();
} else { } else {