Browse Source

mob ai work

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

33
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,14 +121,16 @@ 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);
PlayerCharacter target = (PlayerCharacter) awo; for (AbstractWorldObject awo : potentialTargets) {
if(mob.canSee(target)) PlayerCharacter target = (PlayerCharacter) awo;
mob.setCombatTarget(target); if (mob.canSee(target))
if(mob.combatTarget != null) { mob.setCombatTarget(target);
mob.stopMovement(mob.getMovementLoc()); if (mob.combatTarget != null) {
return; mob.stopMovement(mob.getMovementLoc());
return;
}
} }
} }
if(mob.isMoving() || !mob.BehaviourType.canRoam) if(mob.isMoving() || !mob.BehaviourType.canRoam)
@ -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