src/fight.c
/*
 * Make a corpse out of a character.
 */
Make a corpse out of a character.
Make a corpse out of a character .
void make_corpse( CHAR_DATA *ch )
{
    char buf[MAX_STRING_LENGTH];
    OBJ_DATA *corpse;
    OBJ_DATA *obj;
    OBJ_DATA *obj_next;
    char *name;
    if ( IS_NPC(ch) )
    {
	name		= ch->short_descr;
	corpse		= create_object(get_obj_index(OBJ_VNUM_CORPSE_NPC), 0);
	corpse->timer	= number_range( 3, 6 );
	if ( ch->gold > 0 )
	{
	    obj_to_obj( create_money( ch->gold, ch->silver ), corpse );
	    ch->gold = 0;
	    ch->silver = 0;
	}
	corpse->cost = 0;
    }
    else
    {
	name		= ch->name;
	corpse		= create_object(get_obj_index(OBJ_VNUM_CORPSE_PC), 0);
	corpse->timer	= number_range( 25, 40 );
	REMOVE_BIT(ch->act,PLR_CANLOOT);
	if (!is_clan(ch))
	    corpse->owner = str_dup(ch->name);
	else
	{
	    corpse->owner = NULL;
	    if (ch->gold > 1 || ch->silver > 1)
	    {
		obj_to_obj(create_money(ch->gold / 2, ch->silver/2), corpse);
		ch->gold -= ch->gold/2;
		ch->silver -= ch->silver/2;
	    }
	}
	corpse->cost = 0;
    }
    corpse->level = ch->level;
    sprintf( buf, corpse->short_descr, name );
    free_string( corpse->short_descr );
    corpse->short_descr = str_dup( buf );
    sprintf( buf, corpse->description, name );
    free_string( corpse->description );
    corpse->description = str_dup( buf );
    for ( obj = ch->carrying; obj != NULL; obj = obj_next )
    {
	bool floating = FALSE;
	obj_next = obj->next_content;
	if (obj->wear_loc == WEAR_FLOAT)
	    floating = TRUE;
	obj_from_char( obj );
	if (obj->item_type == ITEM_POTION)
	    obj->timer = number_range(500,1000);
	if (obj->item_type == ITEM_SCROLL)
	    obj->timer = number_range(1000,2500);
	if (IS_SET(obj->extra_flags,ITEM_ROT_DEATH) && !floating)
	{
	    obj->timer = number_range(5,10);
	    REMOVE_BIT(obj->extra_flags,ITEM_ROT_DEATH);
	}
	REMOVE_BIT(obj->extra_flags,ITEM_VIS_DEATH);
	if ( IS_SET( obj->extra_flags, ITEM_INVENTORY ) )
	    extract_obj( obj );
	else if (floating)
	{
	    if (IS_OBJ_STAT(obj,ITEM_ROT_DEATH)) 
	    { 
		if (obj->contains != NULL)
		{
		    OBJ_DATA *in, *in_next;
		    act("$p evaporates,scattering its contents.",
			ch,obj,NULL,TO_ROOM);
		    for (in = obj->contains; in != NULL; in = in_next)
		    {
			in_next = in->next_content;
			obj_from_obj(in);
			obj_to_room(in,ch->in_room);
		    }
		 }
		 else
		    act("$p evaporates.",
			ch,obj,NULL,TO_ROOM);
		 extract_obj(obj);
	    }
	    else
	    {
		act("$p falls to the floor.",ch,obj,NULL,TO_ROOM);
		obj_to_room(obj,ch->in_room);
	    }
	}
	else
	    obj_to_obj( obj, corpse );
    }
    obj_to_room( corpse, ch->in_room );
    return;
}
void make_corpse ( CHAR_DATA * ch ) { char buf [ MAX_STRING_LENGTH ] ; OBJ_DATA * corpse ; OBJ_DATA * obj ; OBJ_DATA * obj_next ; char * name ; if ( IS_NPC ( ch ) ) { name = ch -> short_descr ; corpse = create_object ( get_obj_index ( OBJ_VNUM_CORPSE_NPC ) , 0 ) ; corpse -> timer = number_range ( 3 , 6 ) ; if ( ch -> gold > 0 ) { obj_to_obj ( create_money ( ch -> gold , ch -> silver ) , corpse ) ; ch -> gold = 0 ; ch -> silver = 0 ; } corpse -> cost = 0 ; } else { name = ch -> name ; corpse = create_object ( get_obj_index ( OBJ_VNUM_CORPSE_PC ) , 0 ) ; corpse -> timer = number_range ( 25 , 40 ) ; REMOVE_BIT ( ch -> act , PLR_CANLOOT ) ; if ( ! is_clan ( ch ) ) corpse -> owner = str_dup ( ch -> name ) ; else { corpse -> owner = NULL ; if ( ch -> gold > 1 || ch -> silver > 1 ) { obj_to_obj ( create_money ( ch -> gold / 2 , ch -> silver / 2 ) , corpse ) ; ch -> gold -= ch -> gold / 2 ; ch -> silver -= ch -> silver / 2 ; } } corpse -> cost = 0 ; } corpse -> level = ch -> level ; sprintf ( buf , corpse -> short_descr , name ) ; free_string ( corpse -> short_descr ) ; corpse -> short_descr = str_dup ( buf ) ; sprintf ( buf , corpse -> description , name ) ; free_string ( corpse -> description ) ; corpse -> description = str_dup ( buf ) ; for ( obj = ch -> carrying ; obj != NULL ; obj = obj_next ) { bool floating = FALSE ; obj_next = obj -> next_content ; if ( obj -> wear_loc == WEAR_FLOAT ) floating = TRUE ; obj_from_char ( obj ) ; if ( obj -> item_type == ITEM_POTION ) obj -> timer = number_range ( 500 , 1000 ) ; if ( obj -> item_type == ITEM_SCROLL ) obj -> timer = number_range ( 1000 , 2500 ) ; if ( IS_SET ( obj -> extra_flags , ITEM_ROT_DEATH ) && ! floating ) { obj -> timer = number_range ( 5 , 10 ) ; REMOVE_BIT ( obj -> extra_flags , ITEM_ROT_DEATH ) ; } REMOVE_BIT ( obj -> extra_flags , ITEM_VIS_DEATH ) ; if ( IS_SET ( obj -> extra_flags , ITEM_INVENTORY ) ) extract_obj ( obj ) ; else if ( floating ) { if ( IS_OBJ_STAT ( obj , ITEM_ROT_DEATH ) ) { if ( obj -> contains != NULL ) { OBJ_DATA * in , * in_next ; act ( " " , ch , obj , NULL , TO_ROOM ) ; for ( in = obj -> contains ; in != NULL ; in = in_next ) { in_next = in -> next_content ; obj_from_obj ( in ) ; obj_to_room ( in , ch -> in_room ) ; } } else act ( " " , ch , obj , NULL , TO_ROOM ) ; extract_obj ( obj ) ; } else { act ( " " , ch , obj , NULL , TO_ROOM ) ; obj_to_room ( obj , ch -> in_room ) ; } } else obj_to_obj ( obj , corpse ) ; } obj_to_room ( corpse , ch -> in_room ) ; return ; }
Make a corpse out of a character.
Make a corpse out of a character .
/* get rid of it! */