v0.9.0b: fixed Tengu abilities not working from load

This commit is contained in:
Evan Debenham 2020-10-10 14:43:31 -04:00
parent dfaed721c5
commit 6d038edb2b

View File

@ -119,10 +119,12 @@ public class NewTengu extends Mob {
return Random.NormalIntRange(0, 5);
}
boolean loading = false;
//Tengu is immune to debuffs and damage when removed from the level
@Override
public void add(Buff buff) {
if (Actor.chars().contains(this) || buff instanceof Doom){
if (Actor.chars().contains(this) || buff instanceof Doom || loading){
super.add(buff);
}
}
@ -352,7 +354,9 @@ public class NewTengu extends Mob {
@Override
public void restoreFromBundle(Bundle bundle) {
loading = true;
super.restoreFromBundle(bundle);
loading = false;
lastAbility = bundle.getInt( LAST_ABILITY );
abilitiesUsed = bundle.getInt( ABILITIES_USED );
arenaJumps = bundle.getInt( ARENA_JUMPS );
@ -1015,6 +1019,8 @@ public class NewTengu extends Mob {
@Override
protected void evolve() {
boolean shocked = false;
int cell;
for (int i = area.left; i < area.right; i++){
for (int j = area.top; j < area.bottom; j++){
@ -1027,6 +1033,8 @@ public class NewTengu extends Mob {
if (cur[cell] > 0 && off[cell] == 0){
shocked = true;
Char ch = Actor.findChar(cell);
if (ch != null && !(ch instanceof NewTengu)){
ch.damage(2 + Dungeon.depth, new Electricity());
@ -1040,6 +1048,8 @@ public class NewTengu extends Mob {
}
}
if (shocked) Sample.INSTANCE.play( Assets.Sounds.LIGHTNING );
}
@Override