[ Package Index | Mudlib Index | Effect Index ]

File /std/weapon_logic.c

This class has alkl the stuff for anything which can damage something else, this is included into living and weapons.

Written by Pinkfish.


Includes

This class includes the following files /include/weapon.h

Method index

 o add_attack(string, int, int *, string, string, mixed, mixed, mixed)
This method adds an attack onto the object.
 o add_attack_message(string, string, string *)
This method adds a special attack message set onto the weapon.
 o attack_function(string, int, object, object)
 o calc_attack(int, int)
 o modify_damage(int, string)
 o query_attack_data()
 o query_attack_message(string, string)
This method returns the attack message associated with the type and name.
 o query_attack_names()
 o query_attack_types()
 o query_special_messages()
 o query_weapon_type()
This method attempts to work out what type of weapon this is.
 o remove_attack(string)
This method removes the attack of the given name.
 o weapon_attacks(int, object)
This function returns 0 or more attacks for this weapon against the given target.

Public Functions

These are functions that everyone can access.

.
 * add_attack
varargs int add_attack(string a_name,
                       int chance,
                       int * damage,
                       string type,
                       string skill,
                       mixed func,
                       mixed bogus_1,
                       mixed bogus_2)
This method adds an attack onto the object. The name of the attack must be unique on each object.

Parameters:
a_name - attack name
change - the chance of it occuring
damage - the damage it will do
type - the type of the attack
skill - the skill used by the attack
func - the special function
bogus_1 - errrr.
bogus_2 - frog.
See also:
remove_attack()
 * add_attack_message
void add_attack_message(string name,
                        string type,
                        string * data)
This method adds a special attack message set onto the weapon. The type and name are around this way to correspond to the parameters to add_attack.

Parameters:
name - the name of the attack (0 for none)
type - the type of attack
data - the attack data
See also:
/obj/handlers/attack_messages .c and query_special_message()
Example:
inherit "/obj/weapon";

void setup() {
  ...
  add_attack_message("gumboot", "blunt", ({
    0, "$N gumboot$s at $I with $D",
   20, "$N lightly gumboot$s $I in the $z with $D",
   60, "$N gumboot$s $I in the $z with $D",
 5000, "$N heavily gumboot$s $I in the $z with $D" }));
  ...
} /* setup() */
 * attack_function
void attack_function(string a_name,
                     int damage,
                     object attack_ob,
                     object attack_by)
 * calc_attack
int calc_attack(int number,
                int percent)
 * modify_damage
int modify_damage(int damage,
                  string attack_name)
 * query_attack_data
mixed * query_attack_data()
 * query_attack_message
mixed * query_attack_message(string name,
                             string type)
This method returns the attack message associated with the type and name. The type and name are around this way to correspond to the parameters to add_attack.

Parameters:
name - the name of the attack
type - the type of the attack
Returns:
the attack message array, 0 for none
 * query_attack_names
string * query_attack_names()
 * query_attack_types
string * query_attack_types()
 * query_special_messages
mapping query_special_messages()
 * query_weapon_type
string query_weapon_type()
This method attempts to work out what type of weapon this is.

Returns:
the weapon type
 * remove_attack
void remove_attack(string a_name)
This method removes the attack of the given name.

Parameters:
a_name - the name of the attack to remove
See also:
add_attack()
 * weapon_attacks
mixed * weapon_attacks(int percent,
                       object target)
This function returns 0 or more attacks for this weapon against the given target.

Parameters:
percent - the attack percentage
target - who is being hit
Returns:
an array of 0 or more attacks. This array is indexed by the AT_ macros defined in combat.h
See also:
combat.h

Discworld MUD's distribution world wide web pages.
brought to you by
Cut Me Own Throat Dibbler's Sensational Sausages; buy one while they are hot.
File last modified: Sat, 06 Sep 2003 04:40:51 GMT

Lost? Try Discworld's home page.