v3.2.5: properly fixed bee AI re-aggression debuff

This commit is contained in:
Evan Debenham
2025-09-29 10:51:28 -04:00
parent b203e75621
commit 4e1da695a2

View File

@@ -152,7 +152,24 @@ public class Bee extends Mob {
return (Char) Actor.findById(potHolder); return (Char) Actor.findById(potHolder);
//if the pot is on the ground //if the pot is on the ground
}else { } else {
//copypasta from regular mob logic for aggression with added limit for pot distance
if ((alignment == Alignment.ENEMY || buff(Amok.class) != null ) && state != PASSIVE && state != SLEEPING) {
if (enemy != null
&& enemy.buff(StoneOfAggression.Aggression.class) != null
&& Dungeon.level.distance(enemy.pos, potPos) <= 3){
state = HUNTING;
return enemy;
}
for (Char ch : Actor.chars()) {
if (ch != this && fieldOfView[ch.pos] && Dungeon.level.distance(ch.pos, potPos) <= 3
&& ch.buff(StoneOfAggression.Aggression.class) != null) {
state = HUNTING;
return ch;
}
}
}
//try to find a new enemy in these circumstances //try to find a new enemy in these circumstances
if (enemy == null || !enemy.isAlive() || !Actor.chars().contains(enemy) || state == WANDERING if (enemy == null || !enemy.isAlive() || !Actor.chars().contains(enemy) || state == WANDERING
@@ -168,9 +185,7 @@ public class Bee extends Mob {
&& mob.alignment != Alignment.NEUTRAL && mob.alignment != Alignment.NEUTRAL
&& !mob.isInvulnerable(getClass()) && !mob.isInvulnerable(getClass())
&& !(alignment == Alignment.ALLY && mob.alignment == Alignment.ALLY)) { && !(alignment == Alignment.ALLY && mob.alignment == Alignment.ALLY)) {
//prefers char affected by aggression if (closest == null || Dungeon.level.distance(closest.pos, pos) > Dungeon.level.distance(mob.pos, pos)){
if (closest == null || mob.buff(StoneOfAggression.Aggression.class) != null
|| Dungeon.level.distance(closest.pos, pos) > Dungeon.level.distance(mob.pos, pos)){
closest = mob; closest = mob;
} }
} }