v3.0.0: added a null safety checks to new recently attack AI logic

This commit is contained in:
Evan Debenham
2024-12-02 12:11:32 -05:00
parent 52d59cca42
commit f0629ef15b

View File

@@ -1205,7 +1205,7 @@ public abstract class Mob extends Char {
if (!recentlyAttackedBy.isEmpty()){
boolean swapped = false;
for (Char ch : recentlyAttackedBy){
if (fieldOfView[ch.pos] && ch.invisible == 0 && !isCharmedBy(ch)) {
if (ch != null && fieldOfView[ch.pos] && ch.invisible == 0 && !isCharmedBy(ch)) {
if (canAttack(ch) || Dungeon.level.distance(pos, ch.pos) < Dungeon.level.distance(pos, enemy.pos)) {
enemy = ch;
target = ch.pos;