v0.7.2b: fixed a crash bug in wndRankings and improved how berserk interacts with other shield buffs

This commit is contained in:
Evan Debenham 2019-04-15 18:11:23 -04:00
parent 27bbd5cdf3
commit 20db0b86ae
2 changed files with 11 additions and 4 deletions

View File

@ -76,9 +76,15 @@ public class Berserk extends Buff {
@Override
public boolean act() {
if (berserking()){
WarriorShield buff = target.buff(WarriorShield.class);
ShieldBuff buff = target.buff(WarriorShield.class);
if (target.HP <= 0) {
buff.absorbDamage(1 + (int)Math.ceil(target.shielding() * 0.1f));
if (buff != null && buff.shielding() > 0) {
buff.absorbDamage(1 + (int)Math.ceil(target.shielding() * 0.1f));
} else {
//if there is no shield buff, or it is empty, then try to remove from other shielding buffs
buff = target.buff(ShieldBuff.class);
if (buff != null) buff.absorbDamage(1 + (int)Math.ceil(target.shielding() * 0.1f));
}
if (target.shielding() <= 0) {
target.die(this);
if (!target.isAlive()) Dungeon.fail(this.getClass());
@ -87,7 +93,7 @@ public class Berserk extends Buff {
state = State.RECOVERING;
levelRecovery = LEVEL_RECOVER_START;
BuffIndicator.refreshHero();
buff.absorbDamage(buff.shielding());
if (buff != null) buff.absorbDamage(buff.shielding());
power = 0f;
}
} else if (state == State.NORMAL) {

View File

@ -78,7 +78,6 @@ public class WndRanking extends WndTabbed {
}
}
};
thread.start();
busy = Icons.BUSY.get();
busy.origin.set( busy.width / 2, busy.height / 2 );
@ -86,6 +85,8 @@ public class WndRanking extends WndTabbed {
busy.x = (WIDTH - busy.width) / 2;
busy.y = (HEIGHT - busy.height) / 2;
add( busy );
thread.start();
}
@Override