|
|
@ -693,6 +693,8 @@ public class MobAI { |
|
|
|
DefaultLogic(mob); |
|
|
|
DefaultLogic(mob); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(mob.isAlive()) |
|
|
|
|
|
|
|
RecoverHealth(mob); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage()); |
|
|
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
@ -1095,22 +1097,6 @@ public class MobAI { |
|
|
|
CheckMobMovement(mob); |
|
|
|
CheckMobMovement(mob); |
|
|
|
|
|
|
|
|
|
|
|
CheckForAttack(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) { |
|
|
|
} catch (Exception e) { |
|
|
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage()); |
|
|
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
@ -1364,4 +1350,22 @@ public class MobAI { |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
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()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |