DetermineMastery ( )

This function is used throughout the program to determine a character's mastery of a skill.  This is used to compute how far he can throw a dagger, how much damage an attack will produce, etc.

The skills are the four obvious skills:  Fighter, Ninja, Wizzard, and Priest.  And there are four hidden sub-skills for each of these.    Each skill has a value associated with it called 'Experience', a number that grows larger every time the skill is exercised.  There is a temporary adjustment to each skill that is increased by such things as potions.  And, lastly, there are objects in the dungeon which, when properly carried, affect the mastery of several of the skills.

The skill numbers ( and their sub-skill numbers ) are:
0 - Fighter ( 4, 5, 6, 7 )
1 - Ninja ( 8, 9, 10, 11 )
2 - Priest  ( 12, 13, 14, 15 )
3 - Wizard ( 16, 17, 18, 19 )

The mastery of a skill is computed as follows:
  1. If the Party is sleeping then the mastery is 1.  Very low.
  2. The experience for the skill is used to determine the basic mastery:  If the skill is a 'sub-skill', then the experience is the average of the experience for the skill and the experience for the related major skill.  Then the fowllowing table is used to determine the mastery.
    experience
    mastery
    0
    1
    500
    2
    1000
    3
    2000
    4
    4000
    5
    8000
    6
    16000
    7
    32000
    8
    64000
    9
    128000
    10
    256000
    11
    512000
    12
    1024000
    13
    2048000
    14
    4096000
    15
    8182000
    16
  3. The mastery is then adjusted for objects the character is using.
    skill
    object
    location
    increment
    any
    Firestaff_a
    weapon hand
    2
    any
    Firestaff_b
    weapon hand
    2
    Wizard
    Pendant Feral
    neck
    1
    15
    Ekkhard Cross
    neck
    1
    13
    Gem of Ages
    neck
    1
    13
    Sceptre of Lyfe
    weapon hand
    1
    14
    Moonstone
    neck
    1