hat.c - example for course 07

[previous example] [course07] [Table of contents] [next example]
/* Filename      : hat.c
 * Description   : a special hat
 *
 * written       : 03-10-1996 - Gunner
 * last modified : 27-05-1998 - Gunner
 * HTML-Version  : 04-02-2000 - Ghorwin
 */

#include <mudlib.h>
inherit I_ARMOUR;

create()
{
    ::create();
    set_name("magic hat");
    add_id(({"hat","magical hat"}));
    set_short("A magic hat");
    set_long("It's a magic hat which will try to make you smarter. If "
        "possible...\n");
    set_weight(1);
    set_value(300+random(100));
    set_type("helmet");
    set_info("The hat will try to increase your intelligence.\n");

    // Let's add a simple INT modifier. +2INT

    add_modifier("int",2);

    /* A couple of messages to be sent to the wearer.
     * You can also use other_wear_msg and other_remove_msg if you want 
     * to send a special message to the room when this hat is worn.
     */

    add_property("wear_msg","You feel smart all of a sudden.\n");
    add_property("remove_msg","You feel dumber.\n");

    // and don't forget the properties
    add_property(({"hidden","magic","leather"}));
    replace_program(I_ARMOUR);
}