From 7d1ceaca6a8b5e1264ed39f5378d4c81a77192e6 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 21 Dec 2020 22:53:57 +0000 Subject: [PATCH] HpCpHeal could be affected by ADDITIONAL_POTION_HP stat. --- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 22 ++++++++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 17 +++++++++++--- .../handlers/effecthandlers/HpCpHeal.java | 22 ++++++++++++++++--- 17 files changed, 248 insertions(+), 51 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index e7d55999fe..205b05658b 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index e7d55999fe..205b05658b 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index e7d55999fe..205b05658b 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index e7d55999fe..205b05658b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index e7d55999fe..205b05658b 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index e7d55999fe..205b05658b 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index e7d55999fe..205b05658b 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index e7d55999fe..205b05658b 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index e7d55999fe..205b05658b 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index deb08f7502..50328f37e2 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index deb08f7502..50328f37e2 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index deb08f7502..50328f37e2 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index deb08f7502..50328f37e2 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index deb08f7502..50328f37e2 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index deb08f7502..d82075f851 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -25,6 +25,7 @@ import org.l2jmobius.gameserver.model.effects.EffectFlag; import org.l2jmobius.gameserver.model.effects.EffectType; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; import org.l2jmobius.gameserver.model.items.type.CrystalType; +import org.l2jmobius.gameserver.model.skills.CommonSkill; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Stat; @@ -120,12 +121,27 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + + // Classic Potion Mastery + // TODO: Create an effect if more mastery skills are added. + amount *= 1 + (effected.getAffectedSkillLevel(CommonSkill.POTION_MASTERY.getId()) / 100); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +150,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index deb08f7502..50328f37e2 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -120,12 +120,23 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +145,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index deb08f7502..d82075f851 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -25,6 +25,7 @@ import org.l2jmobius.gameserver.model.effects.EffectFlag; import org.l2jmobius.gameserver.model.effects.EffectType; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; import org.l2jmobius.gameserver.model.items.type.CrystalType; +import org.l2jmobius.gameserver.model.skills.CommonSkill; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Stat; @@ -120,12 +121,27 @@ public class HpCpHeal extends AbstractEffect } } + // Additional potion HP. + double additionalHp = 0; + if ((item != null) && (item.isPotion() || item.isElixir())) + { + additionalHp = effected.getStat().getValue(Stat.ADDITIONAL_POTION_HP, 0); + + // Classic Potion Mastery + // TODO: Create an effect if more mastery skills are added. + amount *= 1 + (effected.getAffectedSkillLevel(CommonSkill.POTION_MASTERY.getId()) / 100); + } + // Prevents overheal and negative amount final double healAmount = Math.max(Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp()), 0); if (healAmount != 0) { final double newHp = healAmount + effected.getCurrentHp(); - effected.setCurrentHp(newHp, false); + if ((newHp + additionalHp) > effected.getMaxRecoverableHp()) + { + additionalHp = Math.max(effected.getMaxRecoverableHp() - newHp, 0); + } + effected.setCurrentHp(newHp + additionalHp, false); } if (effected.isPlayer()) @@ -134,13 +150,13 @@ public class HpCpHeal extends AbstractEffect { final SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); sm.addString(effector.getName()); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); } else { final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); + sm.addInt((int) (healAmount + additionalHp)); effected.sendPacket(sm); }