How Random Item Stats Are Computed

A Treat for Written Realms Stat Junkies
Jun 16 2024

Let's demystify how the stats on randomly generated chosen items get picked, and what their range is. This post is going to be a lot of numbers and arithmetic, but I know some players are into that and I am not one to kink shame.

Item Budget

First, a budget for the item that is going to be generated is determined. The formula for that is ceiling(slot_value * ILF * 20). Refer to the formulas documtation for more information on ILF. If the item is enchanted, the budget is increased by 20% and the ceiling of that value is taken as well. The slot_value variable is:

  • 2-handed weapons: 2.5
  • 1-handed weapons, shields, head / body / leg armor: 1.25
  • everything else: 1

For example, let's calculate for the budget for a level 20 enchanted body armor piece: 30.7 * 1.25 * 20 * 1.2 = 921 budget points.

Attribute Cost

The other significant data point is the attribute cost. Different attributes will eat up a certain amount of budget in order to be rolled on an item. Here are those values:

  • hp regen / mana regen: 40 points
  • con / str / dex / int: 10 points
  • max hp / max mana / ap / sp / crit / resilience / dodge: 4 points.

If an item has 400 budget points, it could be spent as 10 hp regen, 40 con or 100 crit in terms of budget cost.

Main Primary Stat and Excluded Stats

Now let's break down how items get made. First, a main primary stat is picked. Primary stats are Str, Int, Con and Dex. If you have a crafter make an item or you, or complete quest that rewards with a random item, then a main primary stat will be picked based on your archetype. Strength for Warriors, Dexterity for Assassins, and Intelligence for Clerics and Mages. If a mob is loaded with a random item at creation then the primary stat could be any of them since at that point we have no concept of who the random item "is for".

In addition, if the item is being crafted for a particular player's archetype, certain stats get excluded from the pool of possible stats:

  • Warriors and Assassins will exclude int, max mana, mana regen and spell power
  • Clerics and Mages will exclude dodge, attack power and dexterity

If an item is loaded on a mob, nothing is excluded and one of the 4 primary stats will be randomly chosen as the main stat.

Generation Algorithms

The algorithm then differs slightly for imbued and enchanted items.

Imbued Items

  1. Between 50% and 80% (randomly selected) of the budget is spent on the main stat, for example Str.
  2. The remainder of the budget is spent on another random stat, for example Crit. It is possible for the same stat as the one chosen in step 1 to be re-picked, in case of which it's compounded to the stat generated in step 1.

Enchanted Items

  1. Between 40% and 60% (randomly selected) of the budget is spent on the main stat.
  2. Between 50% and 60% (randomly selected) of the leftover budget following step 1 is spent on a random primary stat, which could be any of the 4.
  3. The remainder of the budget is spent on another random stat, which could be on another random stat (as with step 2) of imbued item generation, it could be anything as long as it's not excluded).

Variance

Finally, for both imbued and enchanted items, a +/- 16% variance is applied to each generated stat and rounded.

Examples

Let's run through a couple example of random generation to illustrate all this. We'll assume no variance for any of these to keep the math simpler.

Level 17 imbued 2-handed weapon being generated by a warrior

The budget for this item is ILF(17) * slot_value(2H weapon) * 20 = 27.3 * 2.5 * 20 = 1365

  1. Let's assume step 1 allocates 60% of the budget to the main stat, which is Strength. We get budget * 0.6 / attribute_cost = 1365 * 0.6 / 10 = 81.9 which rounds to 82. We've used 82 * 10 = 820 budget points so far, leaving 545 leftover points to spend.
  2. Step 2 then might randomly pick Dodge, which has an attribute cost of 4 and would therefore generate 545 / 4 = 136 dodge rating.

The resulting weapon stats would be:

  • 83 Strength
  • 136 Dodge Rating

Level 20 Enchanted body armor being generated by a mage

The budget for this item is ILF(20) * slot_value(body) * 20 * 1.2 = 30.7 * 1.25 * 20 * 1.2 = 921

  1. Let's assume step 1 allocates 40% of the budget to the main stat, which is Int. Budget * 0.4 / attribute_cost = 921 * 0.4 / 10 = 37.24, which rounds to 37. We've used 37 * 10 = 370 budget points so far, leaving 551 points still to spend.
  2. Let's assume step 2 allocates 50% of the remaining budget and picks Con as the primary stat in that step. Budget * 0.5 / attribute_cost = 551 * 0.5 / 10 = 27.55, which rounds to 28. We used 28 * 10 = 280 budget points on this step and 370 on step 1, leaving 271 points for step 3.
  3. In step 3 let's randomly pick mana regen, which has an attribute cost of 40 and would therefore generate 271 / 40 = 6.7 mana regen, rounding to 7.

The resulting body armor stats would be:

  • 37 Intelligence
  • 28 Constitution
  • 7 Mana Regen

Corollaries

I sometimes get asked the question "What's the maximum stat amount that a piece of equipment can have." Let's use the above formulas to answer that for a couple scenarios.

How Much Str Can a Level 20 Enchanted Pair of Boots Have?

The budget for a level 20 enchanted pair of boots is 30.7 * 1 * 20 * 1.2 = 737 points. Let's assume the very best case scenario and that Str is picked at all 3 steps:

  1. 60% of the budget allocated to strength: 737 * 0.6 / 10 = 44 Str, leaving a 297 remainder budget
  2. 60% of the remaining budget also allocated to strength: 297 * 0.6 / 10 = 18 Str, leaving a 117 remainder budget
  3. 117 / 10 = 12 Str

Assuming the best possible variance of +16%, we'd end up with (44 + 18 + 12) * 1.16 = 86.

Note that one might be tempted instead of running through each step to just say let's take the budget, divide it by 10 (the attribute cost) and apply the max variance and call it a day. But notice that then we get (737 / 10 * 1.16) = 84.67, rounding to 85. We'd be 1 point short of the result we came up with above. This is due to how rounding math works out at each of the 3 steps - we can gain or lose a point here and there. If we were to take a 40% / 50% split for steps 1 and 2, we'd end up with 85 also, short a point as well. So how the algorithm plays out can make a small difference, but +/- a couple points, dividing the whole budget by the desired stat is a pretty good approximation. Note that if we were to take the whole budget and just divide it by 10

How Much HP Regen Can a 2-Handed Enchanted Weapon Have?

Since step 1 and 2 can only pick primary stats, HP regen can only be generated in step 3. Therefore to max out HP Regen, we want to pick the branches of the algorithm with the lowest possible allocation to the primary stats.

  • 2-handed enchanted weapon budget: 30.7 * 2.5 * 20 * 1.2 = 1842
  • Assume 40% allocation in step 1, the leftover budget would be 1105
  • Assume 50% allocation in step 2, the leftover budget would be 552
  • HP regen has an attribute cost of 40 so 552 / 40 = 13.8 which rounds to 14.

Finally, assuming a 16% variance gives us another 2 points and we end up with 16 HP regen, the maximum amount on a 2-handed enchanted weapon (before upgrades).

Which Stat Is Better for Pure Spell Power?

People will sometimes ask, what's better for a Mage or Cleric, Spell Power or Int? What's better for a Warrior, Str or Attack Power? Taking aside the fact that Str also gives Health and Crit for warriors and Int also gives Max Mana, we can use the attribute costs explained above to help shed some light on this frequent question.

Let's assume that a mage doesn't care how much total mana they have, they just want to do as much damage as possible with each attack. If they have a weapon with pure int and one with pure spell power, which is better?

Assuming a budget of 1000, and assuming that a weapon could only generate spell power - it can't, since steps 1 (and 2 for enchanted weapon) must pick a primary attribute as explained above but just for the sake of argument:

  • 1000 budget points to Int would generate 1000 / 10 = 100 Int, and since 1 Int = 2 SP, we'd get 200 Spell Power out of it.
  • 1000 budget points to Spell Power would generate 1000 / 4 = 250` Spell Power.

So if you're looking for pure damage and don't care about endurance, items high in Spell Power will give you more of that. If you want to be able to last in longer fights however, the mana provided by Int would certainly end up helping your long-term damage output.

This is generally true of the 4 primary stats for what they convert to. Going for the converted value will be better usage of your budget for that specific goal, but the primary stat will give you more overall spread-out value.

Imbued Items and Secondary Stats

Imbued items actually have greater potential than enchanted for min-maxing a secondary stat (as in, not Str, Int, Con or Dex). This is because for enchanted items, secondary stats can only be generated in step 3, at which point the maximum budget leftover would be 30% (assuming step 1 consumed 40% and step 2 50%, the least they could take up). By contrast, an imbued item could have 50% of the budget available for secondary stats. So while enchanted items will always have more stats overall, imbued items can end up with higher value secondary stats. For example, while a 2-handed enchanted weapon can only have up to 16 health regen, a 2-handed imbued weapon could have up to 23.

Item Upgrades

A quick note on upgraded items, each upgrade increases the stats of the items by 20%, and after the boost the ceiling value is taken. So for example if a chestplate with 6 hp regen is upgraded, the resulting piece of armor will have 8 hp regen, not 7.

Item Pricing

Finally, I wanted to include the formula for item pricing. How much does an item cost? The formula for that is:

cost = ILF * quality * slot_constant

Where quality is 3 for imbued and 5 for enchanted items.