v0.9.1a: fixed errors with AI target swapping

This commit is contained in:
Evan Debenham 2020-12-15 18:47:04 -05:00
parent 4908d2c457
commit 248648e2bb

View File

@ -930,9 +930,10 @@ public abstract class Mob extends Char {
//if moving towards an enemy isn't possible, try to switch targets to another enemy that is closer //if moving towards an enemy isn't possible, try to switch targets to another enemy that is closer
//unless we have already done that and still can't move toward them, then move on. //unless we have already done that and still can't move toward them, then move on.
if (!recursing) { if (!recursing) {
Char newEnemy = chooseEnemy(); Char oldEnemy = enemy;
if (newEnemy != null && enemy != newEnemy) { enemy = null;
enemy = newEnemy; enemy = chooseEnemy();
if (enemy != null && enemy != oldEnemy) {
recursing = true; recursing = true;
boolean result = act(enemyInFOV, justAlerted); boolean result = act(enemyInFOV, justAlerted);
recursing = false; recursing = false;