v0.7.2b: fixed a crash bug in wndRankings and improved how berserk interacts with other shield buffs
This commit is contained in:
parent
27bbd5cdf3
commit
20db0b86ae
|
@ -76,9 +76,15 @@ public class Berserk extends Buff {
|
||||||
@Override
|
@Override
|
||||||
public boolean act() {
|
public boolean act() {
|
||||||
if (berserking()){
|
if (berserking()){
|
||||||
WarriorShield buff = target.buff(WarriorShield.class);
|
ShieldBuff buff = target.buff(WarriorShield.class);
|
||||||
if (target.HP <= 0) {
|
if (target.HP <= 0) {
|
||||||
|
if (buff != null && buff.shielding() > 0) {
|
||||||
buff.absorbDamage(1 + (int)Math.ceil(target.shielding() * 0.1f));
|
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) {
|
if (target.shielding() <= 0) {
|
||||||
target.die(this);
|
target.die(this);
|
||||||
if (!target.isAlive()) Dungeon.fail(this.getClass());
|
if (!target.isAlive()) Dungeon.fail(this.getClass());
|
||||||
|
@ -87,7 +93,7 @@ public class Berserk extends Buff {
|
||||||
state = State.RECOVERING;
|
state = State.RECOVERING;
|
||||||
levelRecovery = LEVEL_RECOVER_START;
|
levelRecovery = LEVEL_RECOVER_START;
|
||||||
BuffIndicator.refreshHero();
|
BuffIndicator.refreshHero();
|
||||||
buff.absorbDamage(buff.shielding());
|
if (buff != null) buff.absorbDamage(buff.shielding());
|
||||||
power = 0f;
|
power = 0f;
|
||||||
}
|
}
|
||||||
} else if (state == State.NORMAL) {
|
} else if (state == State.NORMAL) {
|
||||||
|
|
|
@ -78,7 +78,6 @@ public class WndRanking extends WndTabbed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
thread.start();
|
|
||||||
|
|
||||||
busy = Icons.BUSY.get();
|
busy = Icons.BUSY.get();
|
||||||
busy.origin.set( busy.width / 2, busy.height / 2 );
|
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.x = (WIDTH - busy.width) / 2;
|
||||||
busy.y = (HEIGHT - busy.height) / 2;
|
busy.y = (HEIGHT - busy.height) / 2;
|
||||||
add( busy );
|
add( busy );
|
||||||
|
|
||||||
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user