Index: /java/net/sf/l2j/gameserver/skills/Formulas.java =================================================================== --- /java/net/sf/l2j/gameserver/skills/Formulas.java (revision 2263) +++ /java/net/sf/l2j/gameserver/skills/Formulas.java (working copy) @@ -993,23 +993,18 @@ if(attacker instanceof L2PcInstance && target instanceof L2PcInstance) damage *= 0.9; // PvP modifier (-10%) if(mcrit) damage *= 2; - if (Config.ALT_GAME_MAGICFAILURES) // Failure calculation + // Failure calculation + if (Config.ALT_GAME_MAGICFAILURES && !calcSkillSuccess(attacker, target, skill, false, ss, bss)) { /* Level difference: - * less then 7 : full chance - * 7 - 20 : reduced chance - * 20 and more : min chance + * less then 10 : full chance + * 10 - 20 : reduced chance + * 20 and more : min chance */ - // TODO: Temporary fix for skills with Power = 0 or LevelDepend not set - int rate = (int)(200 - 10 * (target.getLevel() - (skill.getMagicLevel()>0?skill.getMagicLevel():attacker.getLevel()))); - if (target.isRaid()) rate /= 2; // chance is reduced for RaidBoss - - if (rate > 123) rate = 123; - if (rate < 1) rate = 1; - int check = _rnd.nextInt(100); - if (rate <= check) damage = 1; - else if (rate <= check +25) damage /= 2; + if (calcSkillSuccess(attacker, target, skill, false, ss, bss)) + damage /= 2; + else damage = 1; } return damage; @@ -1083,7 +1078,7 @@ return d > 0; } - public boolean calcSkillSuccess(L2Character player, L2Character target, L2Skill skill, boolean ss, boolean sps, boolean bss ) + public boolean calcSkillSuccessOld(L2Character player, L2Character target, L2Skill skill, boolean ss, boolean sps, boolean bss ) { if(Config.ALT_GAME_SKILL_FORMULAS.equalsIgnoreCase("alt") || Config.ALT_GAME_SKILL_FORMULAS.equalsIgnoreCase("true")) @@ -1198,6 +1193,93 @@ return success; } + public int calcSkillResistance(SkillType type, L2Character target) + { + switch(type) + { + case BLEED: return (int) target.calcStat(Stats.BLEED_RES, 0, target, null); + case POISON: return (int) target.calcStat(Stats.POISON_RES, 0, target, null); + case STUN: return (int) target.calcStat(Stats.STUN_RES, 0, target, null); + case PARALYZE: return (int) target.calcStat(Stats.PARALYZE_RES, 0, target, null); + case ROOT: return (int) target.calcStat(Stats.ROOT_RES, 0, target, null); + case SLEEP: return (int) target.calcStat(Stats.SLEEP_RES, 0, target, null); + case MUTE: return (int) target.calcStat(Stats.MUTE_RES, 0, target, null); + case FEAR: + case CONFUSION: return (int) target.calcStat(Stats.CONFUSION_RES, 0, target, null); + default: return 0; + } + } + + public int calcSkillStatModifier(SkillType type, L2Character target) + { + switch(type) + { + case STUN: return target.getCON(); + case ROOT: return target.getDEX(); + case SLEEP: return target.getWIT(); + case MUTE: + case CONFUSION: + case PARALYZE: return target.getMEN(); + default: return 0; + } + } + + public boolean calcSkillSuccess(L2Character player, L2Character target, L2Skill skill, boolean ss, boolean sps, boolean bss) + { + if(Config.ALT_GAME_SKILL_FORMULAS.equalsIgnoreCase("alt") || Config.ALT_GAME_SKILL_FORMULAS.equalsIgnoreCase("true")) + return calcAltSkillSuccess(player, target, skill); + + SkillType type = skill.getSkillType(); + + if (target.isRaid() && (type == SkillType.CONFUSION || type == SkillType.MUTE || type == SkillType.PARALYZE || type == SkillType.ROOT)) + return false; // these skills should not work on RaidBoss + + int value = (int)skill.getPower(); + int lvlDepend = skill.getLevelDepend(); + + if (type == SkillType.PDAM) // For additional effects on PDAM skills (like STUN, SHOCK,...) + { + value = 50; + type = SkillType.STUN; + } + if (type == SkillType.MDAM) // Used for Magic attack failure calc + { + value = target.isRaid()? 100 : 200; // chance is reduced for RaidBoss + lvlDepend = 10; + } + + // TODO: Temporary fix for skills with Power = 0 or LevelDepend not set + if(value == 0) value = (type == SkillType.PARALYZE)? 50 : 80; + if(lvlDepend == 0) lvlDepend = (type == SkillType.PARALYZE)? 1 : 2; + + // TODO: Temporary fix for NPC skills with MagicLevel not set + // int lvlmodifier = (skill.getMagicLevel() - target.getLevel()) * lvlDepend; + int lvlmodifier = ((skill.getMagicLevel()>0?skill.getMagicLevel():player.getLevel()) - target.getLevel()) * lvlDepend; + int statmodifier = calcSkillStatModifier(type, target); + + int ssmodifier = 100; + if (bss) ssmodifier = 200; + else if (sps) ssmodifier = 150; + else if (ss) ssmodifier = 150; + + if(Config.DEVELOPER) System.out.println(skill.getName() + ": " + value + ", " + lvlmodifier + ", " + calcSkillResistance(type, target) + ", " + statmodifier); + int rate = value + lvlmodifier - calcSkillResistance(type, target); + if (skill.isMagic()) rate *= Math.sqrt(player.getMAtk(target, skill)/target.getMDef(player, skill)); + if (statmodifier > 0) rate = rate * (100 - statmodifier) / 100; + + if (rate > 99) rate = 99; + else if (rate < 1) rate = 1; + + if (ssmodifier != 100) + { + if (rate > 10000/(100+ssmodifier)) + rate = 100-(100-rate)*100/ssmodifier; + else rate = rate*ssmodifier/100; + } + + return (_rnd.nextInt(100) < rate); + } + public boolean calcAltSkillSuccess(L2Character activeChar, L2Character target, L2Skill skill) { // Get our numbers and base success rate Index: /java/net/sf/l2j/gameserver/skills/Stats.java =================================================================== --- /java/net/sf/l2j/gameserver/skills/Stats.java (revision 2263) +++ /java/net/sf/l2j/gameserver/skills/Stats.java (working copy) @@ -98,10 +98,12 @@ BLEED_RES, POISON_RES, STUN_RES, + PARALYZE_RES, ROOT_RES, - MOVEMENT_RES, + SLEEP_RES, CONFUSION_RES, - SLEEP_RES, + MUTE_RES, + MOVEMENT_RES, FIRE_RES, WIND_RES, WATER_RES, @@ -181,10 +183,12 @@ if (name == "bleedRes" ) return BLEED_RES; if (name == "poisonRes" ) return POISON_RES; if (name == "stunRes" ) return STUN_RES; + if (name == "paralyzeRes" ) return PARALYZE_RES; if (name == "rootRes" ) return ROOT_RES; - if (name == "movementRes" ) return MOVEMENT_RES; + if (name == "sleepRes" ) return SLEEP_RES; if (name == "confusionRes" ) return CONFUSION_RES; - if (name == "sleepRes" ) return SLEEP_RES; + if (name == "muteRes" ) return MUTE_RES; + if (name == "movementRes" ) return MOVEMENT_RES; if (name == "fireRes" ) return FIRE_RES; if (name == "windRes" ) return WIND_RES; if (name == "waterRes" ) return WATER_RES; Index: /data/stats/skills/1000-1099.xml =================================================================== --- /data/stats/skills/1000-1099.xml (revision 1138) +++ /data/stats/skills/1000-1099.xml (working copy) @@ -531,7 +531,7 @@ 35 44 52
- 20 30 45
+ 30 40 50
@@ -545,13 +545,13 @@ - +
30 35 39
- 1.25 1.3 1.35
+ 35 40 44
@@ -565,7 +565,7 @@ - +
@@ -588,10 +588,7 @@ 23 35 44 52
- 1.1 1.2 1.3 1.4
- 1.1 1.2 1.3 1.4
- 1.1 1.2 1.3 1.4
- 1.1 1.2 1.3 1.4
+ 50 60 70 80
@@ -605,9 +602,10 @@ - - - + + + +
Index: /data/stats/skills/0100-0199.xml =================================================================== --- /data/stats/skills/0100-0199.xml (revision 1138) +++ /data/stats/skills/0100-0199.xml (working copy) @@ -678,9 +678,9 @@ - - - + + + Index: /data/stats/skills/0200-0299.xml =================================================================== --- /data/stats/skills/0200-0299.xml (revision 1138) +++ /data/stats/skills/0200-0299.xml (working copy) @@ -1642,9 +1642,7 @@ 31 44 58
- 1.1 1.2 1.3
- 1.1 1.2 1.3
- 1.1 1.2 1.3
+ 40 60 80
@@ -1657,9 +1655,10 @@ - - - + + + +
Index: /data/stats/skills/1200-1299.xml =================================================================== --- /data/stats/skills/1200-1299.xml (revision 1138) +++ /data/stats/skills/1200-1299.xml (working copy) @@ -1165,25 +1165,24 @@ -36 44 58 65
-1.2 1.25 1.3 1.35
- - - - - - - - - - - - - - - - - + 36 44 58 65
+ 20 25 30 35
+ + + + + + + + + + + + + + + +