
This file describes the rules for creating weapons in Genesis.
==============================================================

Weapons are created by cloning or inheriting the file "/std/weapon.c".
The weapon can then easily be configured by calling the internal 
functions as described in the file (see also the section, How to make
a weapon, below).

Weapons differ in weapon type, damage type, and weapon class.

  o Weapon type.

    The weapon type defines which skill is necessary to wield the weapon 
    effectively. Weapon types are sword, polearm, axe, knife, club, missile, 
    and javelin. All weapons must be of one of the types mentioned here. The 
    weapon types 'missile' and 'javelin' are not yet supported in the mudlib.

  o Damage type. 

    Weapons can be configured to cause damage in three different ways. They 
    can be impaling, slashing, or bludgeoning. Armours can be configured to 
    have different armour classes for different damage types.

  o Weapon class.

    All weapons have two weapon class (WC) values, a 'to hit' (wchit) value 
    and a 'penetration' (wcpen) value. The 'wchit' value together with the 
    weapon skill of the attacker, is set against the parry capability and 
    dexterity of  the enemy. The 'wcpen' value is set against the armour 
    class of the enemy. Very interesting weapons can be made if the 'to hit'
    value differs considerably from the 'penetration' value. 


When creating a weapon, certain RULES must be respected.

1.- Calculation of weapon value:

  o Normal weapons.

    The standard value for a weapon in copper coins is calculated using the
    formula:
		cc = 50 + (wchit * wcpen * 2)

    Please use F_VALUE_WEAPON(wchit, wcpen) in your weapon code to be sure
    that it will comply with the weapon value rule, and to eliminate the
    tedious necessity of changing the values in each weapon file should 
    this formula be changed.

  o Magical weapons.

    As a rule, magical weapons are more expensive than non-magical ones.
    If the wchit or wcpen of a magical weapon exceeds 40 the property 
    OBJ_M_NO_BUY must be set.


2.- Limits on weapon class (WC):

    Both WC values have to respect the following maxima seperately.

  o All weapons:

    Max WC found (on the ground)	:  10
    Max WC bought			:  40
    Max WC conquered (in combat)	:  60
    Max WC reward for solving quest	:  20 * questlevel (see xp_scale)

    The limit of WC 40 for bought weapons implies that all weapons with one 
    or two WC values exceeding 40 must have the property OBJ_M_NO_BUY set.

  o Non-magic (normal) weapons:

    'Non-magic' means in this context that the weapon does not rely on magic
    to hurt the enemy in combat, but on conventional means. This limits the 
    possible values for the WC considerably.

    For a listing of the wchit and wcpen values various types of non-magic 
    weapons see /doc/man/Genesis/weapon_guide. Non-magical weapons must 
    stay close to the examples in the weapon_guide, which is an extension 
    of these rules!

    As a rule-of-thumb, an excellent one-handed weapon will have a WC of 
    about 30/30. Weapons which have a WC above 35 must be two-handed. 

    No non-magical weapon may have a WC value exceeding 40. Depending on the
    weapon type, the maximal WC of a weapon can be lower. For magical weapons
    these limits are for non-quest weapons.

                non-magical     non-magical     magical         magical
		one-handed	two-handed      one-handed      two-handed
    Sword:	    35		    40              50              60
    Polearm:	    n.a.	    40              n.a.            60
    Axe:	    35		    40              50              60
    Knife:	    20		    n.a.            40              n.a.
    Club:	    35		    40              50              60
    Missile:	    35 	            40              50              60
    Javelin:	    n.a.            n.a.            n.a.            n.a.

  o Magical weapons:

    Magic weapons are weapons which have special magical features or
    powers. For example, they let themselves be wielded only by persons
    of good alignment, or they can be magically poisoned, or they help
    the wielder to resist magic, or the wielder can charge them with mana,
    which they release in combat in a lightning bolt against the enemy.
    There are many other possibilities.

    Magic weapons are hard to manufacture, they are extremly expensive,
    hard to get, and wielded only by the most powerful monsters. And
    they are rare. They will in general be unique.

    Magic weapons must have the following properties set:

    - OBJ_I_IS_MAGIC_WEAPON set to 1 to identify it as magic weapon.
    - MAGIC_AM_MAGIC, to identify the form of the magic and its
      strength.
    - MAGIC_AM_ID_INFO, supporting 'identify' spells, giving mortals the
      chance to learn more about the nature and the history of the
      weapon.
    - OBJ_S_WIZINFO, to inform wizards about the special properties of
      the weapon. This should also contain where it is cloned and which
      monsters wields the weapon (path names).

    Magic weapons must be documented in /d/Domain/open/MAGIC

    Weapons which claim to be magical in nature by having the necessary
    properties set but besides that differ from non-magical weapons only
    by exceeding the limits for the WC valid for non-magical weapons are
    likely to be considered illegal. In this case the weapons will be
    removed and the Lord or the Lady of the domain will be held 
    responsible.

    Depending on the handedness, magical weapons (except quests weapons)
    can have a lower maximum WC. See the table above under non-magical.

3.- Wielding Weapons & Limits on Skill and Stat checks:

    It is highly recommended that resolve_task be used in functions that
    query for stats or skills in players before the weapon can be wielded.
     
    The wielding of a weapon means that a player cannot wear a shield in 
    that hand. Wielding a two handed sword would result in no place for a
    shield. However, wielding a weapon will make it easier to protect that 
    part of the arm, parrying blows, so it will contribute to the protection 
    of the corresponding arm. To look at this, clone a weapon, wield it 
    and use the 'combatstat' command.


4.- Weapons may not be made autoloadable.

    'Autoloading' means that the item remains in a player's inventory for 
    an indefinate period of time (as in guild items or quest rewards).

    
How to make a weapon
====================

A weapon should always begin with these statements:

inherit "/std/weapon";
#include <wa_types.h>      /* contains weapon-related definitions */
#include <formulas.h>        /* contains formulas for weight values, etc */
#include <stdproperties.h> /* OBJ_I_VALUE and those properties    */

/* Define the to-hit and penetration values. */
#define HIT 8
#define PEN 9

void
create_weapon()
{
    /* Set the name, short description and long description */
    set_name("dagger");
    set_short("small dagger"); /* Observe, not 'a small dagger' */
    set_long("It's small but sharp.\n");

    /* Now, a player can refer to this weapon as 'weapon' and 'dagger'. To
     * distinguish it from other daggers, we want the player to be able to 
     * use 'small dagger' as an id too. */
    set_adj("small");

    /* Now we want to set the 'to hit' value and 'penetration value' */
    set_hit(HIT);
    set_pen(PEN);

    /* The weapon type and the type of damage done by this weapon */
    set_wt(W_KNIFE);            /* It's of 'knife' type */
    set_dt(W_SLASH | W_IMPALE); /* You can both 'slash' and 'impale' with it */

    /* Last, how shall it be wielded? */
    set_hands(W_ANYH); /* You can wield it in any hand. */

    /* Now give the weapon some value, weight and volume */
    /* use standard functions, randomize to hide actual WC values */
    add_prop(OBJ_I_VALUE, F_VALUE_WEAPON(HIT, PEN) + random(20) -10);
    add_prop(OBJ_I_WEIGHT, F_WEIGHT_DEFAULT_WEAPON(PEN, W_KNIFE) +
        random(50) - 25);

    /* calculate volume from weight */
    add_prop(OBJ_I_VOLUME, query_prop(OBJ_I_WEIGHT)/5);
}

SEE ALSO:
    /doc/man/Genesis/weapon_guide    For list of weapons and values
    /doc/examples/weapons/*          For weapon code examples
