v0.3.0c: wand of blast wave now takes advantage of pushing callbacks

This commit is contained in:
Evan Debenham 2015-06-03 19:30:32 -04:00
parent 39c736189d
commit 7e79a10501

View File

@ -83,7 +83,7 @@ public class WandOfBlastWave extends Wand {
} }
} }
private void throwChar(Char ch, Ballistica trajectory, int power){ private void throwChar(final Char ch, final Ballistica trajectory, int power){
int dist = Math.min(trajectory.dist, power); int dist = Math.min(trajectory.dist, power);
//FIXME: sloppy //FIXME: sloppy
@ -92,24 +92,26 @@ public class WandOfBlastWave extends Wand {
if (dist == 0 || ch instanceof Yog) return; if (dist == 0 || ch instanceof Yog) return;
int newPos = trajectory.path.get(dist); if (Actor.findChar(trajectory.path.get(dist)) != null){
dist--;
if (Actor.findChar(newPos) != null){
newPos = trajectory.path.get(--dist);
} }
final int newPos = trajectory.path.get(dist);
if (newPos == ch.pos) return; if (newPos == ch.pos) return;
final int finalDist = dist;
Actor.addDelayed(new Pushing(ch, ch.pos, newPos), -1); Actor.addDelayed(new Pushing(ch, ch.pos, newPos, new Callback() {
ch.pos = newPos; public void call() {
Dungeon.level.press(newPos, ch); ch.pos = newPos;
if (ch.pos == trajectory.collisionPos) {
if (ch.pos == trajectory.collisionPos) { ch.damage(Random.NormalIntRange((finalDist + 1) / 2, finalDist), this);
ch.damage(Random.NormalIntRange((dist + 1) / 2, dist), this); Paralysis.prolong(ch, Paralysis.class, Random.NormalIntRange((finalDist + 1) / 2, finalDist));
Paralysis.prolong(ch, Paralysis.class, Random.NormalIntRange((dist + 1) / 2, dist)); Dungeon.level.press(ch.pos, ch);
} }
}
}), -1);
} }
@Override @Override