|
|
|
@ -693,6 +693,8 @@ public class MobAI {
@@ -693,6 +693,8 @@ public class MobAI {
|
|
|
|
|
DefaultLogic(mob); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if(mob.isAlive()) |
|
|
|
|
RecoverHealth(mob); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage()); |
|
|
|
|
} |
|
|
|
@ -808,7 +810,7 @@ public class MobAI {
@@ -808,7 +810,7 @@ public class MobAI {
|
|
|
|
|
chaseTarget(mob); |
|
|
|
|
break; |
|
|
|
|
case GuardMinion: |
|
|
|
|
if (!mob.npcOwner.isAlive() || ((Mob) mob.npcOwner).despawned) |
|
|
|
|
if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null) |
|
|
|
|
randomGuardPatrolPoint(mob); |
|
|
|
|
else { |
|
|
|
|
if (mob.getCombatTarget() != null) { |
|
|
|
@ -827,6 +829,7 @@ public class MobAI {
@@ -827,6 +829,7 @@ public class MobAI {
|
|
|
|
|
chaseTarget(mob); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage()); |
|
|
|
@ -1043,7 +1046,6 @@ public class MobAI {
@@ -1043,7 +1046,6 @@ public class MobAI {
|
|
|
|
|
mob.setCombatTarget(newTarget); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CheckMobMovement(mob); |
|
|
|
|
CheckForAttack(mob); |
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -1054,24 +1056,9 @@ public class MobAI {
@@ -1054,24 +1056,9 @@ public class MobAI {
|
|
|
|
|
public static void GuardMinionLogic(Mob mob) { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
if (!mob.npcOwner.isAlive()) { |
|
|
|
|
|
|
|
|
|
if (mob.getCombatTarget() == null) { |
|
|
|
|
CheckForPlayerGuardAggro(mob); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob); |
|
|
|
|
|
|
|
|
|
if (newTarget != null) { |
|
|
|
|
|
|
|
|
|
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { |
|
|
|
|
if (GuardCanAggro(mob, (PlayerCharacter) newTarget)) |
|
|
|
|
mob.setCombatTarget(newTarget); |
|
|
|
|
} else |
|
|
|
|
mob.setCombatTarget(newTarget); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
boolean isComanded = mob.npcOwner.isAlive(); |
|
|
|
|
if (!isComanded) { |
|
|
|
|
GuardCaptainLogic(mob); |
|
|
|
|
}else { |
|
|
|
|
if (mob.npcOwner.getCombatTarget() != null) |
|
|
|
|
mob.setCombatTarget(mob.npcOwner.getCombatTarget()); |
|
|
|
@ -1110,22 +1097,6 @@ public class MobAI {
@@ -1110,22 +1097,6 @@ public class MobAI {
|
|
|
|
|
CheckMobMovement(mob); |
|
|
|
|
|
|
|
|
|
CheckForAttack(mob); |
|
|
|
|
|
|
|
|
|
//recover health
|
|
|
|
|
|
|
|
|
|
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false) |
|
|
|
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis()); |
|
|
|
|
|
|
|
|
|
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000) |
|
|
|
|
if (mob.getHealth() < mob.getHealthMax()) { |
|
|
|
|
|
|
|
|
|
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f); |
|
|
|
|
mob.setHealth(mob.getHealth() + recoveredHealth); |
|
|
|
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis()); |
|
|
|
|
|
|
|
|
|
if (mob.getHealth() > mob.getHealthMax()) |
|
|
|
|
mob.setHealth(mob.getHealthMax()); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage()); |
|
|
|
|
} |
|
|
|
@ -1379,4 +1350,22 @@ public class MobAI {
@@ -1379,4 +1350,22 @@ public class MobAI {
|
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void RecoverHealth(Mob mob){ |
|
|
|
|
//recover health
|
|
|
|
|
|
|
|
|
|
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false) |
|
|
|
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis()); |
|
|
|
|
|
|
|
|
|
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000) |
|
|
|
|
if (mob.getHealth() < mob.getHealthMax()) { |
|
|
|
|
|
|
|
|
|
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f); |
|
|
|
|
mob.setHealth(mob.getHealth() + recoveredHealth); |
|
|
|
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis()); |
|
|
|
|
|
|
|
|
|
if (mob.getHealth() > mob.getHealthMax()) |
|
|
|
|
mob.setHealth(mob.getHealthMax()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |