From 75da7a40e1ce38370e76485be668fb402ab73f8d Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 5 Sep 2024 11:29:02 -0400 Subject: [PATCH] v2.5.0: added a safety check to bee AI --- .../shatteredpixeldungeon/actors/mobs/Bee.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java index de764fb98..a63199cf6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java @@ -187,12 +187,17 @@ public class Bee extends Mob { @Override protected boolean getCloser(int target) { - if (alignment == Alignment.ALLY && enemy == null && buffs(AllyBuff.class).isEmpty()){ + if (alignment == Alignment.ALLY && enemy == null && buffs(AllyBuff.class).isEmpty()) { target = Dungeon.hero.pos; } else if (enemy != null && Actor.findById(potHolder) == enemy) { target = enemy.pos; - } else if (potPos != -1 && (state == WANDERING || Dungeon.level.distance(target, potPos) > 3)) - this.target = target = potPos; + } else if (potPos != -1 && (state == WANDERING || Dungeon.level.distance(target, potPos) > 3)) { + if (!Dungeon.level.insideMap(potPos)){ + potPos = -1; + } else { + this.target = target = potPos; + } + } return super.getCloser( target ); }