L2-scripts Форум

L2-scripts Форум (http://l2-scripts.ru/forum/index.php)
-   Archive Lindvior, Ertheia, Odyssey, Undergeround, Helios, Grand Crusade (http://l2-scripts.ru/forum/forumdisplay.php?f=103)
-   -   Magical Evasion Not working (http://l2-scripts.ru/forum/showthread.php?t=4021)

boulanger 17.12.2013 15:54

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);
  }

there is also a part in code about magical skill evasion, but that also doesent depend at all on the magical accuracy or magical evasion , but only level difference as i see

Код:

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;
  }


iqman 10.01.2014 01:21

Give me the codes in skype please, closing this right now (handle by skype)


Часовой пояс GMT +4, время: 20:18.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd. Перевод: zCarot