/**
* Light effect for the light ritual.
* Sandoz 13th June 2001
*/
#include <effect.h>
#define DURATION arg[ 1 ]
#define BRIGHTNESS arg[ 0 ]
#define CLASSIFICATION "cleric.light.symbol"
void give_message( object thing, string mess, string pre_mess );
/** @ignore yes */
string query_classification() { return CLASSIFICATION; }
/** @ignore yes */
int *beginning( object thing, int *arg ) {
thing->submit_ee( 0, DURATION, EE_REMOVE );
thing->add_extra_look( TO );
thing->adjust_light( BRIGHTNESS );
switch( BRIGHTNESS ) {
case 0 :
break;
case 1 .. 40 :
give_message( thing, " $V$0=begins,begin$V$ to glow faintly.\n", "");
break;
default :
give_message( thing, " $V$0=begins,begin$V$ to glow faintly, the "
"light intensifying until it fills the surroundings.\n", "");
}
} /* beginning() */
/** @ignore yes */
int *merge_effect( object thing, int *arg, int *new_arg ) {
int div, add_time;
div = ( 160 * (int)thing->expected_tt() ) / new_arg[ 1 ] ;
if( div < 100 )
div = 100;
add_time = ( 100 * new_arg[ 1 ] ) / div;
DURATION = (int)thing->expected_tt() + add_time;
thing->submit_ee( 0, DURATION, EE_REMOVE );
if( BRIGHTNESS < new_arg[ 0 ] ) {
thing->adjust_light( new_arg[ 0 ] - BRIGHTNESS );
BRIGHTNESS = new_arg[ 0 ];
give_message( thing, " throbs briefly as it intensifies.\n",
"The light from ");
} else {
give_message( thing, " wavers for a moment.\n", "The light from ");
}
return arg;
} /* merge_effect() */
void restart( object thing, int *arg ) {
thing->add_extra_look( TO );
} /* restart() */
/** @ignore yes */
void end( object thing, int *arg ) {
thing->remove_extra_look( TO );
call_out( (: call_other( $1, "adjust_light", $2 ) :), 2,
thing, -BRIGHTNESS );
give_message( thing, " $V$0=begins,begin$V$ to dim, dying in a final "
"brilliant flash.\n", "");
} /* end() */
/** @ignore yes */
string extra_look( object thing ) {
int *enums;
string mess;
mixed arg;
if( !sizeof( enums = (int *)thing->effects_matching( CLASSIFICATION ) ) )
return "";
arg = thing->arg_of( enums[ 0 ] );
switch ( BRIGHTNESS ) {
case 0 :
return "";
case 1 .. 25 :
mess = "barely noticeable orange light";
break;
case 26 .. 50 :
mess = "pale orange light";
break;
case 51 .. 75 :
mess = "bright orange light";
break;
case 76 .. 100 :
mess = "brilliant orange light";
break;
default :
mess = "blinding orange light";
}
return "It emits a " + mess + ".\n";
} /* extra_look() */
/** @ignore yes */
void give_message( object thing, string mess, string pre_mess ) {
object place, carrier;
if( !place = ENV( thing ) )
return;
while( ENV( place ) ) {
carrier = place;
place = ENV( place );
}
if( !carrier ) {
tell_room( place, pre_mess + (string)thing->the_short() + mess );
return;
}
if( living( carrier ) && ENV( thing ) == carrier ) {
tell_room( place, pre_mess + (string)thing->poss_short() + mess );
return;
}
} /* give_message() */