# Character Attack Formulas

### From Braindead's Mordor Site

m (Add 'Back' link.) |
(Replaced Strength with BSV in the calculation of StrMod1; cleared up the discussion about testing; ln stands for natural logarithm) |
||

Line 1: | Line 1: | ||

- | GLvl = Guild Level with best fighting ability, should be the same as the one in "Guild" Tab | + | The formula has been well tested and seems to be extremely close, barring possible issues with different rounding algorithms.<br> |

- | FightingMod = Value found in Help File / 10, ie Warrior = 1.2, Nomad = 0.7 | + | <br> |

+ | GLvl = Guild Level with best fighting ability, should be the same as the one in "Guild" Tab<br> | ||

+ | FightingMod = Value found in Help File / 10, ie Warrior = 1.2, Nomad = 0.7<br> | ||

Size = Range [0 to 5] or Very Small, Small, Normal, Big, Very Big, Huge<br> | Size = Range [0 to 5] or Very Small, Small, Normal, Big, Very Big, Huge<br> | ||

+ | Ln stands for natural logarithm.<br> | ||

+ | Rnd is a number ranging from 0 to 0.999.. (not 1, this is important because it produces different top values). | ||

<br> | <br> | ||

This is the Damage Modifier, a bit more complex than I expected really<br> | This is the Damage Modifier, a bit more complex than I expected really<br> | ||

Line 15: | Line 19: | ||

Let's get the Strength Modifier, it's actually 2 parts, and requires a new Strength Value (called BSV here)<br> | Let's get the Strength Modifier, it's actually 2 parts, and requires a new Strength Value (called BSV here)<br> | ||

BSV = Int(Strength - (LN(Strength) * ((LN(Strength) - 2,4) * 2,25))) + 1<br> | BSV = Int(Strength - (LN(Strength) * ((LN(Strength) - 2,4) * 2,25))) + 1<br> | ||

- | StrMod1 = Int((Rnd * (( | + | StrMod1 = Int((Rnd * ((BSV + 10) / 2)) + ((BSV + 10) / 4)) / 10<br> |

StrMod2 = BSV/30<br> | StrMod2 = BSV/30<br> | ||

Str 1 to 40 -> Value [0.3-0.8 * 0.06667] to [1-2.9 * 1] Note, this value is the 2 StrMods combined<br> | Str 1 to 40 -> Value [0.3-0.8 * 0.06667] to [1-2.9 * 1] Note, this value is the 2 StrMods combined<br> | ||

- | <br>Note that Grobblewobble has persuasively made the case that StrMod1 might be a function of BSV, rather than Strength, otherwise the combination of the two Strength modifiers would be partly outside the ranges stated above. | ||

<br> | <br> | ||

Line 35: | Line 38: | ||

if Atk < Def: 0.5 - 0.5 * (Def - Atk) / Def<br> | if Atk < Def: 0.5 - 0.5 * (Def - Atk) / Def<br> | ||

Since Monster Defense passed to this formula is 0, you should always have 97% chance to hit.<br> | Since Monster Defense passed to this formula is 0, you should always have 97% chance to hit.<br> | ||

- | <br> | ||

- | It looks good for low levels, but haven't tested with higher levels<br> | ||

- | Osiri Seeker, Lv 12, 22 Str, 134 Atk, Bronze Dagger<br> | ||

- | Damage: 6-17 + 1-16 = 7-33<br> | ||

- | One of my characters, damage seems about right, good enough to kill Level 1 Critters, but Level 2 ones are a bit messy.<br> | ||

- | <br> | ||

- | Giant Warrior, Lv 500, 40 Str, 400 Atk, WeaponMod 2<br> | ||

- | Damage: 66-192 + 1-50 = 67-242<br> | ||

- | A Crit: 139-403 + 1-50 = 140-453<br> | ||

- | Does this seem right?<br> | ||

- | <br> | ||

- | Another Note, couldn't distinguish between Log(x) and Ln(x), so values might be a little off.<br> | ||

- | I just tried all combinations and discarded the ones that gave negative damage or stuff like 200+ Dam for a Lv 5 Character etc<br> | ||

<br> | <br> | ||

[http://mordor.uni.cc/forum/index.php?showtopic=1207 Discuss this topic in the forum] | [http://mordor.uni.cc/forum/index.php?showtopic=1207 Discuss this topic in the forum] |

## Revision as of 21:51, 25 September 2009

The formula has been well tested and seems to be extremely close, barring possible issues with different rounding algorithms.

GLvl = Guild Level with best fighting ability, should be the same as the one in "Guild" Tab

FightingMod = Value found in Help File / 10, ie Warrior = 1.2, Nomad = 0.7

Size = Range [0 to 5] or Very Small, Small, Normal, Big, Very Big, Huge

Ln stands for natural logarithm.

Rnd is a number ranging from 0 to 0.999.. (not 1, this is important because it produces different top values).

This is the Damage Modifier, a bit more complex than I expected really

1: DamMod = 0.6 + (((Ln(100 + GLvl) / 1.75) - 2.3) * FightingMod^2 / 2)

2: * WeaponModifier

3: + 5 if Critical Hit, Chance of doing a Crit is 1-50% if character can Crit

4: + 2 if Backstab, Chance of Backstabbing is 1-75% if character can Backstab

5: / 2 if Monster is invisible and character can't see invisible

6: +0.1/-0.1 per size bigger/smaller than monster

7: if DamMod is > 1, then DamMod = DamMod - ln(DamMod)^2

Value 0.1 to 7ish (Lv 999 Human Warrior with a Mod 2.6 Weapon, severing a Tiny monster)

Let's get the Strength Modifier, it's actually 2 parts, and requires a new Strength Value (called BSV here)

BSV = Int(Strength - (LN(Strength) * ((LN(Strength) - 2,4) * 2,25))) + 1

StrMod1 = Int((Rnd * ((BSV + 10) / 2)) + ((BSV + 10) / 4)) / 10

StrMod2 = BSV/30

Str 1 to 40 -> Value [0.3-0.8 * 0.06667] to [1-2.9 * 1] Note, this value is the 2 StrMods combined

And last part of formula, Level Modifier.

LvlMod = (Ln(GLvl + 5) + 1) / Ln(1.2)

Lvl 1 to 999 -> Value 15.31228 to 43.39447

Base Damage = LvlMod * StrMod1 * StrMod2 * DamMod

Final Damage = Base - Rnd[1 to (Def-Atk)/8] or very close to this

Defense bug lurks though, so it's just:

Final Damage = Base + Rnd[1 to Atk/8]

Chance to Hit Formula in percent, range [1 to 97]

if Atk = 0 and Def = 0: 50

if Atk > Def: 0.5 + 0.5 * (Atk - Def) / Atk

if Atk < Def: 0.5 - 0.5 * (Def - Atk) / Def

Since Monster Defense passed to this formula is 0, you should always have 97% chance to hit.

Discuss this topic in the forum