コード例 #1
0
  @Override
  public int attackSkill(Char target) {

    int bonus = 0;
    for (Buff buff : buffs(RingOfAccuracy.Accuracy.class)) {
      bonus += ((RingOfAccuracy.Accuracy) buff).level;
    }
    float accuracy = (bonus == 0) ? 1 : (float) Math.pow(1.4, bonus);
    if (rangedWeapon != null && Level.distance(pos, target.pos) == 1) {
      accuracy *= 0.5f;
    }

    KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
    if (wep != null) {
      return (int) (attackSkill * accuracy * wep.acuracyFactor(this));
    } else {
      return (int) (attackSkill * accuracy);
    }
  }