Public Repository for the Magicbane Emulator Project Called BattleBane
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.7 KiB

package engine.mobileAI.MobBehaviours;
import engine.Enum;
import engine.objects.AbstractWorldObject;
import engine.objects.Mob;
import org.pmw.tinylog.Logger;
public class Standard {
public static void run(Mob mob){
try {
if(StaticBehaviours.EarlyExit(mob))
return;
//check for players that can be aggroed if mob is agressive and has no target
if (mob.getCombatTarget() != null && !mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()))
mob.setCombatTarget(null);
if (mob.BehaviourType.isAgressive) {
AbstractWorldObject newTarget = StaticBehaviours.ChangeTargetFromHateValue(mob);
if (newTarget != null)
mob.setCombatTarget(newTarget);
else {
if (mob.getCombatTarget() == null) {
if (mob.BehaviourType == Enum.MobBehaviourType.HamletGuard)
StaticBehaviours.SafeGuardAggro(mob); //safehold guard
else
StaticBehaviours.CheckForAggro(mob); //normal aggro
}
}
}
//check if mob can move for patrol or moving to target
if (mob.BehaviourType.canRoam)
StaticBehaviours.CheckMobMovement(mob);
//check if mob can attack if it isn't wimpy
if (!mob.BehaviourType.isWimpy && mob.getCombatTarget() != null)
StaticBehaviours.CheckForAttack(mob);
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DefaultLogic" + " " + e.getMessage());
}
}
}