/*** Light object ***/
#include "/std/include/std.h"
#include "defines.h"
inherit "std/object";
int level;
create()
{
add_property("magic");
}
set_level(l)
{
level = l;
if(level < 0) {
set_id("darkness");
set_long(0);
}
else if (level > 0) {
set_id("light");
set_long("You have to look away from it, it's too bright!\n");
}
set_short(0);
}
set_duration(d)
{
int i, j;
write("Dispel in: "+d+" seconds.\n");
call_out("dispel",d);
i = set_light(0);
j = set_light(level);
write(EN(TP)->short()+"\n");
if (i <= 0 && j > 0)
tell_room(EN(TP), "A glowing ball lights up the room.\n");
else if (i > 1 && j <= 0)
tell_room(EN(TP), "A cloak of darkness falls upon you.\n");
return level;
}
dispel()
{
int i, j;
i = set_light(0);
j = set_light(-level);
if (i <= 0 && j > 0)
tell_room(EN(TP), "The darkness dissolves. You can see again.\n");
else if (i > 1 && j <= 0)
tell_room(EN(TP), "The light from the globe fades away, leaving you in the darkness.\n");
destruct(this_object());
}
extra_look() {
if(level < 1) return;
return CAP(ENV->QPRO) + " has a glowing sphere of light at " + ENV->QPOS +
" side";
}