diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/CrystalSpire.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/CrystalSpire.java index e34eeda9f..ceb0721a7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/CrystalSpire.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/CrystalSpire.java @@ -353,6 +353,7 @@ public class CrystalSpire extends Mob { } } + Bestiary.skipCountingEncounters = true; for (Char ch : Actor.chars()){ if (fieldOfView[ch.pos]) { if (ch instanceof CrystalGuardian) { @@ -363,6 +364,7 @@ public class CrystalSpire extends Mob { } } } + Bestiary.skipCountingEncounters = false; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DwarfKing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DwarfKing.java index 1e7ca5af7..66ffd3f6c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DwarfKing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DwarfKing.java @@ -52,6 +52,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfForce; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLightning; +import com.shatteredpixel.shatteredpixeldungeon.journal.Bestiary; import com.shatteredpixel.shatteredpixeldungeon.levels.CityBossLevel; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -497,13 +498,11 @@ public class DwarfKing extends Mob { for (Summoning s : buffs(Summoning.class)) { s.detach(); } - for (Mob m : Dungeon.level.mobs.toArray(new Mob[0])) { - if (m.alignment == alignment) { - if (m instanceof Ghoul || m instanceof Monk || m instanceof Warlock || m instanceof Golem) { - m.die(null); - } - } + Bestiary.skipCountingEncounters = true; + for (Mob m : getSubjects()) { + m.die(null); } + Bestiary.skipCountingEncounters = false; for (Buff b: buffs()){ if (b instanceof LifeLink){ b.detach(); @@ -568,9 +567,11 @@ public class DwarfKing extends Mob { Dungeon.level.unseal(); + Bestiary.skipCountingEncounters = true; for (Mob m : getSubjects()){ m.die(null); } + Bestiary.skipCountingEncounters = false; LloydsBeacon beacon = Dungeon.hero.belongings.getItem(LloydsBeacon.class); if (beacon != null) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java index 787993ec1..8be998c50 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; +import com.shatteredpixel.shatteredpixeldungeon.journal.Bestiary; import com.shatteredpixel.shatteredpixeldungeon.plants.Rotberry; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.RotHeartSprite; @@ -95,11 +96,13 @@ public class RotHeart extends Mob { @Override public void destroy() { super.destroy(); + Bestiary.skipCountingEncounters = true; for (Mob mob : Dungeon.level.mobs.toArray(new Mob[Dungeon.level.mobs.size()])){ if (mob instanceof RotLasher){ mob.die(null); } } + Bestiary.skipCountingEncounters = false; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java index 2847fd4ee..96d26a9f3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/YogDzewa.java @@ -39,6 +39,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.TargetedCell; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PurpleParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; +import com.shatteredpixel.shatteredpixeldungeon.journal.Bestiary; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -514,11 +515,13 @@ public class YogDzewa extends Mob { @Override public void die( Object cause ) { + Bestiary.skipCountingEncounters = true; for (Mob mob : (Iterable)Dungeon.level.mobs.clone()) { if (mob instanceof Larva || mob instanceof YogRipper || mob instanceof YogEye || mob instanceof YogScorpio) { mob.die( cause ); } } + Bestiary.skipCountingEncounters = false; updateVisibility(Dungeon.level); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Bestiary.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Bestiary.java index ae0ba02a4..9436854aa 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Bestiary.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Bestiary.java @@ -304,11 +304,17 @@ public enum Bestiary { return 0; } + //used primarily when bosses are killed and need to clean up their minions + public static boolean skipCountingEncounters = false; + public static void countEncounter(Class cls){ countEncounters(cls, 1); } public static void countEncounters(Class cls, int encounters){ + if (skipCountingEncounters){ + return; + } if (classConversions.containsKey(cls)){ cls = classConversions.get(cls); }