From 733926aa60abd09300f87a628104bed9eed0f150 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 9 Apr 2019 01:16:29 +0000 Subject: [PATCH] Adjusted Formulas calcCrit method. --- .../gameserver/model/stats/Formulas.java | 17 ++++++++--------- .../gameserver/model/stats/Formulas.java | 17 ++++++++--------- .../gameserver/model/stats/Formulas.java | 17 ++++++++--------- .../gameserver/model/stats/Formulas.java | 17 ++++++++--------- .../gameserver/model/stats/Formulas.java | 17 ++++++++--------- .../gameserver/model/stats/Formulas.java | 17 ++++++++--------- .../gameserver/model/stats/Formulas.java | 17 ++++++++--------- .../gameserver/model/stats/Formulas.java | 17 ++++++++--------- .../gameserver/model/stats/Formulas.java | 17 ++++++++--------- .../gameserver/model/stats/Formulas.java | 17 ++++++++--------- .../gameserver/model/stats/Formulas.java | 17 ++++++++--------- 11 files changed, 88 insertions(+), 99 deletions(-) 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 66270cd952..3fc6339659 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 @@ -200,36 +200,35 @@ public final class Formulas */ public static boolean calcCrit(double rate, Creature creature, Creature target, Skill skill) { - // Skill critical rate is calculated up to the first decimal, thats why multiply by 10 and compare to 1000. if (skill != null) { - // Magic Critical Rate + // Magic Critical Rate. if (skill.isMagic()) { rate = creature.getStat().getValue(Stats.MAGIC_CRITICAL_RATE); if ((target == null) || !skill.isBad()) { - return Math.min(rate, 320) > Rnd.get(1000); + return Math.min(rate, 32) > Rnd.get(100); } double finalRate = target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE, rate) + target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD, 0); if ((creature.getLevel() >= 78) && (target.getLevel() >= 78)) { finalRate += Math.sqrt(creature.getLevel()) + ((creature.getLevel() - target.getLevel()) / 25); - return Math.min(finalRate, 320) > Rnd.get(1000); + return Math.min(finalRate, 32) > Rnd.get(100); } - return Math.min(finalRate, 200) > Rnd.get(1000); + return Math.min(finalRate, 20) > Rnd.get(100); } - // Physical skill critical rate + // Physical skill critical rate. final double statBonus; // There is a chance that activeChar has altered base stat for skill critical. byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL); if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length)) { - // Best tested + // Best tested. statBonus = BaseStats.values()[skillCritRateStat].calcBonus(creature); } else @@ -239,8 +238,8 @@ public final class Formulas } final double rateBonus = creature.getStat().getValue(Stats.CRITICAL_RATE_SKILL, 1); - double finalRate = rate * statBonus * rateBonus * 10; - return finalRate > Rnd.get(1000); + double finalRate = rate * statBonus * rateBonus; + return Math.min(finalRate, 99) <= Rnd.get(100); } // Autoattack critical rate. 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 66270cd952..3fc6339659 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 @@ -200,36 +200,35 @@ public final class Formulas */ public static boolean calcCrit(double rate, Creature creature, Creature target, Skill skill) { - // Skill critical rate is calculated up to the first decimal, thats why multiply by 10 and compare to 1000. if (skill != null) { - // Magic Critical Rate + // Magic Critical Rate. if (skill.isMagic()) { rate = creature.getStat().getValue(Stats.MAGIC_CRITICAL_RATE); if ((target == null) || !skill.isBad()) { - return Math.min(rate, 320) > Rnd.get(1000); + return Math.min(rate, 32) > Rnd.get(100); } double finalRate = target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE, rate) + target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD, 0); if ((creature.getLevel() >= 78) && (target.getLevel() >= 78)) { finalRate += Math.sqrt(creature.getLevel()) + ((creature.getLevel() - target.getLevel()) / 25); - return Math.min(finalRate, 320) > Rnd.get(1000); + return Math.min(finalRate, 32) > Rnd.get(100); } - return Math.min(finalRate, 200) > Rnd.get(1000); + return Math.min(finalRate, 20) > Rnd.get(100); } - // Physical skill critical rate + // Physical skill critical rate. final double statBonus; // There is a chance that activeChar has altered base stat for skill critical. byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL); if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length)) { - // Best tested + // Best tested. statBonus = BaseStats.values()[skillCritRateStat].calcBonus(creature); } else @@ -239,8 +238,8 @@ public final class Formulas } final double rateBonus = creature.getStat().getValue(Stats.CRITICAL_RATE_SKILL, 1); - double finalRate = rate * statBonus * rateBonus * 10; - return finalRate > Rnd.get(1000); + double finalRate = rate * statBonus * rateBonus; + return Math.min(finalRate, 99) <= Rnd.get(100); } // Autoattack critical rate. 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 66270cd952..3fc6339659 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 @@ -200,36 +200,35 @@ public final class Formulas */ public static boolean calcCrit(double rate, Creature creature, Creature target, Skill skill) { - // Skill critical rate is calculated up to the first decimal, thats why multiply by 10 and compare to 1000. if (skill != null) { - // Magic Critical Rate + // Magic Critical Rate. if (skill.isMagic()) { rate = creature.getStat().getValue(Stats.MAGIC_CRITICAL_RATE); if ((target == null) || !skill.isBad()) { - return Math.min(rate, 320) > Rnd.get(1000); + return Math.min(rate, 32) > Rnd.get(100); } double finalRate = target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE, rate) + target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD, 0); if ((creature.getLevel() >= 78) && (target.getLevel() >= 78)) { finalRate += Math.sqrt(creature.getLevel()) + ((creature.getLevel() - target.getLevel()) / 25); - return Math.min(finalRate, 320) > Rnd.get(1000); + return Math.min(finalRate, 32) > Rnd.get(100); } - return Math.min(finalRate, 200) > Rnd.get(1000); + return Math.min(finalRate, 20) > Rnd.get(100); } - // Physical skill critical rate + // Physical skill critical rate. final double statBonus; // There is a chance that activeChar has altered base stat for skill critical. byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL); if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length)) { - // Best tested + // Best tested. statBonus = BaseStats.values()[skillCritRateStat].calcBonus(creature); } else @@ -239,8 +238,8 @@ public final class Formulas } final double rateBonus = creature.getStat().getValue(Stats.CRITICAL_RATE_SKILL, 1); - double finalRate = rate * statBonus * rateBonus * 10; - return finalRate > Rnd.get(1000); + double finalRate = rate * statBonus * rateBonus; + return Math.min(finalRate, 99) <= Rnd.get(100); } // Autoattack critical rate. 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 1ba111e590..8c10e9894c 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 @@ -200,36 +200,35 @@ public final class Formulas */ public static boolean calcCrit(double rate, Creature creature, Creature target, Skill skill) { - // Skill critical rate is calculated up to the first decimal, thats why multiply by 10 and compare to 1000. if (skill != null) { - // Magic Critical Rate + // Magic Critical Rate. if (skill.isMagic()) { rate = creature.getStat().getValue(Stats.MAGIC_CRITICAL_RATE); if ((target == null) || !skill.isBad()) { - return Math.min(rate, 320) > Rnd.get(1000); + return Math.min(rate, 32) > Rnd.get(100); } double finalRate = target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE, rate) + target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD, 0); if ((creature.getLevel() >= 78) && (target.getLevel() >= 78)) { finalRate += Math.sqrt(creature.getLevel()) + ((creature.getLevel() - target.getLevel()) / 25); - return Math.min(finalRate, 320) > Rnd.get(1000); + return Math.min(finalRate, 32) > Rnd.get(100); } - return Math.min(finalRate, 200) > Rnd.get(1000); + return Math.min(finalRate, 20) > Rnd.get(100); } - // Physical skill critical rate + // Physical skill critical rate. final double statBonus; // There is a chance that activeChar has altered base stat for skill critical. byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL); if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length)) { - // Best tested + // Best tested. statBonus = BaseStats.values()[skillCritRateStat].calcBonus(creature); } else @@ -239,8 +238,8 @@ public final class Formulas } final double rateBonus = creature.getStat().getValue(Stats.CRITICAL_RATE_SKILL, 1); - double finalRate = rate * statBonus * rateBonus * 10; - return finalRate > Rnd.get(1000); + double finalRate = rate * statBonus * rateBonus; + return Math.min(finalRate, 99) <= Rnd.get(100); } // Autoattack critical rate. 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 1ba111e590..8c10e9894c 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 @@ -200,36 +200,35 @@ public final class Formulas */ public static boolean calcCrit(double rate, Creature creature, Creature target, Skill skill) { - // Skill critical rate is calculated up to the first decimal, thats why multiply by 10 and compare to 1000. if (skill != null) { - // Magic Critical Rate + // Magic Critical Rate. if (skill.isMagic()) { rate = creature.getStat().getValue(Stats.MAGIC_CRITICAL_RATE); if ((target == null) || !skill.isBad()) { - return Math.min(rate, 320) > Rnd.get(1000); + return Math.min(rate, 32) > Rnd.get(100); } double finalRate = target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE, rate) + target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD, 0); if ((creature.getLevel() >= 78) && (target.getLevel() >= 78)) { finalRate += Math.sqrt(creature.getLevel()) + ((creature.getLevel() - target.getLevel()) / 25); - return Math.min(finalRate, 320) > Rnd.get(1000); + return Math.min(finalRate, 32) > Rnd.get(100); } - return Math.min(finalRate, 200) > Rnd.get(1000); + return Math.min(finalRate, 20) > Rnd.get(100); } - // Physical skill critical rate + // Physical skill critical rate. final double statBonus; // There is a chance that activeChar has altered base stat for skill critical. byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL); if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length)) { - // Best tested + // Best tested. statBonus = BaseStats.values()[skillCritRateStat].calcBonus(creature); } else @@ -239,8 +238,8 @@ public final class Formulas } final double rateBonus = creature.getStat().getValue(Stats.CRITICAL_RATE_SKILL, 1); - double finalRate = rate * statBonus * rateBonus * 10; - return finalRate > Rnd.get(1000); + double finalRate = rate * statBonus * rateBonus; + return Math.min(finalRate, 99) <= Rnd.get(100); } // Autoattack critical rate. 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 1ba111e590..8c10e9894c 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 @@ -200,36 +200,35 @@ public final class Formulas */ public static boolean calcCrit(double rate, Creature creature, Creature target, Skill skill) { - // Skill critical rate is calculated up to the first decimal, thats why multiply by 10 and compare to 1000. if (skill != null) { - // Magic Critical Rate + // Magic Critical Rate. if (skill.isMagic()) { rate = creature.getStat().getValue(Stats.MAGIC_CRITICAL_RATE); if ((target == null) || !skill.isBad()) { - return Math.min(rate, 320) > Rnd.get(1000); + return Math.min(rate, 32) > Rnd.get(100); } double finalRate = target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE, rate) + target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD, 0); if ((creature.getLevel() >= 78) && (target.getLevel() >= 78)) { finalRate += Math.sqrt(creature.getLevel()) + ((creature.getLevel() - target.getLevel()) / 25); - return Math.min(finalRate, 320) > Rnd.get(1000); + return Math.min(finalRate, 32) > Rnd.get(100); } - return Math.min(finalRate, 200) > Rnd.get(1000); + return Math.min(finalRate, 20) > Rnd.get(100); } - // Physical skill critical rate + // Physical skill critical rate. final double statBonus; // There is a chance that activeChar has altered base stat for skill critical. byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL); if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length)) { - // Best tested + // Best tested. statBonus = BaseStats.values()[skillCritRateStat].calcBonus(creature); } else @@ -239,8 +238,8 @@ public final class Formulas } final double rateBonus = creature.getStat().getValue(Stats.CRITICAL_RATE_SKILL, 1); - double finalRate = rate * statBonus * rateBonus * 10; - return finalRate > Rnd.get(1000); + double finalRate = rate * statBonus * rateBonus; + return Math.min(finalRate, 99) <= Rnd.get(100); } // Autoattack critical rate. 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 1ba111e590..8c10e9894c 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 @@ -200,36 +200,35 @@ public final class Formulas */ public static boolean calcCrit(double rate, Creature creature, Creature target, Skill skill) { - // Skill critical rate is calculated up to the first decimal, thats why multiply by 10 and compare to 1000. if (skill != null) { - // Magic Critical Rate + // Magic Critical Rate. if (skill.isMagic()) { rate = creature.getStat().getValue(Stats.MAGIC_CRITICAL_RATE); if ((target == null) || !skill.isBad()) { - return Math.min(rate, 320) > Rnd.get(1000); + return Math.min(rate, 32) > Rnd.get(100); } double finalRate = target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE, rate) + target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD, 0); if ((creature.getLevel() >= 78) && (target.getLevel() >= 78)) { finalRate += Math.sqrt(creature.getLevel()) + ((creature.getLevel() - target.getLevel()) / 25); - return Math.min(finalRate, 320) > Rnd.get(1000); + return Math.min(finalRate, 32) > Rnd.get(100); } - return Math.min(finalRate, 200) > Rnd.get(1000); + return Math.min(finalRate, 20) > Rnd.get(100); } - // Physical skill critical rate + // Physical skill critical rate. final double statBonus; // There is a chance that activeChar has altered base stat for skill critical. byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL); if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length)) { - // Best tested + // Best tested. statBonus = BaseStats.values()[skillCritRateStat].calcBonus(creature); } else @@ -239,8 +238,8 @@ public final class Formulas } final double rateBonus = creature.getStat().getValue(Stats.CRITICAL_RATE_SKILL, 1); - double finalRate = rate * statBonus * rateBonus * 10; - return finalRate > Rnd.get(1000); + double finalRate = rate * statBonus * rateBonus; + return Math.min(finalRate, 99) <= Rnd.get(100); } // Autoattack critical rate. 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 c12392abb0..16db647943 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 @@ -200,36 +200,35 @@ public final class Formulas */ public static boolean calcCrit(double rate, Creature creature, Creature target, Skill skill) { - // Skill critical rate is calculated up to the first decimal, thats why multiply by 10 and compare to 1000. if (skill != null) { - // Magic Critical Rate + // Magic Critical Rate. if (skill.isMagic()) { rate = creature.getStat().getValue(Stats.MAGIC_CRITICAL_RATE); if ((target == null) || !skill.isBad()) { - return Math.min(rate, 320) > Rnd.get(1000); + return Math.min(rate, 32) > Rnd.get(100); } double finalRate = target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE, rate) + target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD, 0); if ((creature.getLevel() >= 78) && (target.getLevel() >= 78)) { finalRate += Math.sqrt(creature.getLevel()) + ((creature.getLevel() - target.getLevel()) / 25); - return Math.min(finalRate, 320) > Rnd.get(1000); + return Math.min(finalRate, 32) > Rnd.get(100); } - return Math.min(finalRate, 200) > Rnd.get(1000); + return Math.min(finalRate, 20) > Rnd.get(100); } - // Physical skill critical rate + // Physical skill critical rate. final double statBonus; // There is a chance that activeChar has altered base stat for skill critical. byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL); if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length)) { - // Best tested + // Best tested. statBonus = BaseStats.values()[skillCritRateStat].calcBonus(creature); } else @@ -239,8 +238,8 @@ public final class Formulas } final double rateBonus = creature.getStat().getValue(Stats.CRITICAL_RATE_SKILL, 1); - double finalRate = rate * statBonus * rateBonus * 10; - return finalRate > Rnd.get(1000); + double finalRate = rate * statBonus * rateBonus; + return Math.min(finalRate, 99) <= Rnd.get(100); } // Autoattack critical rate. 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 c12392abb0..16db647943 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 @@ -200,36 +200,35 @@ public final class Formulas */ public static boolean calcCrit(double rate, Creature creature, Creature target, Skill skill) { - // Skill critical rate is calculated up to the first decimal, thats why multiply by 10 and compare to 1000. if (skill != null) { - // Magic Critical Rate + // Magic Critical Rate. if (skill.isMagic()) { rate = creature.getStat().getValue(Stats.MAGIC_CRITICAL_RATE); if ((target == null) || !skill.isBad()) { - return Math.min(rate, 320) > Rnd.get(1000); + return Math.min(rate, 32) > Rnd.get(100); } double finalRate = target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE, rate) + target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD, 0); if ((creature.getLevel() >= 78) && (target.getLevel() >= 78)) { finalRate += Math.sqrt(creature.getLevel()) + ((creature.getLevel() - target.getLevel()) / 25); - return Math.min(finalRate, 320) > Rnd.get(1000); + return Math.min(finalRate, 32) > Rnd.get(100); } - return Math.min(finalRate, 200) > Rnd.get(1000); + return Math.min(finalRate, 20) > Rnd.get(100); } - // Physical skill critical rate + // Physical skill critical rate. final double statBonus; // There is a chance that activeChar has altered base stat for skill critical. byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL); if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length)) { - // Best tested + // Best tested. statBonus = BaseStats.values()[skillCritRateStat].calcBonus(creature); } else @@ -239,8 +238,8 @@ public final class Formulas } final double rateBonus = creature.getStat().getValue(Stats.CRITICAL_RATE_SKILL, 1); - double finalRate = rate * statBonus * rateBonus * 10; - return finalRate > Rnd.get(1000); + double finalRate = rate * statBonus * rateBonus; + return Math.min(finalRate, 99) <= Rnd.get(100); } // Autoattack critical rate. 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 c12392abb0..16db647943 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 @@ -200,36 +200,35 @@ public final class Formulas */ public static boolean calcCrit(double rate, Creature creature, Creature target, Skill skill) { - // Skill critical rate is calculated up to the first decimal, thats why multiply by 10 and compare to 1000. if (skill != null) { - // Magic Critical Rate + // Magic Critical Rate. if (skill.isMagic()) { rate = creature.getStat().getValue(Stats.MAGIC_CRITICAL_RATE); if ((target == null) || !skill.isBad()) { - return Math.min(rate, 320) > Rnd.get(1000); + return Math.min(rate, 32) > Rnd.get(100); } double finalRate = target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE, rate) + target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD, 0); if ((creature.getLevel() >= 78) && (target.getLevel() >= 78)) { finalRate += Math.sqrt(creature.getLevel()) + ((creature.getLevel() - target.getLevel()) / 25); - return Math.min(finalRate, 320) > Rnd.get(1000); + return Math.min(finalRate, 32) > Rnd.get(100); } - return Math.min(finalRate, 200) > Rnd.get(1000); + return Math.min(finalRate, 20) > Rnd.get(100); } - // Physical skill critical rate + // Physical skill critical rate. final double statBonus; // There is a chance that activeChar has altered base stat for skill critical. byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL); if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length)) { - // Best tested + // Best tested. statBonus = BaseStats.values()[skillCritRateStat].calcBonus(creature); } else @@ -239,8 +238,8 @@ public final class Formulas } final double rateBonus = creature.getStat().getValue(Stats.CRITICAL_RATE_SKILL, 1); - double finalRate = rate * statBonus * rateBonus * 10; - return finalRate > Rnd.get(1000); + double finalRate = rate * statBonus * rateBonus; + return Math.min(finalRate, 99) <= Rnd.get(100); } // Autoattack critical rate. 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 c12392abb0..16db647943 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 @@ -200,36 +200,35 @@ public final class Formulas */ public static boolean calcCrit(double rate, Creature creature, Creature target, Skill skill) { - // Skill critical rate is calculated up to the first decimal, thats why multiply by 10 and compare to 1000. if (skill != null) { - // Magic Critical Rate + // Magic Critical Rate. if (skill.isMagic()) { rate = creature.getStat().getValue(Stats.MAGIC_CRITICAL_RATE); if ((target == null) || !skill.isBad()) { - return Math.min(rate, 320) > Rnd.get(1000); + return Math.min(rate, 32) > Rnd.get(100); } double finalRate = target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE, rate) + target.getStat().getValue(Stats.DEFENCE_MAGIC_CRITICAL_RATE_ADD, 0); if ((creature.getLevel() >= 78) && (target.getLevel() >= 78)) { finalRate += Math.sqrt(creature.getLevel()) + ((creature.getLevel() - target.getLevel()) / 25); - return Math.min(finalRate, 320) > Rnd.get(1000); + return Math.min(finalRate, 32) > Rnd.get(100); } - return Math.min(finalRate, 200) > Rnd.get(1000); + return Math.min(finalRate, 20) > Rnd.get(100); } - // Physical skill critical rate + // Physical skill critical rate. final double statBonus; // There is a chance that activeChar has altered base stat for skill critical. byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL); if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length)) { - // Best tested + // Best tested. statBonus = BaseStats.values()[skillCritRateStat].calcBonus(creature); } else @@ -239,8 +238,8 @@ public final class Formulas } final double rateBonus = creature.getStat().getValue(Stats.CRITICAL_RATE_SKILL, 1); - double finalRate = rate * statBonus * rateBonus * 10; - return finalRate > Rnd.get(1000); + double finalRate = rate * statBonus * rateBonus; + return Math.min(finalRate, 99) <= Rnd.get(100); } // Autoattack critical rate.