17.12.2013, 15:54 | #1 |
L2-scripts клиент Classic 1.5 + ГЕО до 1 июля
Регистрация: 23.09.2013
Сообщений: 437
|
Magical Evasion Not working
hello
Magical evasion is not working at all, in core at formulas it is clearly missing, only for physical attacks is made, please add ( keep in mind max evasion if 500 for magical accuracy/evasion) Код:
public static boolean calcHitMiss(Creature attacker, Creature target) { int chanceToHit = 88 + 2 * (attacker.getPAccuracy() - target.getPEvasionRate(attacker)); chanceToHit = Math.max(chanceToHit, 28); chanceToHit = Math.min(chanceToHit, 98); PositionUtils.TargetDirection direction = PositionUtils.getDirectionTo(attacker, target); switch (1.$SwitchMap$l2s$gameserver$utils$PositionUtils$TargetDirection[direction.ordinal()]) { case 1: chanceToHit = (int)(chanceToHit * 1.2D); break; case 2: chanceToHit = (int)(chanceToHit * 1.1D); } return !Rnd.chance(chanceToHit); } Код:
double magic_rcpt = target.calcStat(Stats.MAGIC_RESIST, attacker, skill) - attacker.calcStat(Stats.MAGIC_POWER, target, skill); double failChance = 4.0D * Math.max(1.0D, levelDiff) * (1.0D + magic_rcpt / 100.0D); if (Rnd.chance(failChance)) { if (levelDiff > 9) { damage = 0.0D; SystemMessage2 msg = (SystemMessage2)((SystemMessage2)new SystemMessage2(SystemMsg.C1_RESISTED_C2S_MAGIC).addName(target)).addName(attacker); attacker.sendPacket(msg); target.sendPacket(msg); } else { damage /= 2.0D; SystemMessage2 msg = (SystemMessage2)((SystemMessage2)new SystemMessage2(SystemMsg.DAMAGE_IS_DECREASED_BECAUSE_C1_RESISTED_C2S_MAGIC).addName(target)).addName(attacker); attacker.sendPacket(msg); target.sendPacket(msg); } } if ((damage > 1.0D) && (Rnd.chance(target.calcStat(Stats.M_SKILL_EVASION, 0.0D, attacker, skill)))) { attacker.sendPacket(new SystemMessage2(SystemMsg.C1S_ATTACK_WENT_ASTRAY).addName(attacker)); target.sendPacket(((SystemMessage2)new SystemMessage2(SystemMsg.C1_HAS_EVADED_C2S_ATTACK).addName(target)).addName(attacker)); damage = 0.0D; } if (damage > 0.0D) { attacker.displayGiveDamageMessage(target, (int)damage, crit, false, false, true); } if (calcCastBreak(target, crit)) { target.abortCast(false, true); } return damage; } |