v0.9.3a: fixed ally rats forgetting ally state on game load
This commit is contained in:
parent
ef256e53eb
commit
fc6b08e2f1
|
@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.RatSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.RatSprite;
|
||||||
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class Rat extends Mob {
|
public class Rat extends Mob {
|
||||||
|
@ -61,4 +62,18 @@ public class Rat extends Mob {
|
||||||
public int drRoll() {
|
public int drRoll() {
|
||||||
return Random.NormalIntRange(0, 1);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user