/**
* This is the Drain Life Ritual Effect.
* @author Sandoz, 18th May 2001.
*/
#include <deity.h>
#include <effect.h>
#define CLASSIFICATION "cleric.drain.hitpoints"
#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_life"; }
/** @ignore yes */
int calc_amount( int number ) {
return number / 10;
} /* calc_amount() */
/** @ignore yes */
mixed beginning( object target, mixed arg ) {
AMOUNT = calc_amount( TIME );
tell_object( target, "You suddenly feel weak.\n");
tell_room( ENV( target ), target->the_short()+" whimpers and starts to "
"tremble slightly.\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 weaker.\n");
tell_room( ENV( target ), CAP( target->the_short() )+" looks even "
"worse.\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 weak.\n");
} /* restart() */
/** @ignore yes */
void end( object target ) {
target->remove_extra_look( TO );
if( !target->query_property("dead") ) {
tell_object( target, "You feel the pain leave.\n");
tell_room( ENV(target), target->the_short()+" looks much better.\n",
target );
}
} /* end() */
/** @ignore yes */
void visual_effects( object target ) {
string drainee, room;
switch( random( 4 ) ) {
case 0 : drainee = "You tremble.";
room = target->the_short()+" trembles.";
break;
case 1 : drainee = "You moan.";
room = target->the_short()+" moans.";
break;
case 2 : drainee = "You grimace in agony.";
room = target->the_short()+" grimaces in agony.";
break;
case 3 : drainee = "You feel as if the very essence of life was "+
"being drained out of you.";
room = target->the_short()+" looks pained.";
break;
default: drainee = "You feel as if the very essence of life was "+
"being drained out of you.";
room = target->the_short()+" looks pained.";
}
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->HIS)+" face is twisted in agony.\n";
} /* extra_look() */