}
return false;
}
});
NPC bestMonster = null;
Monster bestMonsterValue = null;
for (NPC npc : realNpcs) {
if (npc.validate()) {
final Monster tempMonster = Monster.getMonster(npc.getId());
if (bestMonster == null || (nodeBlocking ? tempMonster.ordinal() < bestMonsterValue.ordinal() :
tempMonster.ordinal() > bestMonsterValue.ordinal()) ||
(tempMonster.ordinal() == bestMonsterValue.ordinal() &&
distanceTo(npc.getLocation()) < distanceTo(bestMonster.getLocation()))) {
bestMonster = npc;
bestMonsterValue = tempMonster;
}
}
}