
\chapter{Skills System}\index{skills}\index{experience}\label{chap:skills}

\section{Description}\index{skills, description}

Under the skills system the flow of play changes
dramatically\footnote{The skills system is enabled as the default option
as of version
0.92.0}$^{, }$\footnote{The new skills/experience system is compatible
with character files from at least version 0.91.1 onward.}.
Instead of gaining experience for basically just killing monsters (and disarming
traps) players will now gain a variety of experience through the use
of skills. Some skills replicate old functions in the game (e.g. melee
weapons skill, missile weapon skill) while others add new functionality
(e.g. stealing, hiding, writing, etc).  A complete list of the available
skills can be found in table \ref{tab:skill_stats}. Appendix \ref{app:skills}
contains descriptions for many of the skills.

\begin{table}
\begin{center}
\caption{Skills \label{tab:skill_stats}}\index{skills, list}\index{skills, associated}
\index{experience, categories}
\index{skills, miscellaneous}
\small
\vskip 12pt
\begin{tabular}{|clccccc|} \hline
 & Skill & Experience Category & \multicolumn{3}{c}{Associated Stats} & \\
 & & & (Stat 1) & (Stat 2) & (Stat 3) & \\ \hline\hline
 & & & & & & \\
\input{skill_stat}
 & & & & & & \\
\hline
\end{tabular}
\end{center}
\end{table}


\section{About experience and skills}\index{skills,
gaining experience}\index{experience}

\subsection{Associated and miscellaneous skills}
\index{skills, associated}\index{skills, miscellaneous}

In \cf\ two types of skills exist; The first kind, ``associated''
skills, are those skills which are {\em associated with a category of
experience}.  The other kind of skill, ``miscellaneous'' skills,
are {\em not} related to any experience category.

The main difference between these two kinds of skills is in the
result of their use.
When associated skills are used {\em successfully} experience is
accrued in the experience category {\em associated with that skill}.
In contrast, the use of miscellaneous skills {\em never} gains
the player any experience regardless of the success in using it.

{\em Both} miscellaneous and associated skills can {\em fail}. This means
that the attempt to use the skill was unsuccessful. {\em Both}
miscellaneous and associated skills {\em can} have certain
primary stats {\em associated} with them. These associated stats can help
to determine if the use of a skill is successful and to what
{\em degree} it is successful.

All gained experience is modified by the associated
stats for that skill (table \ref{tab:skill_stats}) and then the
appropriate experience category automatically updated as needed.

\subsection{Restrictions on skills use and gaining experience}
\index{skills, restrictions}

Neither a character's stats nor the character class restricts the
player from gaining experience in any of the experience
categories. Also, there are no inherent
restrictions on character skill use$-$any player may
use any {\em acquired} skill.

\subsection{Algorithm for Experience Gain under the skills system}

Here we take the view that a player must 'overcome an opponent'
in order to gain experience. Examples include foes killed in combat,
finding/disarming a trap, stealing from some being, identifying
an object, etc.

Gained experience is based primarily on the difference in levels
between 'opponents', experience point value of a ``vanquished foe'',
the values of the associated stats of the skill being used and
two factors that are set internally\footnote{If you want to
know more about this, check out the skills\_developers.doc}.

Below the algorithm for experience gain is given where player ``pl''
that has ``vanquished'' opponent ``op'' using skill ``sk'':
\begin{quote}
EXP GAIN = (EXP$_{op}$ + EXP$_{sk}$) * lvl\_mul
\end{quote}
where EXP$_{sk}$ is a constant award based on the skill used,
EXP$_{op}$ is the base experience award for `op' which depends
on what op is (see below),

\noindent{For} level$_{pl}$ $<$ level$_{op}$::
\begin{quote}
lvl\_mult = FACTOR$_{sk}$ * (level$_{op}$ - level$_{pl}$)
\end{quote}
\noindent{For} level$_{pl}$ $=$ level$_{op}$::
\begin{quote}
lvl\_mult = FACTOR$_{sk}$
\end{quote}
\noindent{For} level$_{pl}$ $>$ level$_{op}$::
\begin{quote}
lvl\_mult = (level$_{op}/$level$_{pl}$);
\end{quote}
where level$_{op}$ is the level of `op', level$_{pl}$ is the level
of the player, and FACTOR$_{sk}$ is an internal factor based on
the skill used by pl.

There are three different cases for how EXP$_{op}$ can be computed:
\begin{quote}
1) {\bf op is a living creature}: EXP$_{op}$ is just the base
experience award given in the \spoiler . \\

2) {\bf op is a trap}: EXP$_{op} \propto$ 1/(the time for which the
trap is visible). Thus, traps which are highly {\em visible} get {\em lower}
values. \\

3) {\bf op is not a trap but is non-living}: EXP$_{op}$ = internal
experience award of the item. Also, the lvl\_mult is multiplied by
any {\tt magic} enchantment on the item.
\end{quote}

\section{How skills are used}\index{skills, how to use}

\begin{table}
\small
\caption{Skills commands}\label{tab:skill_cmd}
\vskip 12pt
\begin{center}
\begin{tabular}{|cllc|} \hline
 & & & \\
 & {\tt skills} & 	This command lists all the player's & \\
 &		& current known skills, their level & \\
 &		& of use and the associated experience & \\
 &		& category of each skill. & \\
 & & & \\
 & {\tt ready\_skill $<$skill$>$} 	& This command changes the player's & \\
  &				& current readied skill to {\tt $<$skill$>$}. &  \\
 & & & \\
 & {\tt use\_skill $<$skill$>$ $<$string$>$}  & This command changes the player's & \\
 &				& current readied skill {\em and} then & \\
  & 				& executes it in the facing direction & \\
 &				& of the player. Similar in action to & \\
 &				& the {\tt invoke} command. & \\
 & & & \\ \hline
\end{tabular}
\end{center}
\end{table}

Three player commands are related to skills use: {\tt ready\_skill},
{\tt use\_skill}, and {\tt skills} (see table \ref{tab:skill_cmd}).
Generally, a player will use a skill by first readying the right one,
with the {\tt ready\_skill} command and then making a ranged ``attack'' to
activate the skill; using most skills is just like firing a wand or a
bow.  In a few cases however, a skill is be used just by having it
{\em readied}. For example, the {\tt mountaineer} skill allows
favorable movement though hilly terrain while it is readied.

To change to a new skill, a player can use either the
{\tt use\_skill} or {\tt ready\_skill} commands, but note that the use of
several common items can automatically change the player's current
skill too. Examples of this include readying a bow (which will cause the
code to make the player's current skill {\tt missile\_weapons}) or readying
a melee weapon (current skill auto-matically becomes {\tt melee weapons}).
Also, some player actions can cause a change in the current skill.
Running into a monster while you have a readied weapon in your inventory
causes the code to automatically make our current skill {\tt melee weapons}.
As another example of this$-$casting a spell will cause the code to
switch the current skill to {\tt \spellcasting} or {\tt praying} (as appropriate
to the spell type).

It is not possible to use more than one skill at a time.

\section{Acquiring skills}\index{skills, learning}\index{skills, tools}

Skills may be gained in two ways. In the first, new skills may {\em learned}.
This is done by reading a ``skill scroll'' and the process is very similar
to learning a spell. Just as in attempts to learn \incantation s, success in
learning skills is dependent on a random test based on the learner's INT.
Using your INT stat, look in the learn\% column in table \ref{tab:pri_eff}
to find your \% chance of learning a skill. Once you hit 100\% you will
always be successfull in learning new skills.

The acquisition of a {\em skill tool} will also allow the player to use
a new skill. An example of a skill tool is ``lockpicks''\inputimage{lockpicks}
(which allow the
player to pick door locks). The player merely applies the skill
tool in order to gain use of the new skill. If the tool is unapplied,
the player looses the use of the skill associated with the tool.

After a new skill is gained (either learned or if player has an applied
skill tool) it will appear on the player's skill roster (use the
'skills' command to view its status). If the new skill is an associated
skill, then it will automatically be gained at the player's current level
in the appropriate experience category. For example, Stilco the Wraith,
who is 5th level in {\tt agility}, buys a set of lockpicks and applies them.
He may now use the skill lockpicking at 5th level of ability since that
is an {\tt agility} associated skill.
