/** * This is the Drain Energy Ritual Effect. * @author Sandoz, 18th May 2001. */ #include <deity.h> #include <effect.h> #define CLASSIFICATION "cleric.drain.guildpoints" #define TIME arg[ 0 ] #define CASTER arg[ 1 ] #define AMOUNT arg[ 2 ] #define DEBUG 1 /** @ignore yes */ string query_classification() { return CLASSIFICATION; } /** @ignore yes */ string query_shadow_ob() { return SHADOWS+"drain_energy"; } /** @ignore yes */ int calc_amount( int number ) { return number / 20; } /* calc_amount() */ /** @ignore yes */ mixed beginning( object target, mixed arg ) { AMOUNT = calc_amount( TIME ); tell_object( target, "You suddenly feel giddy.\n"); tell_room( ENV(target), target->the_short()+" suddenly grows "+ "pale.\n", target ); target->submit_ee("visual_effects", ({ 45, 60 }), EE_CONTINUOUS ); target->submit_ee( 0, TIME, EE_REMOVE ); target->add_extra_look( TO ); #ifdef DEBUG TCRE("sandoz", sprintf("Duration : %i\nAmount : %i", TIME, AMOUNT ) ); #endif return arg; } /* beginning() */ /** @ignore yes */ mixed merge_effect( object target, mixed arg, mixed new_arg ) { int div, add_time, left, new_amount; CASTER = new_arg[ 1 ]; left = (int)target->expected_tt(); #ifdef DEBUG TCRE("sandoz", sprintf("Time Left : %i\nDuration : %i\nAmount : %i", left, TIME, AMOUNT ) ); #endif div = 500 * left / new_arg[ 0 ]; if( div < 100 ) div = 100 ; add_time = 100 * new_arg[ 0 ] / div ; TIME = left + add_time ; target->submit_ee( 0, TIME , EE_REMOVE ); new_amount = calc_amount( new_arg[ 0 ] ); if( AMOUNT < new_amount ) AMOUNT = new_amount; tell_object( target, "You feel even more giddy.\n"); tell_room( ENV(target), target->the_short()+" winces and grows " "even more pale.\n", target ); #ifdef DEBUG TCRE("sandoz", sprintf("New duration : %i\nAmount : %i", TIME, AMOUNT ) ); #endif return arg; } /* merge_effect() */ /** @ignore yes */ void restart( object target, mixed arg ) { target->add_extra_look( TO ); tell_object( target, "You feel rather giddy.\n"); } /* restart() */ /** @ignore yes */ void end( object target ) { target->remove_extra_look( TO ); if( !target->query_property("dead") ) { tell_object( target, "Your mind returns to its normal state.\n"); tell_room( ENV(target), target->the_short()+" regains "+ target->HIS+" composure.\n", target ); } } /* end() */ /** @ignore yes */ void visual_effects( object target ) { string drainee, room; switch ( random( 3 ) ) { case 0 : drainee = "You feel dizzy."; room = target->the_short()+" peers around " "with half-closed eyes."; break; case 1 : drainee = "Your step falters for a moment."; room = target->the_short()+" falters and " "looks around for a handhold."; break; case 2 : drainee = "You feel unable to think clearly."; room = target->the_short()+" looks like "+ target->HE+" is about to pass out."; break; default: drainee = "You feel unable to think clearly."; room = target->the_short()+" looks like "+ target->HE+" is about to pass out."; } tell_object( target, drainee+"\n"); tell_room( ENV(target), room+"\n", target ); } /* visual_effects() */ /** @ignore yes */ string extra_look( object target ) { return CAP((string)target->HE) +" looks rather pale.\n"; } /* extra_look() */