Man armour
From LSWiki
Revision as of 17:52, 11 June 2007 (edit) Laine (Talk | contribs) ← Previous diff |
Current revision (17:52, 11 June 2007) (edit) Laine (Talk | contribs) |
Current revision
Description
The following functions are unique to armour. Armour also includes all functions inherited in /std/item, such as set_name(), set_names(), set_mass(), set_volume(), set_value(), and so on.
set_armour_class(int class) Sets the armour class of the object to 'class'. This determines how much damage the armour will absorb from a given blow; a random number between 0 and the armour class is subtracted from the damage.
set_armour_type(string type) Sets the type of armour to 'type'. This affects what body areas the armour covers and whether it is an "overarmour" type. The types you can use are discussed in /doc/build/armour.types. The data for the is contained in /lib/armour_types.h
set_material(string mat, int mod) Sets up default characteristics (armour class and type modifiers) for the armour according to its material and construction type. Construction types are: leather, hide, studded, ringmail, brigandine, ringmail, scalemail, chainmail, bandedmail, splintmail, platemail, and plate. These may be used alone, or materials may be specified for some, such as brass, bronze, iron, steel, mithril, and adamantium. So one might do set_material("leather"), set_material("steel chainmail"), set_material("mithril plate"), and so on. The second argument is a modifier that can be used to adjust for quality or enchantment, set_material("mithril chainmail", 3); gives you the base AC of mithril chainmail +3. Appropriate properties are automatically added to the armour. The data on materials is contained in /lib/armour_types.h
set_limb(int *limbs) Sets the limbs which the armour binds to. For example, set_limb(({ Chest })) would cause the armour to cover the chest, set_limb(({ Head, Chest })) would cause it to cover the head and chest, and set_limb(({({RHand}), ({LHand})})) would cause it to cover either the right hand or the left hand, optionally. Normal armour only absorbs damage done to the area it covers; overarmour absorbs damage irrespective of location (the limbs bound are only for the purpose of limiting how much overarmour may be worn). Normally one does not need to use set_limb(), as set_armour_type() determines which limbs are covered. Note that one must #include <limbs.h> in order to use the Chest Head, LHand, RHand, etc. macros.
set_overarmour(status flag) Sets whether the piece of armour is "overarmour". Rings, cloaks, robes, and so on are overarmour. These absorb damage done to any location on the wearer. Non-overarmour only absorbs damage done to the locations it covers. Normally one does not need to use this function, as set_type() determines which limbs are covered.
set_type_modifiers(mapping mod) Sets up armour class modifiers which the armour receives based on different attack types. For instance, set_type_modifiers(([ "stabbing" : -3, "magical" : 5, "heat" : 2 ])) would give the armour -3 to its AC vs. stabbing attacks, +5 to its AC vs. magical attacks, and +2 to its AC vs. heat attacks. One may also use set_type_modifier(string type, int mod) to set up individual type modifiers.
set_granted_resistances(mapping res) Sets up a set of resistances which the armour conveys when worn. An example would be set_granted_resistances(([ "slashing" : 50, "magical" : 100, "cold" : -50 ])). When the armour is worn, it will give the wearer 50% resistance to slashing attacks, 100% resistance (immunity) to magical attacks, and 50% vulnerability to cold attacks. One may also use the function set_granted_resistance(string type, int res) to set up individual resistances.
set_wear_func(object obj) If this is called, when a living attempts to wear the armour, the function wear_func(object who) will be called in obj. It is passed the person attempting to wear the armour as an argument. If it returns 1, they will be allowed to wear it; if it returns 0, they will not.
set_remove_func(object obj) If this is called, when a living attempts to remove the armour, the function remove_func(object who) will be called in obj. It is passed the person attempting to remove the armour as an argument. If it returns 1, they will be allowed to remove it; if it returns 0, they will not.
set_absorb_func(object obj) If this is called, when the armour absorbs damage, the function absorb_func(int damage, object attacker, string *type, int full_damage, status messages, object weapon, object user, int limb) will be called in obj. Damage is the damage being absorbed, attacker is the person doing the damage, *type is the damage type being done, full_damage is the base damage before any armour modifiers, messages is whether or not any messages should be displayed (to avoid multiple messages when doing damage to many limbs), weapon is the object being used to do the damage, user is its wearer, and limb is the limb index being struck. The integer number returned from absorb_func() is added to the amount of damage that would normally be absorbed by the armour.
set_size_optimum(int opt) Sets the optimum size for wearing the armour to 'opt'. See the following function for the usefulness of this.
set_size_tolerance(int toler) Sets the size tolerance of the armour to 'toler'. In order to wear the armour, a creature must be within 'toler' size points of the size optimum. So with set_size_optimum(40) and set_size_tolerance(10), creatures from size 30 to size 50 could wear the armour. With set_size_optimum(30) and set_size_tolerance(2), sizes 28 to 32 could wear it.
set_race(string race, int mod) Defines the race for which the armour was designed; sets up the armour's size_optimum and size_tolerance settings as appropriate to that race. The 'mod' argument need not be specified; if it is, it acts as a percentage modifier to the size tolerance; i.e. if set_race("human") defines a size optimum of 32 and a size tolerance of 8, then set_race("human", 50) will change the size tolerance to 12 and set_race("human", -50) will change it to 4. If a race for which no size ranges are defined is specified, then nothing will be done.
set_ablative(status flag) If this is set to 1, then the armour will be damaged when it intercepts damage that would have been done to the player. Once it has reached its damage-absorption capacity it will fall apart. If this is not set then the armour lasts indefinitely.
set_absorb(int level) Sets the number of damage points which may be absorbed by ablative armour before falling apart. This is essentially a shorthand function combining set_max_absorption(level) and set_absorption(level).
set_max_absorption(int level) Sets the maximum number of damage points which may be absorbed by the armour.
set_absorption(int level) Sets the current number of damage points which the armour may absorb before falling apart.
set_armour_degradation(int perc) Sets the percentage by which ablative armour will degrade as it takes damage. If this is set to 100, then when the armour is about to fall apart it will offer no protection. If 50, then it will only degrade to half its normal AC. If -25, then the armour will gain protective capacity as it takes damage. How much of this percentage applies depends on what percentage of the armour's absorption capacity has been depleted. This percentage modifier is applied after any type modifiers the armour possesses.