Useage Agreement:
Feel free to use and distribute this code as long as the headers and comments
within the code are left intact, you give me, Talon of Twilight of the Gods
MUD (tgods.mudhaven.com 8000) credit for it somewhere on your MUD, and send
me an email at tgods@xerxes.mudhaven.com telling me that you are using my
code on your MUD (a MUD address would be nice cause I love to see other MUDs).
If you have any questions, ideas for upgrading this code, or would just like
to drop me a note  you  can reach me at the aforementioned email address. Also,
please remember to support the MUDding community by posting your own original
snippets no matter how big or small! A little bit sometimes goes a long
way. Happy MUDding!

DISCLAIMER: The author of this code is in no way responsible for any loss or
damage due to the use, misuse, or abuse of this code. If you have any
technical questions or problems please contact me, Talon, at
tgods@xerxes.mudhaven.com.

NOTE: You may want to up the costs to players giving CPR and lower the amount
of HPs the player who is receiving it gets when they are being revived but
that's completely up to you.

/* Cheap heal-type command that lets players revive the mortally 
 * wounded and incapacitated back up to 1/2 of their hitpoints.
 * - Talon of TOTG MUD tgods.mudhaven.com 8000
 * Email: tgods@mudhaven.com. All code copyrighted (c) 1999 NML
 */
void do_cpr( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;

    if ( IS_NPC( ch ) )
        return;

    if ( argument[0] == '\0' )
    {
        send_to_char( "Who do you want to use CPR on?\n\r", ch );
        return;
    }

    if ( !( victim = get_char_room( ch, argument ) ) )
    {
        send_to_char( "They're not here.\n\r", ch );
        return;
    }

    if ( IS_NPC( victim ) )
    {
        send_to_char( "Why would you want to do that on a beastie?!\n\r", ch );
        return;
    }

    if ( victim->position == POS_STUNNED )
    {
        send_to_char( "They're stunned and will probably recover.\n\r", ch );
        return;
    }

    if ( victim->position != POS_MORTAL 
          && victim->position != POS_INCAP )
    {
        send_to_char( "They look fine to you...\n\r", ch );
        return;
    }

    if ( ch->move <= 101 || ch->hit <= 31 )
    {
        send_to_char( "You need 30 hps and 100 movement to do CPR.\n\r", ch );
        return;
    }

    /* Note that I don't charge the hps or move if they fail at CPR but
     * you can change that to your liking... ;) - Talon
     */
    if ( number_percent( ) < 40 )
    {
        send_to_char( "You try to administer CPR but fail!\n\r", ch );
        act( "$n tries to administer CPR on $N.", 
	     ch, NULL, victim, TO_NOTVICT );
        return;
    }

    victim->hit = ( victim->max_hit / 2 );
    victim->position = POS_STANDING;
    ch->hit -= 30;
    ch->move -= 100;
    act( "$n administers CPR on $N!", ch, NULL, victim, TO_NOTVICT );
    act( "You administer CPR on $N!", ch, NULL, victim, TO_CHAR );
    act( "You've been saved by $n!", ch, NULL, victim, TO_VICT );
    return;
}

