diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 777afddb..b4543321 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -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()); } @@ -1095,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()); } @@ -1364,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()); + } + } } \ No newline at end of file