v2.5.1: fixed shopkeepers sometimes not clearing gasses when harmed

This commit is contained in:
Evan Debenham
2024-09-12 13:50:22 -04:00
parent ece3e68f4b
commit d8c92096e3
@@ -24,6 +24,7 @@ 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.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
@@ -110,6 +111,14 @@ public class Shopkeeper extends NPC {
turnsSinceHarmed = 0; turnsSinceHarmed = 0;
yell(Messages.get(this, "warn")); yell(Messages.get(this, "warn"));
//use a new actor as we can't clear the gas while we're in the middle of processing it
Actor.add(new Actor() {
{
actPriority = VFX_PRIO;
}
@Override
protected boolean act() {
//cleanses all harmful blobs in the shop //cleanses all harmful blobs in the shop
ArrayList<Blob> blobs = new ArrayList<>(); ArrayList<Blob> blobs = new ArrayList<>();
for (Class c : new BlobImmunity().immunities()){ for (Class c : new BlobImmunity().immunities()){
@@ -138,6 +147,10 @@ public class Shopkeeper extends NPC {
} }
} }
Actor.remove(this);
return true;
}
});
//There is a 1 turn buffer before more damage/debuffs make the shopkeeper flee //There is a 1 turn buffer before more damage/debuffs make the shopkeeper flee
//This is mainly to prevent stacked effects from causing an instant flee //This is mainly to prevent stacked effects from causing an instant flee