From 57b3de2ae3a3f0757375f1c851667a21e026af04 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 3 Jun 2015 16:32:34 -0400 Subject: [PATCH] v0.3.0c: fixed a bug where saving and loading while the fists are alive would make Yog invincible --- .../actors/mobs/Yog.java | 48 +++++-------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java index 98b32799e..cf9e96349 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java @@ -69,9 +69,7 @@ public class Yog extends Mob { private static final String TXT_DESC = "Yog-Dzewa is an Old God, a powerful entity from the realms of chaos. A century ago, the ancient dwarves " + "barely won the war against its army of demons, but were unable to kill the god itself. Instead, they then " + - "imprisoned it in the halls below their city, believing it to be too weak to rise ever again."; - - private static int fistsCount = 0; + "imprisoned it in the halls below their city, believing it to be too weak to rise ever again."; public Yog() { super(); @@ -100,17 +98,17 @@ public class Yog extends Mob { @Override public void damage( int dmg, Object src ) { - - if (fistsCount > 0) { - - for (Mob mob : Dungeon.level.mobs) { - if (mob instanceof BurningFist || mob instanceof RottingFist) { - mob.beckon( pos ); - } - } - - dmg >>= fistsCount; - } + + HashSet fists = new HashSet<>(); + + for (Mob mob : Dungeon.level.mobs) + if (mob instanceof RottingFist || mob instanceof BurningFist) + fists.add( mob ); + + for (Mob fist : fists) + fist.beckon( pos ); + + dmg >>= fists.size(); super.damage( dmg, src ); } @@ -212,17 +210,6 @@ public class Yog extends Mob { state = WANDERING; } - public RottingFist() { - super(); - fistsCount++; - } - - @Override - public void die( Object cause ) { - super.die( cause ); - fistsCount--; - } - @Override public int attackSkill( Char target ) { return 36; @@ -306,17 +293,6 @@ public class Yog extends Mob { state = WANDERING; } - public BurningFist() { - super(); - fistsCount++; - } - - @Override - public void die( Object cause ) { - super.die( cause ); - fistsCount--; - } - @Override public int attackSkill( Char target ) { return 36;