# PlayerAttributes

This document details how player stats are used in the game, as of August 27, 1998. This is prior to the Liberation game update.

## MIGHT:

### Player

- TryAttack: Base damage is calculated by sending FindDamage to the stroke object. One parameter is the character's might. Stroke objects are brawling, slash, or spells.
- GetBulkMax: Players can hold an additional 20 bulk for every point of might.
- GetWeightMax: Players can hold an additional 20 weight for every point of might.

### skill/profic/brawling

- Might is the requisite stat and sets initial value of skill.

### skill/profic/profhamr

- Might is the requisite stat and sets initial value of skill.

### skill/profic/profmace

- Might is the requisite stat and sets initial value of skill.

### skill/stroke

- DamageFactors: Damage is increased by (2 * might) percent.

### skill/stroke/unarmed

- FindDamage: 1/12 of might is added to damage value.
- DamageFactors: Damage is multiplied by (might-20) before being divided by 20.

## INTELLECT:

### Player

- ActivateSpellAtrophy: Spells (and skills) have less chance of atrophy with higher intellect. The code gives a the player (50-Intellect)/20 advancement points when checking atrophy. More advancement points means a greater chance of atrophy.
- PlayerCanLearn: More intellect means faster spell learning.
- GetInitialChance: Player gets a bonus (intellect/50)*100% bonus to chance to increase skill for initial check for advancement.

### spell

- GetDivisionReq: Is the requisite stat for Jala and Riija.
NOTE: This function is not called anywhere else.

### spell/illwound

- Take less damage with higher intellect.

## STAMINA:

### Player

- CalculateHealthTime: Modifies healing time by (25-stamina)% (+/- 25%)
- GainBaseMaxHealth: Maximum hps = 100 + stamina
- AdvancementCheck: Higher stamina makes gaining hps more likely when checked. (see below)
- Killed: Players have a stamina percent chance to avoid losing skill/spell points when killed.
- GetRestTime: A player's time between rest "checks" is 30 * (51-Stamina) milliseconds plus the current base of 1000.

### active/logghost

- InflictPenalties: Stamina percent less points lost due to logoff penalties.

## AGILITY:

### Player

- GetDefense: Provides 1/5 of the defense of a player (other 4/5ths: armor and 1/2 each of dodge/parry/block)

### skill

- Default requisite stat for skills.
NOTE: Axe Wielding has this as its requisite stat; it should probably be might-based instead.

### spell

- GetDivisionReq: Is the requisite stat for Kraanan and Weaponcraft.
NOTE: This function is not called anywhere else.

## MYSTICISM:

### Player

- TryAttack: 4/5ths of Mysticism is part of attack power for spells which improves to-hit chance.
- CalculateManaTime: Mysticism modifies base mana regen time by [(25-mysticism)/10] seconds (+/- 2.5 sec) (This time is the time to regenerate all mana.)
- InitialMaxMana: Starting max mana is 15 + (mysticism/5)

### active/corpnode (AKA underworld node)

- GetManaAdjust: This node adds 6 + (mysticism/10) points of maximum mana.

### item/passite/wand/vampwand

- CastSpell: (Myst + Aim) bound to 10 to 90 is percent chance to hit with wand.

### item/passite/wand/firewand

- CastSpell: (Myst + Aim) bound to 10 to 90 is percent chance to hit with wand.

### passive/mananode

- GetManaAdjust: Nodes gives 6 + (mysticism/10) points of maximum mana.

### spell

- GetRequisiteStat: Default requisite stat for spells.
- GetDivisionReq: Is the requisite stat for Qor, Shal'ille and Faren.
NOTE: This function is not called anywhere else.

## AIM:

### Player

- TryAttack: Aim is about 1/4 of attack power for weapon attacks. Increases chance to hit.

### item/passite/wand/vampwand

- CastSpell: (Myst + Aim) bound to 10 to 90 is percent chance to hit with wand.

### item/passite/wand/firewand

- CastSpell: (Myst + Aim) bound to 10 to 90 is percent chance to hit with wand.

### skill/profic/archery

- Aim is the requisite stat and sets initial value of skill.

### skill/profic/profswrd

- Aim is the requisite stat and sets initial value of skill.

### skill/stroke/fire

- Aim is the requisite stat and sets initial value of skill.

## How spell/skill advancement works:

To learn a level x spell, look at top 3 spells of level x - 1. Compare the sum of the ability in those three spells against: 105 [base] + (50-intellect)*3/5 + for each spell/skill not in the same school: {[same division] 1 + skill/((int/2) + 25) [bound between 1,10] {[diff division] 2 * (1 + skill/((int/2) + 25)) [bound between 1,10] NOTE: you can always learn a level x spell if you know a level x + 1 spell.

Example: Take a player with a 30 intellect. This gives them (50-30)*3/5 = 12 points of penalty, giving them a base of 117 points needed before calculating spells. Since the max points you can have is 297, this means you have 180 points to split between spells/skills. Since each other spell/skill at 99% in a different division gives you 6 points, this means you can have 30 other spells that high in ability before learning a new spell becomes impossible.

Note that if we have our spells/skills at 89% or below, each spell only gives 4 points to work against, instead of 6. This means we can have 150% the number of spells outside the division, or about 45.

Suggestions: Have each spell be a constant number, modified by Intellect (IE, no longer dependant on level of ability). Also, have base be dependant on level you want to learn (EG, use (level-1) as multiplier for a base, so level 3 spells require twice as much for a base as a level 2 spell does).

## How hp advancement works:

You gain points by killing creatures. The code uses the killed creature's level, which indicates their max hps.

Killing something with hps above yours gives you a chance to roll to gain an hp. Taking damange from it is worth 1 point, and doing the killing blow is worth one point. Being a newbie under 26 hps gives a (100/(max hps - 19))% chance for a bonus point.

Killing something with up to 5 less hps than you doesn't give you a chance, but gives a bonus point of you took damage and got the killing blow.

Killing something with fewer hps than that gives nothing (the "spit" message).

If you get an improvement roll, then it chooses a number based on your current hps and your stamina. It takes (100-stamina)% of your max hps (called the "index") and chooses a number between 1 and 2*((index*index)+index) [((index+1)*(index/2))*2 in code]. It compares this random number to the number of points you've gained so far plus a one-time bonus of the difference between the monster's hps and your hps divided by 5, bound between 0 and 10. If the random number is greater, you get a hp. Your points are then reset to negative half your current maximum hps, less an additional (50-stamina)/2 (EG, a 50 hp person with a 30 stamina would be set to -35 points).

## How you hit with attacks:

Attack power is your stroke proficiency level (0-99), + 2/5ths your weapon proficiency (0-100), + your aim (1-50). This gives your raw to-hit ability. Note that twice your Mysticism is your "weapon proficiency" for touch spells. Weapons and other items can add to the to-hit chance. This number is multiplied by 100 then divided by the quantity of itself plus the target's defense, to give the percent chance to hit.

A player's defense is determined by the sum of 1/2 of their block, parry, and dodge skills, plus agility, plus armor (which should have a max of 50).

## How skills work:

Your percent chance to succeed is figured by the following formula: ((100-requisite stat)*ability/100) + requisite stat Which means it takes 50%-99% (depending on your requisite stat) of your skill plus your requisite stat. So, people with high stats are naturals at the beginning, but are just as good as anyone else at higher levels..

Example: A player with a 10, a 30 and a 50 in the requisite stat try using skills at 20%, 50%, and 90%. The first player has a 29%, 55%, and 91% chance, respectively. The second player has a 44%, 65%, and 93% chance, respectively. The last player has a 60%, 75%, and 95% chance, respectively.

## How spells work:

Your percent chance is figured similar to skills, but with a much better chance. Your percent chance is 50 + half of your spell power, bound between 1 and 95.

## How skills/spells improve:

Initial check is against "chance to learn", with a bonus(intellect/50)*100% added on again. So, if you have 50 intellect, you have double the chance to learn. If this check fails, you can't advance.

Next, is the secondary check, which is figured as follows: 60 + requisite stat - (10 * level of skill) - (sum of ability points in other schools / 50). This is modified by a "factor" which is figured from 2 * target's difficulty (or 60 if the target wasn't a monster) - ability in skill + (sum of ability points in school / 10). This is bound between 50 and 100, and determines what percent of the check's points to use. (IE, a factor of 80 means you get 80% of the check's percent). Finally, if your current ability is greater than or equal to twice the requisite stat, your total is divided by 5 (the infamous soft cap).

This secondary chance is divided by 20 if the room is "hard" to learn in. The final number is bound between 1 + (your requisite stat / 10) and 99, then compared to a random number 0-100. If the random number is less, you gain a point.

Example: if someone with a Might of 35 and an Intellect of 30 killed a monster with a difficulty of 70 with a level 2 skill with ability 60% and a chance to learn of 20 in a normal room. This player also has 300 points in other schools and 200 points in this skill's school. First, we make a check for our chance to learn. We check vs. 20 + (30% of 20) = 26%. Assuming this check succeeds, we proceed on. Our base for the secondary check is 60 + 35 - (2 * 10) - (300 / 50) = 69%. Our factor is (2 * 70) - 60 + (200 / 10) = 100. This number is not affected by the bounding, so we take 100% of our 69%. Since we're not in a hard room, we take the full percent. If this check succeeds, we increase a point in our skill!

So, advancing in a skill depends on requisite stat, intellect, the skill's level, how many total ability points in other schools, the difficulty of what one killed to increase, their ability in the skill, and total ability points in the skill's school.