[Package Index | Mudlib Index | Effect Index]

File /std/living/armour.c

This file contains all the armour related code for the living objects.

Written by Pinkfish

Inherits

This class inherits the following classes /std/armour_logic.c

Includes

This class includes the following files /include/race.h, /include/armour.h, /include/function.h and /include/clothing.h

Method index

Public Functions

These are functions that everyone can access.

clear_armours
void clear_armours()

This method will make sure all the armours are unworn by the living object.

See also:
query_wearing()


query_ac
varargs int query_ac(string type,
int amount,
string zone)

This function returns the amount of damage that can be blocked by the armour on a specified zone. It automatically damages the armour, and sets the stopped object to be the the object (piece of armour) that stopped the blow.

Parameters:
type - The type of damage, eg: "sharp", "blunt", "pierce".
amount - The amount of damage that is being done.
zone - The zone which the damage is being done through, eg: "head".

Returns:
The amount of damage that will be blocked.

See also:
query_wearing()


query_arcane_shields
string * query_arcane_shields()
query_armour_callbacks
mixed * query_armour_callbacks()

Query all the callback data. This should typically only be used for debugging purposes.
query_armours
object * query_armours()

This method returns all the armours that the is currently being worn. This will always return the same value as query_wearing()

Returns:
the array of armours

See also:
query_wearing()


query_skin
string query_skin()

This method returns the current skin of the living object.

Returns:
the skin of the object

See also:
set_skin()


query_stopped
mixed query_stopped()

This returns the object which stopped the blow. This is only valid inside and after a query_ac() call.

Returns:
the object which stopped the call


query_type_coverage
int query_type_coverage(string type,
int protective)

This method determines whether or not a particular "type" of item is being worn by the living object upon which it is called. @param type the type of worn object being queried @param protective Optional flag to determine whether a matching item provides any protection. @return 0 if no matching item is worn, 1 if a match is worn, 2 if protective flag is set, there is a matched item, and it provides protection.
query_wearing
object * query_wearing()

This method returns all the objects you are currently wearing.

Returns:
the current array of worn objects the array of worn stuff

See also:
query_armours()


register_armour_callback
int register_armour_callback(int level,
mixed callback,
mixed data)

Register a callback for magical protection.

Parameters:
level - How close the protection is to the skin.
callback - The object & function to be called.
data - Any extra data to be passed.

Returns:
an ID to identify this callback.


remove_armour
int remove_armour(object thing)

This method will remove the armour from the living object.

Parameters:
thing - the armour to remove

Returns:
1 if was unsuccessful and 0 if it was successful

See also:
wear_armour(), query_armours() and query_wearing()


remove_armour_callback
int remove_armour_callback(int level,
int id)

Remove a registered callback, used when the protection ends.

Parameters:
level - The level of the callback
id - The callbacks ID.

See also:
register_armour_callback()


set_skin
void set_skin(string word)

This method sets the current skin of the living object. This can be done by the race object and by specific spells or effects.

Parameters:
word - the new skin type

See also:
query_skin()


set_stopped
void set_stopped(mixed arg)

This method sets the object which stops the call. This should be used to do weird stuff. I have no idea what it should be used for at all and I am just rambling.

Parameters:
arg - the new value of the stopped object


update_armour_callback
int update_armour_callback(int level,
int id,
mixed data)

Update the data for an armour callback.

Parameters:
level - The level of the callback
id - The callbacks ID.
data - The new data.

See also:
register_armour_callback()


wear_armour
string wear_armour(object armour,
int doing_hold)

This is the method used to get the living object to wear a piece of armour or clothing. This is called from inside the armour or clothing code itself. It will call the function set_worn_by() on the armour or clothing and if this returns a non-zero result then it will add it into the current list of worn types. Assuming the type of the armour fits into the allowed list. It will also call the functon hold_item on the object if it is required to be held as well (ie: shield).

Parameters:
armour - the armour to wear
doing_hold - if this is called by the hold command

Returns:
the failure message, or 0 if ok

See also:
remove_armour(), query_armours() and query_wearing()


Protected Functions

These are functions that only objects inheriting the class can access.

equivalent_armour_types
int equivalent_armour_types(mixed comp,
string type)

This method checks to see if the two armour types are equivilant or not.

Parameters:
comp - the first type
type - the second type