v0.9.3a: fixed ally rats forgetting ally state on game load

This commit is contained in:
Evan Debenham 2021-06-13 14:25:48 -04:00
parent ef256e53eb
commit fc6b08e2f1

View File

@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify;
import com.shatteredpixel.shatteredpixeldungeon.sprites.RatSprite;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class Rat extends Mob {
@ -61,4 +62,18 @@ public class Rat extends Mob {
public int drRoll() {
return Random.NormalIntRange(0, 1);
}
private static final String RAT_ALLY = "rat_ally";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
if (alignment == Alignment.ALLY) bundle.put(RAT_ALLY, true);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
if (bundle.contains(RAT_ALLY)) alignment = Alignment.ALLY;
}
}