                          The Spell Inheritable
                          written by Zaxan@Haven

This document details the different functions in the Nightmare IV LPC
Library's spell inheritable. This document is divided into
many sections. Each section explains a different type of function
in the lib inheritable.

Note that all spells inherit /lib/spell.c and include lib.h, magic.h, and
damage_types.h.

           ************************************************
                         Part 1: Set Functions
           ************************************************

static string SetSpell(string str);
This function defines the actual name of the spell. Players will use
this word to get help (help <spellname>), and to cast it (cast <spellname>).
Normally, it is named similar to the filename of the spell 
(/spells/spellname.c).

varargs static string array SetRules(mixed args...);
This function defines the syntax of how the spell may be cast. A different
rule will give different syntax for casting. Valid tokens for SetRules() 
are:

   OBJ 
     Any object 
   LIV 
     Any object returning 1 for the is_living()
     apply. Note that this has no relation
     whatsoever to the living() or livings() efuns. 
   WRD 
     Any single word in a command. Use this
     instead of STR wherever possible. 
   STR 
     Any serious of words not matching any
     other token. Use this as a last restort, as
     careless use of it can have it capturing
     things you do not want it to capture. 
   OBS 
     Any set of one or more objects 
   LVS 
     Any set of one or more objects returning 1
     for the is_living() apply. 

If you have a verb that supports OBS or LVS for a
token, there is no need to supply a OBJ or LIV
version that corresponds. 

static int SetSpellType(int x);
This function defines what type of spell it is. The valid damage types
are SPELL_COMBAT, SPELL_HEALING, SPELL_DEFENSE, and SPELL_OTHER.

static int SetRequiredMagic(int x);
This function defines the minimum amount of magic points the caster
must currently have in order to get a chance to even get a chance at
casting the spell.

static mapping SetSkills(mapping mp);
This function defines the skills and levels that they must be at in
order to learn the spell from their class leader. If they do not have
the skills, or they are not at the right level, they cannot learn the
spell. These skills are important for deciding what class will be using
the spell.

static varargs int array SetMagicCost(mixed args...);
This function defines how much the spell will cost the caster in terms
of Magic Points. The first number is a base. This means this spell
will ALWAYS cost at least that much. The second number, is a random
number. It will pick a number in the random to add to the base.

static int SetDifficulty(int x);
This function defines a couple things. 1) It helps determine the success
rate of the caster, and 2) the more difficult the spell is, the more it
will train the skills used in SetSkills() and the more It will increase
the % known of the spell by the caster.

static int SetMorality(int x);
This function defines how the successful casting of the spell will change
the caster's aligment. Negative numbers indicate evil and positive numbers
indicate a good alignment.

static int SetAutoDamage(int x); and static int SetAutoHeal(int x);
This function is the damage flag which determines how the target will
be affected by the damage inflicted by the spell. A value of 0 will affect
random limbs using the values in SetDamage(). A value of 1 hurts the
actual internals of the target's body and will show an immediate decrease
in hp. For example, a missile has a value of 0 because it is shot at the
body, therefore hitting limbs. A spell such as chill touch has a value
of 1 because the spell attempts to chill and freeze the innards of the
target's body. This function is ONLY used in a SPELL_COMBAT type. If it
is a healing spell, SetAutoHeal() is used in place of SetAutoDamage(). 
They both use the same values and they both mean the same thing.

varargs static void SetDamage(int type, mixed array rest...); and 
static varargs int array SetHealing(mixed args...);
This function defines the type and amount of damage done to the target on
a successful cast. The first argument is ALWAYS magic, because it's always
a magical type of damage because it came from a spell. The second defines
the type of damage done to the target. Available damage types are 
available in /include/damage_types.h. After the damage type, the first 
value is a base value meaning that it will always do atleast that amount 
of damage. The second value is a random meaning it will pick a random 
number between this numbers to add to the base value.

If you are making a healing spell, you will use SetHealing() instead of
SetDamage(). However, you do not need to put in a damage type. All you
have to put in is a base and random value for the amount of healing
done.

static mixed array SetMessages(mixed array messages);
This function defines the messages printed to the room depending on
what happens during the cast. View /doc/lib/messages to learn about
messages.

static string SetHelp(string str);
The SetHelp() defines what the player will see when they type 
'help <spellname>'. Be sure to insert the syntaxes and a short synopsis
of the spell.

static string SetConjure(string str);
This function is used in a spell that conjures up an item for use by
the player. A filename is the str and it defines the item that is conjured
on a successful cast.

static int SetRequiredStamina(int x);
This function defines the minimum amount of stamina points the caster
must currently have in order to get a chance to even get a chance at
casting the spell.

static varargs int array SetStaminaCost(mixed args...);
This function defines how much the spell will cost the caster in terms
of Stamina Points. The first number is a base. This means this spell
will ALWAYS cost at least that much. The second number, is a random
number. It will pick a number in the random to add to the base.

static int SetAreaSpell(int x);
This function defines that all living things in the room excluding you
and immortals will be affected by the spell when cast.

static int SetGlobalSpell(int x);
This function defines that the target defined can be anywhere on the
MUD when cast. Note the SetRules() MUST be "STR" and not "LIV". This
is due to parser restrictions.

static int SetRemoteTargets(int x); and 
static string SetVerb(string verb);
These functions are inside the /lib/spell.c object but are no longer used
in code. Spells using these functions will automatically not be approved.

           ************************************************
                         Part 2: Get Functions
           ************************************************

int GetAutoDamage(); and int GetAutoHeal();
These functions return the values set in SetAutoDamage() and SetAutoHeal(),
respectively.

string GetConjure();
This function returns the filename value set in SetConjure();.

int GetDamage(); and int GetHealing();
These functions return the values set in SetDamage() and SetHealing(), 
respectively.

varargs string array GetMessage();
This function returns the first argument set in SetMessages().

int GetAreaSpell();
This returns the value set in SetAreaSpell();

int GetGlobalSpell();
This returns the value set in SetGlobalSpell();

int GetDamageType();
This function returns the damage type set in SetDamageType().

int GetDifficulty();
This function will return the value in SetDifficulty();

int GetMagicCost(); and int GetStaminaCost();
These functions return the values set in SetMagicCost() and GetStaminaCost(),
respecively.

int GetMorality();
This function will return the morality value set in SetMorality().

int GetRequiredMagic(); and int GetRequiredStamina();
These functions return the values set in SetRequiredMagic() and 
SetRequiredStamina(), respectively.

string array GetRules();
This function returns the rules for the spell set in SetRules().

string array GetSkills();
This function returns the names of the skills set in SetSkills().

string GetSpell();
This function returns the name of the spell set in SetSpell().

int GetSpellType();
This function returns the type of the spell set in SetSpellType().

varargs object array GetTargets(object who, mixed args...);
This function returns the target of the spell depending on the spell
rules and the syntax input by the caster.

string GetVerb(); and int GetMorality();
These should not be used in any spell because the SetVerb() and 
SetMorality() functions should not be used.

Zaxan Zimtafarous
970523:970625
