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

Loading…
Cancel
Save