Aggressive NPCs will no longer always attack the last player to enter the area
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user