v0.3.0c: fixed a bug where saving and loading while the fists are alive would make Yog invincible

This commit is contained in:
Evan Debenham 2015-06-03 16:32:34 -04:00 committed by Evan Debenham
parent b52438fe11
commit 57b3de2ae3

View File

@ -69,9 +69,7 @@ public class Yog extends Mob {
private static final String TXT_DESC = 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 " + "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 " + "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."; "imprisoned it in the halls below their city, believing it to be too weak to rise ever again.";
private static int fistsCount = 0;
public Yog() { public Yog() {
super(); super();
@ -100,17 +98,17 @@ public class Yog extends Mob {
@Override @Override
public void damage( int dmg, Object src ) { public void damage( int dmg, Object src ) {
if (fistsCount > 0) { HashSet<Mob> fists = new HashSet<>();
for (Mob mob : Dungeon.level.mobs) { for (Mob mob : Dungeon.level.mobs)
if (mob instanceof BurningFist || mob instanceof RottingFist) { if (mob instanceof RottingFist || mob instanceof BurningFist)
mob.beckon( pos ); fists.add( mob );
}
} for (Mob fist : fists)
fist.beckon( pos );
dmg >>= fistsCount;
} dmg >>= fists.size();
super.damage( dmg, src ); super.damage( dmg, src );
} }
@ -212,17 +210,6 @@ public class Yog extends Mob {
state = WANDERING; state = WANDERING;
} }
public RottingFist() {
super();
fistsCount++;
}
@Override
public void die( Object cause ) {
super.die( cause );
fistsCount--;
}
@Override @Override
public int attackSkill( Char target ) { public int attackSkill( Char target ) {
return 36; return 36;
@ -306,17 +293,6 @@ public class Yog extends Mob {
state = WANDERING; state = WANDERING;
} }
public BurningFist() {
super();
fistsCount++;
}
@Override
public void die( Object cause ) {
super.die( cause );
fistsCount--;
}
@Override @Override
public int attackSkill( Char target ) { public int attackSkill( Char target ) {
return 36; return 36;