v0.9.2: added some safety checks to combo

This commit is contained in:
Evan Debenham 2021-02-19 17:40:19 -05:00
parent 85b2ce7373
commit 4cc28b269a

View File

@ -232,7 +232,7 @@ public class Combo extends Buff implements ActionIndicator.Action {
@Override @Override
public void detach() { public void detach() {
if (!parried) target.buff(Combo.class).detach(); if (!parried && target.buff(Combo.class) != null) target.buff(Combo.class).detach();
super.detach(); super.detach();
} }
} }
@ -244,6 +244,7 @@ public class Combo extends Buff implements ActionIndicator.Action {
@Override @Override
public boolean act() { public boolean act() {
if (target.buff(Combo.class) != null) {
moveBeingUsed = ComboMove.PARRY; moveBeingUsed = ComboMove.PARRY;
target.sprite.attack(enemy.pos, new Callback() { target.sprite.attack(enemy.pos, new Callback() {
@Override @Override
@ -251,6 +252,7 @@ public class Combo extends Buff implements ActionIndicator.Action {
target.buff(Combo.class).doAttack(enemy); target.buff(Combo.class).doAttack(enemy);
} }
}); });
}
detach(); detach();
return true; return true;
} }
@ -318,7 +320,8 @@ public class Combo extends Buff implements ActionIndicator.Action {
dist ++; dist ++;
Buff.prolong(enemy, Vertigo.class, 3); Buff.prolong(enemy, Vertigo.class, 3);
} else { } else {
while (dist > 0 && Dungeon.level.pit[trajectory.path.get(dist)]) { while (dist > trajectory.dist ||
(dist > 0 && Dungeon.level.pit[trajectory.path.get(dist)])) {
dist--; dist--;
} }
} }