From 56f34f9c760205575e7444f9f1936b150025a7c1 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 15 Nov 2022 15:25:46 -0500 Subject: [PATCH] v2.0.0: fixed ignoreSoftSolid rarely overriding stopTarget or stopChars --- .../mechanics/Ballistica.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/Ballistica.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/Ballistica.java index 6a85c37a1..51ebc1b97 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/Ballistica.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/Ballistica.java @@ -116,7 +116,8 @@ public class Ballistica { //if we're in solid terrain, and there's no char there, collide with the previous cell. // we don't use solid here because we don't want to stop short of closed doors. - if (stopTerrain + if (collisionPos == null + && stopTerrain && cell != sourcePos && !Dungeon.level.passable[cell] && !Dungeon.level.avoid[cell] @@ -126,15 +127,17 @@ public class Ballistica { path.add(cell); - if (stopTerrain && cell != sourcePos && Dungeon.level.solid[cell]) { + if (collisionPos == null && stopTerrain && cell != sourcePos && Dungeon.level.solid[cell]) { if (ignoreSoftSolid && (Dungeon.level.passable[cell] || Dungeon.level.avoid[cell])) { //do nothing } else { collide(cell); } - } else if (cell != sourcePos && stopChars && Actor.findChar( cell ) != null) { + } + if (collisionPos == null && cell != sourcePos && stopChars && Actor.findChar( cell ) != null) { collide(cell); - } else if (cell == to && stopTarget){ + } + if (collisionPos == null && cell == to && stopTarget){ collide(cell); } @@ -150,8 +153,9 @@ public class Ballistica { //we only want to record the first position collision occurs at. private void collide(int cell){ - if (collisionPos == null) + if (collisionPos == null) { collisionPos = cell; + } } //returns a segment of the path from start to end, inclusive.