Melee damage calculation in RO

August 25th, 2009 | Tags: Ragnarok Online, RO mechanics

While developing the calc I spent many hours trying to understand - why the values of damage I'm getting in my calc are different from the ones I'm getting in the game. All formulas taken from different guides like this one were checked many times and were correct, but the values still was not the same. With time I've finally got correct values. The biggest problem was in different ways of rounding intermediate values.

In the guide presented below I've tried to describe correct way of calculation melee damage in RO.

Mathematical functions used in this guide:

  • Floor(value) - round value down
  • Round(value) - mathematical round
  • Max(value1, value2) - returns maximum of value1 and value2
  • Min(value1, value2) - returns minimum of value1 and value2

  1. Calculate attack form stats

    ATK = STR + Round(Floor(STR/10) * Floor(STR/10)) + Floor(DEX/5) + Floor(LUCK/5)

  2. Add attack modifiers from equipment
    i.e. Zipper Bear Card (ATK+30), Picky Card (ATK+10), Ring of Flame Lord (ATK+15) etc.

    ATK = ATK + AttackModifier1 + AttackModifier2 .. + AttackModifierN

  3. Add weapon attack
    If attacking without weapon skip this and go to IV

    1. Calculate dex-based item

      DEX_ITEM = Min(WEAPON_ATK, Floor(DEX * (1 + (WEAPON_LVL-1) * 0.2)))

    2. Calculate minimum and maximum weapon danger refine bonuses (MIN_WEAPON_DANGER_REF_BONUS, MAX_WEAPON_DANGER_REF_BONUS)

      1. If no danger refine then minimum and maximum bonuses are 0.
      2. Else

        MIN_WEAPON_DANGER_REF_BONUS = 1
        MAX_WEAPON_DANGER_REF_BONUS = DANDER_REF_MPLIER * (REFINE_RATE + WEAPON_LVL - 8)

        Where:

        • WEAPON_LVL - the level of equiped weapon
        • REFINE_RATE - the total refine rate of the equiped weapon
        • DANDER_REF_MPLIER depends on WEAPON_LVL:
          • lvl 1 - MPLIER=3
          • lvl 2 - MPLIER=5
          • lvl 3 - MPLIER=8
          • lvl 4 - MPLIER=14
    3. Apply calculated values to attack.
      Note, that this is where damage value branches to minimum and maximum.

      MIN_DAMAGE = ATK + MIN_WEAPON_DANGER_REF_BONUS + Floor((DEX_ITEM + IMPOSITO_MANUS) * WEAPON_SIZE_MODIFIER)
      MAX_DAMAGE = ATK + MAX_WEAPON_DANGER_REF_BONUS + Floor((WEAPON_ATK - 1) + IMPOSITO_MANUS) * WEAPON_SIZE_MODIFIER)

      Where:

      • WEAPON_ATK - the attack rate fo the equipped weapon
      • WEAPON_SIZE_MODIFIER - weapon size modifier. It depends on weapon type and size of target. If damager has Weapon Perfection buff (Blacksmith), then WEAPON_SIZE_MODIFIER always equal to 1.
      • IMPOSITO_MANUS - Imposito Manus buff bonus = IMPOSITO_MANUS_LVL*5.
  4. Apply attack modifier buffs

    MIN_DAMAGE = Floor(MIN_DAMAGE * (BUFF_BONUS + 100) / 100)
    MAX_DAMAGE = Floor(MAX_DAMAGE * (BUFF_BONUS + 100) / 100)

    Where BUFF_BONUS is the bunus to attack from the buff in percents:

    • 100 for Gospel ATK+100%
    • 5 + 3 * (SKILL_LEVEL - 1) for Provoke
    • 5 for Power Thrust

    Note, that bonuses must be applied one by one, the order does not matter.

  5. Apply active skill attack modifier
    If attack is not a skill then skip this and go to VI
    If skill has some special conditions (i.e. Azura Strike) then this item and items below must be skipped and damage must be calculated according to skill's formula.
    This formula and formulas below valid only for attack-based skills with no special conditions (i.e. Sonic Blow, Bash, Tripple Blow, etc)

    MIN_DAMAGE = Floor(MIN_DAMAGE * SKILL_DAMAGE_MODIFIER / 100)
    MAX_DAMAGE = Floor(MAX_DAMAGE * SKILL_DAMAGE_MODIFIER / 100)

    Where SKILL_DAMAGE_MODIFIER in percents.
    I.e. for Sonic Blow SKILL_DAMAGE_MODIFIER = SKILL_LEVEL * 50 + 200

  6. Apply target's defence (hard def)

    MIN_DAMAGE = Floor(MIN_DAMAGE * (100-RESULT_DEF) / 100)
    MAX_DAMAGE = Floor(MIN_DAMAGE * (100-RESULT_DEF) / 100)

    Where RESULT_DEF is the value of basic def (from equipment) with different def modifiers applied. I.e:

    • Provoke casted on mob reduces its def as

      RESULT_DEF = DEF - Floor(DEF*(5 + 5*PROVOKE_SKILL_LEVEL)/100)

    • Freeze and Stone Curse statuses reduce def by half

      RESULT_DEF = DEF - Floor(DEF * 50/100)

    • Poison status reduces def by 25%

      RESULT_DEF = DEF - Floor(DEF * 25/100)

    • Gospel bonus Def+100% increases def by 100%

      RESULT_DEF = DEF * 2

  7. Apply target's vit defence (soft def)

    1. Calculate minimum and maximum vit def

      1. For players:

        VIT_DEF_MIN = Floor(VIT * 0.5) + Floor(VIT * 0.3)
        VIT_DEF_MAX = Floor(VIT * 0.5) + Max(Floor(VIT * 0.3), Floor((VIT * VIT)/150) - 1)

      2. For mobs:

        VIT_DEF_MIN = VIT
        VIT_DEF_MAX = Max(VIT, VIT + (Floor(this.v.Target.StatsVit/20) * Floor(this.v.Target.StatsVit/20)) - 1)

    2. Apply Vit def modifiers to the recieved values

      1. Angelus buff increases vit def:

        VIT_DEF_MIN = VIT_DEF_MIN + Floor(VIT_DEF_MIN * (5 * ANGELUS_SKILL_LEVEL) / 100)
        VIT_DEF_MAX = VIT_DEF_MAX + Floor(VIT_DEF_MAX * (5 * ANGELUS_SKILL_LEVEL) / 100)

      2. Provoke reduces vit def as

        VIT_DEF_MIN = VIT_DEF_MIN - Floor(VIT_DEF_MIN * (5 + 5 * PROVOKE_SKILL_LEVEL)/100)
        VIT_DEF_MAX = VIT_DEF_MAX - Floor(VIT_DEF_MAX * (5 + 5 * PROVOKE_SKILL_LEVEL)/100)

      3. Freeze and Stone Curse statuses on mob reduce its vit def by half

        VIT_DEF_MIN = Round(VIT_DEF_MIN * 0.5)
        VIT_DEF_MAX = Round(VIT_DEF_MAX * 0.5)

    3. Apply recieved values:

      MIN_DAMAGE = MIN_DAMAGE - MAX_VIT_DEF
      MAX_DAMAGE = MAX_DAMAGE - MIN_VIT_DEF

  8. Apply non-danger weapon refine bonus

    MIN_DAMAGE = MIN_DAMAGE + WEAPON_NONDANGER_REF_BONUS
    MAX_DAMAGE = MAX_DAMAGE + WEAPON_NONDANGER_REF_BONUS

    Where

    WEAPON_NONDANGER_REF_BONUS = MODIFIER * WEAPON_REFINE_RATE

    MODIFIER depends on level of equipped weapon:

    • lvl 1 - MODIFIER=2
    • lvl 2 - MODIFIER=3
    • lvl 3 - MODIFIER=5
    • lvl 4 - MODIFIER=7
  9. Apply Weapon Mastery Skill
    I.e. Mace Mastery, Katar Mastery, Knuckle mastery, etc

    MIN_DAMAGE = MIN_DAMAGE + MASTERY_BONUS
    MAX_DAMAGE = MAX_DAMAGE + MASTERY_BONUS

    Where MASTERY_BONUS usually is 3*MASTERY_SKILL_LEVEL

  10. Apply damage modifiers from skills

    MIN_DAMAGE = Floor(MIN_DAMAGE * (DAMAGE_MODIFIER / 100))
    MAX_DAMAGE = Floor(MAX_DAMAGE * (DAMAGE_MODIFIER / 100))

    Where DAMAGE_MODIFIER is:

    1. For Enchant Deadly Poison

      DAMAGE_MODIFIER = 150 + 50 * EDP_SKILL_LEVEL

    2. For Advanced Katar Mastery

      DAMAGE_MODIFIER = 110 + 2 * ADVANCED_KATAR_MASTERY_SKILL_LEVEL

    3. For Sonic Acceleration

      DAMAGE_MODIFIER = 110

    and so on.
    Note, that this bonuses, as always, must be applied not by their summ, but one by one.

  11. Apply different damage modifiers

    MIN_DAMAGE = Floor(MIN_DAMAGE * (100 + DAMAGE_MODIFIER) / 100)
    MAX_DAMAGE = Floor(MAX_DAMAGE * (100 + DAMAGE_MODIFIER) / 100)

    1. Race modifiers.
      i.e. Hydra Card gives race damage modifier 20 on demi-human race
    2. Size modifiers
      i.e. 2 Skeleton Worker Cards when hitting Medium-sized enemy give DAMAGE_MODIFIER=30
    3. Element modifiers
      i.e. 4 Drainliar Cards give DAMAGE_MODIFIER=80 on Water property target
    4. All damage modifiers
      i.e. Turtle General Card - DAMAGE_MODIFIER=20
  12. Apply different resist modifiers

    MIN_DAMAGE = Floor(MIN_DAMAGE * (100 - RESIST_MODIFIER) / 100)
    MAX_DAMAGE = Floor(MAX_DAMAGE * (100 - RESIST_MODIFIER) / 100)

    1. Race modifiers
      i.e. race RESIST_MODIFIER is 40 if Thara Frog Card and Feather Beret equipped
    2. Element damage modifiers
      i.e. Raydrick card
    3. Energy coat
      different values depending on target's sp. Maximum resist is 30
    4. Non-bosses damage modifiers
      Alice Card increases damage from non-bosses on 40%. RESIST_MODIFIER = -40
  13. Apply last damage modifiers

    MIN_DAMAGE = Floor(MIN_DAMAGE * WOE * TERNA * ASSUMPTIO)
    MAX_DAMAGE = Floor(MAX_DAMAGE * WOE * TERNA * ASSUMPTIO)

    Where

    • WOE is 0.6 for WoE mechanic and 1 for PvP/PvM mechanic
    • ASSUMPTIO is 0.666 if target has Assumptio buff and 1 otherwise
    • ERNA is 2 if target has Lex Aetherna, otherwise 1
  14. Apply element modifier

    MIN_DAMAGE = Floor(MIN_DAMAGE * ELEMENT_MODIFIER/100)
    MAX_DAMAGE = Floor(MAX_DAMAGE * ELEMENT_MODIFIER/100)

    Where ELEMENT_MODIFIER is percentage value of target's element and damager's weapon element.
    i.e. for Neutral element attack to Ghost 1 property target ELEMENT_MODIFIER is 25

  15. Apply Fiber Lock bonus
    If target is in Fiber Lock and damager's element is Fire, then

    MIN_DAMAGE = MIN_DAMAGE*2
    MAX_DAMAGE = MAX_DAMAGE*2

  16. Apply number of hits

    MIN_DAMAGE = Floor(MIN_DAMAGE / NUMBER_OF_HITS) * NUMBER_OF_HITS
    MAX_DAMAGE = Floor(MAX_DAMAGE / NUMBER_OF_HITS) * NUMBER_OF_HITS

    I.e. for Sonic Blow skill NUMBER_OF_HITS is 8, for Bash is 1

No comments yet.