diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/Formulas.java index 9959186beb..66270cd952 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -1407,26 +1407,6 @@ public final class Formulas } } - public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit) - { - if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1)) - { - final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; - if (skill != null) - { - return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1)); - } - else if (crit) - { - return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1)); - } - - return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1)); - } - - return 1.0; - } - /** * Calculates if the specified creature can get its stun effect removed due to damage taken. * @param creature the creature to be checked @@ -1572,7 +1552,20 @@ public final class Formulas final double pveAttack; final double pveDefense; final double pveRaidDefense; - final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit); + + double pvePenalty = 1; + if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + { + final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; + if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1); + } + else + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff); + } + } if (skill != null) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/Formulas.java index 9959186beb..66270cd952 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -1407,26 +1407,6 @@ public final class Formulas } } - public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit) - { - if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1)) - { - final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; - if (skill != null) - { - return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1)); - } - else if (crit) - { - return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1)); - } - - return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1)); - } - - return 1.0; - } - /** * Calculates if the specified creature can get its stun effect removed due to damage taken. * @param creature the creature to be checked @@ -1572,7 +1552,20 @@ public final class Formulas final double pveAttack; final double pveDefense; final double pveRaidDefense; - final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit); + + double pvePenalty = 1; + if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + { + final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; + if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1); + } + else + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff); + } + } if (skill != null) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/Formulas.java index 9959186beb..66270cd952 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -1407,26 +1407,6 @@ public final class Formulas } } - public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit) - { - if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1)) - { - final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; - if (skill != null) - { - return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1)); - } - else if (crit) - { - return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1)); - } - - return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1)); - } - - return 1.0; - } - /** * Calculates if the specified creature can get its stun effect removed due to damage taken. * @param creature the creature to be checked @@ -1572,7 +1552,20 @@ public final class Formulas final double pveAttack; final double pveDefense; final double pveRaidDefense; - final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit); + + double pvePenalty = 1; + if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + { + final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; + if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1); + } + else + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff); + } + } if (skill != null) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/Formulas.java index ba230aa9ef..1ba111e590 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -1407,26 +1407,6 @@ public final class Formulas } } - public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit) - { - if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1)) - { - final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; - if (skill != null) - { - return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1)); - } - else if (crit) - { - return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1)); - } - - return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1)); - } - - return 1.0; - } - /** * Calculates if the specified creature can get its stun effect removed due to damage taken. * @param creature the creature to be checked @@ -1572,7 +1552,20 @@ public final class Formulas final double pveAttack; final double pveDefense; final double pveRaidDefense; - final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit); + + double pvePenalty = 1; + if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + { + final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; + if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1); + } + else + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff); + } + } if (skill != null) { diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/Formulas.java index ba230aa9ef..1ba111e590 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -1407,26 +1407,6 @@ public final class Formulas } } - public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit) - { - if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1)) - { - final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; - if (skill != null) - { - return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1)); - } - else if (crit) - { - return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1)); - } - - return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1)); - } - - return 1.0; - } - /** * Calculates if the specified creature can get its stun effect removed due to damage taken. * @param creature the creature to be checked @@ -1572,7 +1552,20 @@ public final class Formulas final double pveAttack; final double pveDefense; final double pveRaidDefense; - final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit); + + double pvePenalty = 1; + if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + { + final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; + if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1); + } + else + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff); + } + } if (skill != null) { diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/Formulas.java index ba230aa9ef..1ba111e590 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -1407,26 +1407,6 @@ public final class Formulas } } - public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit) - { - if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1)) - { - final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; - if (skill != null) - { - return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1)); - } - else if (crit) - { - return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1)); - } - - return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1)); - } - - return 1.0; - } - /** * Calculates if the specified creature can get its stun effect removed due to damage taken. * @param creature the creature to be checked @@ -1572,7 +1552,20 @@ public final class Formulas final double pveAttack; final double pveDefense; final double pveRaidDefense; - final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit); + + double pvePenalty = 1; + if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + { + final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; + if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1); + } + else + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff); + } + } if (skill != null) { diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/Formulas.java index ba230aa9ef..1ba111e590 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -1407,26 +1407,6 @@ public final class Formulas } } - public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit) - { - if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1)) - { - final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; - if (skill != null) - { - return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1)); - } - else if (crit) - { - return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1)); - } - - return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1)); - } - - return 1.0; - } - /** * Calculates if the specified creature can get its stun effect removed due to damage taken. * @param creature the creature to be checked @@ -1572,7 +1552,20 @@ public final class Formulas final double pveAttack; final double pveDefense; final double pveRaidDefense; - final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit); + + double pvePenalty = 1; + if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + { + final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; + if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1); + } + else + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff); + } + } if (skill != null) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/Formulas.java index 5ba4f97d0a..c12392abb0 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -1407,26 +1407,6 @@ public final class Formulas } } - public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit) - { - if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1)) - { - final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; - if (skill != null) - { - return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1)); - } - else if (crit) - { - return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1)); - } - - return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1)); - } - - return 1.0; - } - /** * Calculates if the specified creature can get its stun effect removed due to damage taken. * @param creature the creature to be checked @@ -1572,7 +1552,20 @@ public final class Formulas final double pveAttack; final double pveDefense; final double pveRaidDefense; - final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit); + + double pvePenalty = 1; + if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + { + final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; + if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1); + } + else + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff); + } + } if (skill != null) { diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/Formulas.java index 5ba4f97d0a..c12392abb0 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -1407,26 +1407,6 @@ public final class Formulas } } - public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit) - { - if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1)) - { - final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; - if (skill != null) - { - return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1)); - } - else if (crit) - { - return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1)); - } - - return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1)); - } - - return 1.0; - } - /** * Calculates if the specified creature can get its stun effect removed due to damage taken. * @param creature the creature to be checked @@ -1572,7 +1552,20 @@ public final class Formulas final double pveAttack; final double pveDefense; final double pveRaidDefense; - final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit); + + double pvePenalty = 1; + if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + { + final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; + if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1); + } + else + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff); + } + } if (skill != null) { diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/Formulas.java index 5ba4f97d0a..c12392abb0 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -1407,26 +1407,6 @@ public final class Formulas } } - public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit) - { - if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1)) - { - final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; - if (skill != null) - { - return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1)); - } - else if (crit) - { - return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1)); - } - - return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1)); - } - - return 1.0; - } - /** * Calculates if the specified creature can get its stun effect removed due to damage taken. * @param creature the creature to be checked @@ -1572,7 +1552,20 @@ public final class Formulas final double pveAttack; final double pveDefense; final double pveRaidDefense; - final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit); + + double pvePenalty = 1; + if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + { + final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; + if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1); + } + else + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff); + } + } if (skill != null) { diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/Formulas.java index 5ba4f97d0a..c12392abb0 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -1407,26 +1407,6 @@ public final class Formulas } } - public static double calcPveDamagePenalty(Creature attacker, Creature target, Skill skill, boolean crit) - { - if (target.isAttackable() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) > 1)) - { - final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; - if (skill != null) - { - return Config.NPC_SKILL_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_SKILL_DMG_PENALTY.size() - 1)); - } - else if (crit) - { - return Config.NPC_CRIT_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_CRIT_DMG_PENALTY.size() - 1)); - } - - return Config.NPC_DMG_PENALTY.get(Math.min(lvlDiff, Config.NPC_DMG_PENALTY.size() - 1)); - } - - return 1.0; - } - /** * Calculates if the specified creature can get its stun effect removed due to damage taken. * @param creature the creature to be checked @@ -1572,7 +1552,20 @@ public final class Formulas final double pveAttack; final double pveDefense; final double pveRaidDefense; - final double pvePenalty = calcPveDamagePenalty(attacker, target, skill, crit); + + double pvePenalty = 1; + if (!target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + { + final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; + if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(Config.NPC_SKILL_DMG_PENALTY.size() - 1); + } + else + { + pvePenalty = Config.NPC_SKILL_DMG_PENALTY.get(lvlDiff); + } + } if (skill != null) {