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

View File

@@ -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(){

View File

@@ -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();
}
}

View File

@@ -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 {