Browse Source

mob ai work

lakebane-mobai2
FatBoy-DOTC 1 week ago
parent
commit
033f7c9ccf
  1. 25
      src/engine/mobileAI/MobAi2.java

25
src/engine/mobileAI/MobAi2.java

@ -22,6 +22,19 @@ public class MobAi2 {
Attacking, Attacking,
Dead Dead
} }
public static boolean Agressive(Mob mob){
return mob.BehaviourType.name().contains("Aggro");
}
public static boolean Caster(Mob mob){
return mob.BehaviourType.name().contains("Power");
}
public static boolean HelpResponder(Mob mob){
return mob.BehaviourType.name().contains("Helpee");
}
public static State getState(Mob mob){ public static State getState(Mob mob){
if(!mob.isAlive()) if(!mob.isAlive())
@ -108,16 +121,18 @@ public class MobAi2 {
//handles patrolling and looking for potential combat targets //handles patrolling and looking for potential combat targets
public static void patrol(Mob mob){ public static void patrol(Mob mob){
HashSet<AbstractWorldObject> potentialTargets = WorldGrid.getObjectsInRangePartial(mob.loc, Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()), MBServerStatics.MASK_PLAYER); if(Agressive(mob) && mob.combatTarget == null) {
for(AbstractWorldObject awo : potentialTargets){ HashSet<AbstractWorldObject> potentialTargets = WorldGrid.getObjectsInRangePartial(mob.loc, 50, MBServerStatics.MASK_PLAYER);
for (AbstractWorldObject awo : potentialTargets) {
PlayerCharacter target = (PlayerCharacter) awo; PlayerCharacter target = (PlayerCharacter) awo;
if(mob.canSee(target)) if (mob.canSee(target))
mob.setCombatTarget(target); mob.setCombatTarget(target);
if(mob.combatTarget != null) { if (mob.combatTarget != null) {
mob.stopMovement(mob.getMovementLoc()); mob.stopMovement(mob.getMovementLoc());
return; return;
} }
} }
}
if(mob.isMoving() || !mob.BehaviourType.canRoam) if(mob.isMoving() || !mob.BehaviourType.canRoam)
return; return;
@ -337,7 +352,7 @@ public class MobAi2 {
Zone mobCamp = mob.getParentZone(); Zone mobCamp = mob.getParentZone();
for (Mob helper : mobCamp.zoneMobSet) { for (Mob helper : mobCamp.zoneMobSet) {
if (helper.BehaviourType.respondsToCallForHelp && helper.BehaviourType.BehaviourHelperType.equals(mob.BehaviourType)) { if (HelpResponder(helper)) {
helper.setCombatTarget(mob.getCombatTarget()); helper.setCombatTarget(mob.getCombatTarget());
break; break;
} }

Loading…
Cancel
Save