TOWEL.C
LIB3/D/HOME/CITY/ITEMS/MISC/TOWEL.C · 1.7 KB
From the archive nm4dos.zip
Download the archive « Back to the archive contents
#include "path.h"
#include "library.h"
inherit "/std/object";
setup()
{
set_name("towel");
set_short("towel");
add_adjective("beach");
add_adjective("large");
set_long("A large beach-towel, suitable for sunbathing on.\n");
set_weight(20);
set_value(200);
}
void init()
{
add_action("do_sunbathe", "sunbathe", 1);
::init();
}
do_sunbathe()
{
if (!environment(this_player())->query_property("beach"))
{
notify_fail("Thsi isn't a beach. You can't sunbathe here!\n");
return 0;
}
if ("/obj/handlers/weather"->cloud_index(environment(this_player())) >50)
{
notify_fail("It is too dull to sunbathe right now.\n");
return 0;
}
if ("/obj/handlers/weather"->cold_index(environment(this_player())) > 0)
{
notify_fail("It is too cold to sunbathe right now.\n");
return 0;
}
write("You strip off, spread the towel on the sand, and lie on it.\n");
say(this_player()->query_cap_name() +
" strips off, lays a large towel on the gound, and lies on it.\n");
call_out("do_sizzle1", 5);
return 1;
}
do_sizzle1()
{
write("The sun beats down on you.\n");
call_out("do_sizzle2", 5);
}
do_sizzle2()
{
write("You feel your skin tanning nicely.\n");
call_out("do_sizzle3", 5);
}
do_sizzle3()
{
if(LIBRARY->query_quest_done( this_player()->query_name(), "sunbathing") )
{
write("Ouch, seems as if you have spent to much time sunbathing! "
+"Your skin is now peeling and flaking painfully.\n");
this_player()->adjust_hp(-random(100));
return;
}
write("Congratulations, you now have a nice sun-tan!\n");
this_player()->add_property( "tanned", 1 );
LIBRARY->set_quest(this_player()->query_name(), "sunbathing");
this_player()->adjust_xp(5000);
}