forked from MagicBane/Server
consolidated all guards to GuardLogic
This commit is contained in:
@@ -616,10 +616,8 @@ public class MobAI {
|
|||||||
switch (mob.behaviourType) {
|
switch (mob.behaviourType) {
|
||||||
case GuardCaptain:
|
case GuardCaptain:
|
||||||
case GuardMinion:
|
case GuardMinion:
|
||||||
GuardLogic(mob);
|
|
||||||
break;
|
|
||||||
case GuardWallArcher:
|
case GuardWallArcher:
|
||||||
GuardWallArcherLogic(mob);
|
GuardLogic(mob);
|
||||||
break;
|
break;
|
||||||
case Pet1:
|
case Pet1:
|
||||||
case SiegeEngine:
|
case SiegeEngine:
|
||||||
@@ -953,40 +951,33 @@ public class MobAI {
|
|||||||
public static void GuardLogic(Mob mob) {
|
public static void GuardLogic(Mob mob) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (mob.getCombatTarget() == null)
|
if (mob.getCombatTarget() == null) {
|
||||||
CheckForPlayerGuardAggro(mob);
|
CheckForPlayerGuardAggro(mob);
|
||||||
|
} else {
|
||||||
|
//do not need to look to change target if target is already null
|
||||||
|
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
||||||
|
|
||||||
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
if (newTarget != null) {
|
||||||
|
|
||||||
if (newTarget != null) {
|
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||||
|
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
|
||||||
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
mob.setCombatTarget(newTarget);
|
||||||
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
|
} else
|
||||||
mob.setCombatTarget(newTarget);
|
mob.setCombatTarget(newTarget);
|
||||||
} else
|
}
|
||||||
mob.setCombatTarget(newTarget);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckMobMovement(mob);
|
if(mob.behaviourType.canRoam)
|
||||||
CheckForAttack(mob);
|
CheckMobMovement(mob);//all guards that can move check to move
|
||||||
|
|
||||||
|
if(mob.combatTarget != null)
|
||||||
|
CheckForAttack(mob); //only check to attack if combat target is not null
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardLogic" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GuardWallArcherLogic(Mob mob) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (mob.getCombatTarget() == null)
|
|
||||||
CheckForPlayerGuardAggro(mob);
|
|
||||||
else
|
|
||||||
CheckForAttack(mob);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardWallArcherLogic" + " " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void PetLogic(Mob mob) {
|
private static void PetLogic(Mob mob) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user