Aggressive NPCs will no longer always attack the last player to enter the area

This commit is contained in:
troido
2025-02-01 14:04:03 +00:00
committed by Ryan
parent c3929cf06c
commit 0a26d5039a
@@ -132,9 +132,9 @@ public class AggressiveBehavior {
*/
public Entity getLogicalTarget(Entity entity, List<Entity> possibleTargets) {
Entity target = null;
int comparingFlag = Integer.MAX_VALUE;
double comparingFlag = Double.MAX_VALUE;
for (Entity e : possibleTargets) {
int flag = getPriorityFlag(e);
double flag = (double)getPriorityFlag(e) + Math.random();
if (flag <= comparingFlag) {
comparingFlag = flag;
target = e;