v1.4.0: DM-300 rockfall now knocks back hero if they are 1 tile away

This commit is contained in:
Evan Debenham
2022-10-03 14:10:08 -04:00
parent 8e9a7a0dd4
commit 8753a16493

View File

@@ -403,6 +403,7 @@ public class DM300 extends Mob {
Dungeon.hero.interrupt();
final int rockCenter;
//knock back 2 tiles if adjacent
if (Dungeon.level.adjacent(pos, target.pos)){
int oppositeAdjacent = target.pos + (target.pos - pos);
Ballistica trajectory = new Ballistica(target.pos, oppositeAdjacent, Ballistica.MAGIC_BOLT);
@@ -411,6 +412,18 @@ public class DM300 extends Mob {
Dungeon.hero.interrupt();
}
rockCenter = trajectory.path.get(Math.min(trajectory.dist, 2));
//knock back 1 tile if there's 1 tile of space
} else if (fieldOfView[target.pos] && Dungeon.level.distance(pos, target.pos) == 2) {
int oppositeAdjacent = target.pos + (target.pos - pos);
Ballistica trajectory = new Ballistica(target.pos, oppositeAdjacent, Ballistica.MAGIC_BOLT);
WandOfBlastWave.throwChar(target, trajectory, 1, false, false, getClass());
if (target == Dungeon.hero){
Dungeon.hero.interrupt();
}
rockCenter = trajectory.path.get(Math.min(trajectory.dist, 1));
//otherwise no knockback
} else {
rockCenter = target.pos;
}