This is a description of what the inheritable file /std/weapon.c contains
and how to use it.

The file contains both ordinary text and program excerpts of a weapon.
Read EVERYTHING since explanatory text is given in the program parts
as well.

A weapon should always begin with the statements:

inherit "/std/weapon.c";
#include "/sys/stdproperties.h"
#include "/sys/macros.h"
#include "/sys/wa_types.h"
#include "/sys/ss_types.h"
#include "/sys/formulas.h"

I will also make a few simple definitions to make life easier and 
the text easier to read.

#define BS(message)	break_string(message, 75)
#define TP 		this_player()
#define TO 		this_object()

With this done, the weapon you make will be an "instance" of the
standard weapon object with all the properties that comes along with it.

What you must do now is to define the standard weapon variables and
settings. The first function in the weapon should be create_weapon().
This function is called when the weapon is first referenced. For example
when a monster clones the weapon or a function in the weapon being called.

The create_weapon() function should contain calls to 'add_prop',
'set_short', 'set_long', functions that specify the properties of the
weapon and nothing much more. Natually, if you have special
initializations to be done, this is a suitable place to put them.

void
create_weapon()
{
    /*
     * Begin with naming the weapon. Both singular & plural names
     * should be given.
     */
    set_name(({ "dagger", "knife" }));
    set_pname(({ "daggers", "knives" }));

    /*
     * Set wc (hit/pen), damage type, handedness.
     */
    set_hit(13);
    set_pen(8);
    set_dt(W_SLASH);
    set_hands(W_BOTH);

    /*
     * Set standard weight, size, value etc...
     * These are computed from the hit/pen you chose before. If you want
     * the weapon to weigh/cost more than the computed minimum, that is quite
     * ok, however, setting the properties below that value will be corrected
     * after this call.
     */
    update_prop_settings();

    /* 
     * This essentially is enough to get the weapon working. However,
     * there are are always extra features to be added :) In this case
     * add some nice wield/unwield actions.
     */
    set_wf(TO);
}

/*
 * Too weak to wield.
 */
public int
wield(object wep)
{
    if (TP->query_stat(SS_STR) < 20)
    {
	write(BS("Grunting and groaning doesn't help, this dagger is still too heavy for you to wield.\n"));
	return -1;
    }

    return 0;
}

/*
 * Too drunk to unwield.
 */
public int
unwield(object wep)
{
    if (TP->query_intoxicated() > TP->query_prop(LIV_I_MAX_INTOX) / 2)
    {
	write(BS("You're too drunk to let go of the dagger.\n");
	return -1;
    }

    return 0;
}
