Browse Source

mobs use hate value to hot swap targets

master
FatBoy-DOTC 2 years ago
parent
commit
d6a35a577b
  1. 6
      src/engine/ai/MobileFSM.java

6
src/engine/ai/MobileFSM.java

@ -715,9 +715,15 @@ public class MobileFSM { @@ -715,9 +715,15 @@ public class MobileFSM {
}
public static AbstractWorldObject ChangeTargetFromHateValue(Mob mob){
float CurrentHateValue = 0;
if(mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
CurrentHateValue = ((PlayerCharacter)mob.getCombatTarget()).getHateValue();
}
AbstractWorldObject mostHatedTarget = null;
for (Entry playerEntry : mob.playerAgroMap.entrySet()) {
PlayerCharacter potentialTarget = PlayerCharacter.getFromCache((int)playerEntry.getKey());
if(potentialTarget.equals(mob.getCombatTarget())){
continue;
}
if(potentialTarget != null && potentialTarget.getHateValue() > CurrentHateValue){
CurrentHateValue = potentialTarget.getHateValue();
mostHatedTarget = potentialTarget;

Loading…
Cancel
Save