Code: Select all
Accuracy_Rating = Fix(SquareRootOF(CHAR_LEVEL))
Do While ((Accuracy_Rating + 1) * (Accuracy_Rating + 1)) <= CHAR_LEVEL
Accuracy_Rating = Accuracy_Rating + 1
Loop
//note that CombatLevel in the game is stored +2 from what players see.
//e.g. Combat-1 is stored as 3 in the game, so (nCombatLevel - 1) below would result in a 2 for combat-1
Accuracy_Rating = Accuracy_Rating * (nCombatLevel - 1)
Accuracy_Rating = (Accuracy_Rating + (nCombatLevel * 2) + Fix(CHAR_LEVEL / 2) - 2) * 2
Accuracy_Rating = Accuracy_Rating + Fix((CHAR_STRENGTH - 50) / 3)
Accuracy_Rating = Accuracy_Rating + Fix((CHAR_AGILITY - 50) / 6)
//ACCURACY_FROM_WORN_ITEMS = Total Accuracy from the dedicated accuracy field on all equipped items
If ACCURACY_FROM_WORN_ITEMS = 0 Then ACCURACY_FROM_WORN_ITEMS = 1
//If encumbrance < 33% then +12 to +15 accy (32% == +12, 0% == +15)
nTemp = Fix((CURRENT_ENCUM / MAX_ENCUM) * 100)
If nTemp < 33 Then
nTemp = 15 - Fix(nTemp / 10)
ACCURACY_FROM_WORN_ITEMS = ACCURACY_FROM_WORN_ITEMS + nTemp
End If
//this is just how it's calculated in the mmud code (and would make the previous bonus +1 void IF encumbrance is >= 33 becase fix(1/2)=0)
ACCURACY_FROM_WORN_ITEMS = (Fix(ACCURACY_FROM_WORN_ITEMS / 2) * 2)
Accuracy_Rating = Accuracy_Rating + ACCURACY_FROM_WORN_ITEMS
Accuracy_Rating = Accuracy_Rating + MAXIMUM_SINGLE_VALUE_FROM_ABILITY22
If FRONTRANK then Accuracy_Rating = Accuracy_Rating + 5
If BACKRANK then Accuracy_Rating = Accuracy_Rating - 10
If BLIND then Accuracy_Rating = Accuracy_Rating - 10
//that LOOKS like it probably is when knocked down, stunned, or something of that effect
If SOME_MOVEMENT_THING then Accuracy_Rating = IIF(Accuracy_Rating >= 35, Accuracy_Rating - 35, 0)
A note on Accuracy from Ability 22 (MAXIMUM_SINGLE_VALUE_FROM_ABILITY22 in the code above):
From my testing, only the highest +Accuracy from ability 22 globally actually counts towards accuracy.
(Worn) items have a dedicated accuracy field. Those fields always count. However, those same worn items as well as classes, races, and especially Spells via blesses/auras provide +Accuracy boosts via ability 22. Quests can also directly provide permanent +accuracy to a character's ability table.
Only the max +Accuracy from ability 22 from any single slot from one of those sources counts towards the accuracy rating in game. So if you have 20 items with +2 accuracy (from abil 22), but your class has +10 accuracy, then you have +10 accuracy added to the accuracy rating.
There are also two other accuracy abilities, that I do see used very sparingly, but I have not tested those.