/* Filename : hat2.c
* Description : improved magical hat
*
* written : 03-10-1996 - Gunner
* last modified : 27-05-1998 - Gunner
* HTML-Version : 04-02-2000 - Ghorwin
*/
#include <mudlib.h>
inherit I_ARMOUR;
#define FUNC "/doc/crashcourse/course07/hat2funcs"
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");
add_property(({"hidden","magic","leather"}));
add_hook("__wear",(:call_other,FUNC,"wear_hat",this_object():));
add_hook("__remove",(:call_other,FUNC,"remove_hat",this_object():));
replace_program(I_ARMOUR);
}
/* Filename : hat2funcs.c
* Description : the functionfile for hat2.c
*
* written : 03-10-1996 - Gunner
* last modified : 27-05-1998 - Gunner
* HTML-Version : 04-02-2000 - Ghorwin
*/
#include <mudlib.h>
#include "/doc/crashcourse/defs.h"
inherit I_DAEMON;
/*
* wear_hat : called by the __wear hook in hat2.c
*/
void
wear_hat(object hat)
{
object wearer, room;
wearer = environment(hat);
if (!wearer) return; // Something's wrong here...
room = environment(wearer);
if (!room) return; // Something's wrong here...
tell_object(wearer,"As you wear the hat, you feel kinda smarter!\n");
tell_room(room,"As " + Q_NAME(wearer) + " wears the hat, " + Q_PRO(wearer) +
" seems kinda smarter.\n",({wearer}));
wearer->add_tmp_int(2);
wearer->add_tmp_dex(-1);
}
/*
* remove_hat : called by the __remove hook in hat2.c
*/
void
remove_hat(object hat)
{
object wearer, room;
wearer = environment(hat);
if (!wearer) return; // Something's wrong here...
room = environment(wearer);
if (!room) return; // Something's wrong here...
tell_object(wearer,"As you remove the hat, you feel kinda dumber!\n");
tell_room(room,"As " + Q_NAME(wearer) + " removes the hat, " + Q_PRO(wearer) +
" seems kinda dumber.\n",({wearer}));
wearer->add_tmp_int(-2);
wearer->add_tmp_dex(1);
}