# Formulas

This page contains a collection of formulas used by some of the other pages on this site. There is no guarantee that these formulas are exactly those that the mud uses, but they seem to work nicely within the limits given by computations being made in different ways and orders and by storing the numbers involved in different formats.

### Skill Bonuses

The mud computes the Skill Bonus for a skill as the product of the Raw Level Bonus function R (depending only on the skill level) and the Stat Multiplicator function M (depending only on the values (a,b,c,d,e) of the stats used by the skill):

Bonus( level, (a,b,c,d,e) ) = RoundDown( M(a,b,c,d,e) * R(level) )

For expample, the bonus a character with Intelligence 12 and Wisdom 18 would get for level 100 in a skill that uses Intelligence twice and Wisdom thrice (like adventuring.perception) can be computed as:

Bonus( 100, (12,12,18,18,18) ) = RoundDown( M(12,12,18,18,18) * R(100) )

For the Raw Level Bonus function R, levels 1 to 20 give 5 bonus points per level, levels 21 to 40 give 2.5 bonus points per level, levels 41 to 60 give 1 bonus point per level. Higher levels give 0.5 additional bonus points each:

for levels from  0 to 20:  R(level) =            5   *  level
for levels from 21 to 40:  R(level) = RoundDown (2.5 * (level-20) + 100)
for levels from 41 to 60:  R(level) =            1   * (level-40) + 150
for levels from 61      :  R(level) = RoundDown (0.5 * (level-60) + 170)

So starting with level 61, the Base Level Bonus - and thus the overall skill bonus - can only increase on even levels.

Finally, the Stat Multiplicator function M depends on the product (and thus the geometric average) of the stat values given, and can be computed by:

M(a,b,c,d,e) = ( 1/9.8 ) * ln( a*b*c*d*e ) - 0.25

The adventuring.perception bonus of a character with level 100 in that skill, Intelligence 12 and Wisdom 18 is thus:

Bonus( 100, (12,12,18,18,18) )
= RoundDown( M(12,12,18,18,18) * R(100) )
= RoundDown( 1.14... * 190 ) = 216

### Watch

The adventuring.perception bonus while watching is computed quite like the standard adventuring.perception bonus, but with an increased skill level and an additional 10 bonus points added on top of that. Using the Skill Bonus function defined above, the formulas for the different levels of watching are:

watch low:     Bonus( RoundDown( (  9 * level) / 8), (i,i,w,w,w) ) + 10
watch medium:  Bonus( RoundDown( ( 10 * level) / 8), (i,i,w,w,w) ) + 10
watch high:    Bonus( RoundDown( ( 11 * level) / 8), (i,i,w,w,w) ) + 10

So the character mentioned above - with 100 levels of adventuring.perception, Intelligence 12 and Wisdom 18 - has a bonus of 247 in that skill when on 'watch high':

Bonus( RoundDown( ( 11 * 100) / 8), (12,12,18,18,18) ) + 10
= Bonus( 137, (12,12,18,18,18) ) + 10
= RoundDown( M(12,12,18,18,18) * R(137) ) + 10
= RoundDown( 1.14... * 208 ) + 10
= 237 + 10 = 247

Please note that unlike the standard skill bonus, the skill bonus when watching ignores any temporary increases to stat values (but still takes into account effects that reduce the stats involved).

### Regeneration

The hit point and guild point regeneration rates are computed from the Stat Multiplicators health-multiplicator and points-multiplicator also used in the calculation of the adventuring.health and the character's relevant *.points skill bonuses. Using these multiplicators, the regeneration rates are given by:

hp-regen = RoundDown( sqrt ( 200 * health-multiplicator ) - 10 )
gp-regen = RoundDown( sqrt ( 175 * points-multiplicator ) - 10 )

For a warrior with Constitution 14, Dexterity 12 and Strength 19 the calculation is thus as follows:

health-multiplicator = M(14,14,14,14,19) = 1.1276...
points-multiplicator = M(14,14,12,19,19) = 1.1430...

hp-regen = RoundDown( sqrt ( 200 * 1.1276... ) - 10 ) = 5
gp-regen = RoundDown( sqrt ( 175 * 1.1430... ) - 10 ) = 4

Increasing skills by advancing at a guild, teaching oneself, or learning from another player all cost experience. Advancing primary skills at the guild is always the cheapest option, followed by learning from another player. Teaching oneself is the most expensive option, but does not rely on primaries or the availability of experienced teachers.

The experience cost of advancing primary skills at a guild depends only on the skill level a character has attained in that skill. The cost of advanging by one level is then computed by:

xp-cost = RoundDown( 75 * RoundDown( level/3 + 1 ) * exp(level/150) )

The monetary cost of advancement can then be computed from the xp-cost via:

cost-in-dollars = RoundDown( xp-cost / 80 ) / 100

The cost of teaching oneself and learning from another player are calculated by the same formula

xp-cost = 500 + RoundDown ( (250+125*skill/teach) * level * exp(level/500) )

where level is the student's current level in the skill learned and skill is the bonus in that skill. When learning from another player, teach is that player's effective teaching bonus in that skill; when teaching oneself it is equal to skill. Please note that when teaching oneself several levels at a time, the teach value increases along with the skill value, so the quotient skill/teach is still 1.

In case of teaching somebody else, the teacher gains some experience, the exact amount for teaching a single level can be computed from the student's experience cost by

xp-gain-per-level = ( xp-cost-per-level ) ^ 0.8

or half of that in case the teaching check fails. When teaching several levels at the same time, the individual gains for the single levels are simply added up (and may then be halved due to a failed teaching check).