Rarity - Shrub74/ProjectGlorious GitHub Wiki

For anything which modifies occurring to chance, the rate of deviation from a standard will resemble the Normal distribution. As such, to calculate the deviance from the norm (defined as the player's current stat of an item or skill or some such), an item's stat deviation will resemble the value of a square root function. This will make the chance lower at extreme values while still allowing for them.

eg. Player acquires new weapon. The current weapon has stats:

  • Sharpness 3
  • Power 4
  • Speed 3

No deviation would mean the new weapon has identical stats. The process is as follows:

  • Current resembling item is analyzed and stats stored
  • The deviation for each stat is then calculated based on a random number.
  • This number is put through the loot formula, a root function.
  • The result is then added or subtracted from the current weapon's stat.
  • The weapon is created with the new stats.

In this case, for Sharpness, set bounds to be between 0 and 4. Therefore there can only be a deviation between -2 and 2. Of course, the actually bounds should be much higher. Perhaps a 4th root would be better.