Esempio n. 1
0
  /**
   * Calculates DODGE chance
   *
   * @param attacker
   * @param attacked
   * @param accMod
   * @return int
   */
  public static int calculatePhysicalDodgeRate(Creature attacker, Creature attacked, int accMod) {
    // check attack status = BLIND
    if (attacker.getObserveController().checkAttackerStatus(AttackStatus.DODGE)) return 100;
    if (attacker.getEffectController().isAbnormalSet(EffectId.BLIND)) return 100;
    if (attacker.getEffectController().isAbnormalSet(EffectId.BLIND)) return 100;
    int accurancy;

    if (attacker instanceof Player
        && ((Player) attacker).getEquipment().getSubHandWeaponType() != null)
      accurancy =
          Math.round(
              (attacker.getGameStats().getCurrentStat(StatEnum.MAIN_HAND_ACCURACY)
                      + attacker.getGameStats().getCurrentStat(StatEnum.SUB_HAND_ACCURACY))
                  / 2);
    else accurancy = attacker.getGameStats().getCurrentStat(StatEnum.MAIN_HAND_ACCURACY);

    // add bonus stat from effecttemplate
    accurancy += accMod;

    int dodgeRate = (attacked.getGameStats().getCurrentStat(StatEnum.EVASION) - accurancy) / 10;

    // maximal dodge rate
    if (dodgeRate > 30) dodgeRate = 30;

    if (dodgeRate <= 0) return 1;

    return dodgeRate;
  }
Esempio n. 2
0
 @Override
 public void startEffect(Effect effect) {
   final Creature effected = effect.getEffected();
   effected.getController().cancelCurrentSkill();
   effect.setAbnormal(EffectId.STUMBLE.getEffectId());
   effected.getEffectController().setAbnormal(EffectId.STUMBLE.getEffectId());
   PacketSendUtility.broadcastPacketAndReceive(
       effected, new SM_FORCED_MOVE(effect.getEffector(), effected));
 }
  @Override
  public void applyEffect(Effect effect) {
    super.applyEffect(effect);

    Creature effected = effect.getEffected();
    Effect placedSignet = effected.getEffectController().getAnormalEffect(signet);
    int nextSignetlvl = 1;
    if (placedSignet != null) {
      nextSignetlvl = placedSignet.getSkillId() - this.signetid + 2;
      if (nextSignetlvl > signetlvl || nextSignetlvl > 5) return;
      placedSignet.endEffect();
    }

    SkillTemplate template = DataManager.SKILL_DATA.getSkillTemplate(signetid + nextSignetlvl - 1);
    int effectsDuration = template.getEffectsDuration();
    Effect newEffect =
        new Effect(
            effect.getEffector(), effect.getEffected(), template, nextSignetlvl, effectsDuration);
    newEffect.initialize();
    newEffect.applyEffect();
  }