From f6b00b2839e7169da3f55cfdb9a2f91e2d11ef05 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 28 Aug 2024 11:20:52 -0400 Subject: [PATCH] v2.5.0: fixed specific cases where hero would refuse to move onto traps --- .../actors/hero/Hero.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index ccef70b69..cf4df27a5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -1677,7 +1677,8 @@ public class Hero extends Char { } if (walkingToVisibleTrapInFog && Dungeon.level.traps.get(target) != null - && Dungeon.level.traps.get(target).visible){ + && Dungeon.level.traps.get(target).visible + && Dungeon.level.traps.get(target).active){ return false; } } @@ -1777,6 +1778,15 @@ public class Hero extends Char { fieldOfView = new boolean[Dungeon.level.length()]; Dungeon.level.updateFieldOfView( this, fieldOfView ); } + + if (!Dungeon.level.visited[cell] && !Dungeon.level.mapped[cell] + && Dungeon.level.traps.get(cell) != null + && Dungeon.level.traps.get(cell).visible + && Dungeon.level.traps.get(cell).active) { + walkingToVisibleTrapInFog = true; + } else { + walkingToVisibleTrapInFog = false; + } Char ch = Actor.findChar( cell ); Heap heap = Dungeon.level.heaps.get( cell ); @@ -1837,13 +1847,6 @@ public class Hero extends Char { } else { - if (!Dungeon.level.visited[cell] && !Dungeon.level.mapped[cell] - && Dungeon.level.traps.get(cell) != null && Dungeon.level.traps.get(cell).visible) { - walkingToVisibleTrapInFog = true; - } else { - walkingToVisibleTrapInFog = false; - } - curAction = new HeroAction.Move( cell ); lastAction = null;