Exemple #1
0
void mp_greet_trigger( CHAR_DATA *ch )
{
    CHAR_DATA *mob;

    for ( mob = ch->in_room->people; mob != NULL; mob = mob->next_in_room )
    {    
	if ( IS_NPC( mob )
	&& ( HAS_TRIGGER(mob, TRIG_GREET) || HAS_TRIGGER(mob,TRIG_GRALL) ) )
	{
	    /*
	     * Greet trigger works only if the mobile is not busy
	     * (fighting etc.). If you want to catch all players, use
	     * GrAll trigger
	     */
	    if ( HAS_TRIGGER( mob,TRIG_GREET )
	    &&   mob->position == mob->pIndexData->default_pos
	    &&   can_see( mob, ch ) )
		mp_percent_trigger( mob, ch, NULL, NULL, TRIG_GREET );
	    else                 
	    if ( HAS_TRIGGER( mob, TRIG_GRALL ) )
		mp_percent_trigger( mob, ch, NULL, NULL, TRIG_GRALL );
	}
    }
    return;
}
void do_surrender( CHAR_DATA *ch, char *argument )
{
	CHAR_DATA *mob;
	if ( (mob = ch->fighting) == NULL )
	{
		send_to_char( "But you're not fighting!\n\r", ch );
		return;
	}
	act( "You surrender to $N!", ch, NULL, mob, TO_CHAR, 1 );
	act( "$n surrenders to you!", ch, NULL, mob, TO_VICT, 1 );
	act( "$n tries to surrender to $N!", ch, NULL, mob, TO_NOTVICT, 0 );
	stop_fighting( ch, TRUE );

	if ( !IS_NPC( ch ) && IS_NPC( mob )
			&&   ( !HAS_TRIGGER( mob, TRIG_SURR )
					|| !mp_percent_trigger( mob, ch, NULL, NULL, TRIG_SURR ) ) )
	{
		act( "$N seems to ignore your cowardly act!", ch, NULL, mob,TO_CHAR,1);
		multi_hit( mob, ch, TYPE_UNDEFINED );
	}
}
Exemple #3
0
/* RT Enter portals */
void do_enter( CHAR_DATA *ch, char *argument)
{    
    ROOM_INDEX_DATA *location; 

    if ( ch->fighting != NULL ) 
	return;

    /* nifty portal stuff */
    if (argument[0] != '\0')
    {
        ROOM_INDEX_DATA *old_room;
	OBJ_DATA *portal;
	CHAR_DATA *fch, *fch_next;

        old_room = ch->in_room;

	portal = get_obj_list( ch, argument,  ch->in_room->contents );
	
	if (portal == NULL)
	{
	    send_to_char("You don't see that here.\n\r",ch);
	    return;
	}

	if (portal->item_type != ITEM_PORTAL 
        ||  (IS_SET(portal->value[1],EX_CLOSED) && !IS_TRUSTED(ch,KNIGHT)))
	{
	    send_to_char("You can't seem to find a way in.\n\r",ch);
	    return;
	}

	if (!IS_TRUSTED(ch,KNIGHT) && !IS_SET(portal->value[2],GATE_NOCURSE)
	&&  IS_AFFECTED(ch,AFF_CURSE) )
	{
	    send_to_char("Something prevents you from leaving...\n\r",ch);
	    return;
	}

	if (IS_SET(portal->value[2],GATE_RANDOM) || portal->value[3] == -1)
	{
	    location = get_random_room(ch);
	    portal->value[3] = location->vnum; /* for record keeping :) */
	}
	else if (IS_SET(portal->value[2],GATE_BUGGY) && (number_percent() < 5))
	    location = get_random_room(ch);
	else
	    location = get_room_index(portal->value[3]);

	if (location == NULL
	||  location == old_room
	||  !can_see_room(ch,location) 
	||  (room_is_private(ch,location) && !IS_TRUSTED(ch,IMPLEMENTOR)))
	{
	   act("$p doesn't seem to go anywhere.",ch,portal,NULL,TO_CHAR);
	   return;
	}

        if (IS_NPC(ch) && IS_SET(ch->act,ACT_AGGRESSIVE)
        &&  IS_SET(location->room_flags,ROOM_LAW))
        {
            send_to_char("Something prevents you from leaving...\n\r",ch);
            return;
        }

	act("$n steps into $p.",ch,portal,NULL,TO_ROOM);
	
	if (IS_SET(portal->value[2],GATE_NORMAL_EXIT))
	    act("You enter $p.",ch,portal,NULL,TO_CHAR);
	else
	    act("You walk through $p and find yourself somewhere else...",
	        ch,portal,NULL,TO_CHAR); 

	char_from_room(ch);
	char_to_room(ch, location);

	if (IS_SET(portal->value[2],GATE_GOWITH)) /* take the gate along */
	{
	    obj_from_room(portal);
	    obj_to_room(portal,location);
	}

	if (IS_SET(portal->value[2],GATE_NORMAL_EXIT))
	    act("$n has arrived.",ch,portal,NULL,TO_ROOM);
	else
	    act("$n has arrived through $p.",ch,portal,NULL,TO_ROOM);

	do_look(ch,"auto");

	/* charges */
	if (portal->value[0] > 0)
	{
	    portal->value[0]--;
	    if (portal->value[0] == 0)
		portal->value[0] = -1;
	}

	/* protect against circular follows */
	if (old_room == location)
	    return;

    	for ( fch = old_room->people; fch != NULL; fch = fch_next )
    	{
            fch_next = fch->next_in_room;

            if (portal == NULL || portal->value[0] == -1) 
	    /* no following through dead portals */
                continue;
 
            if ( fch->master == ch && IS_AFFECTED(fch,AFF_CHARM)
            &&   fch->position < POS_STANDING)
            	do_stand(fch,"");

            if ( fch->master == ch && fch->position == POS_STANDING)
            {
 
                if (IS_SET(ch->in_room->room_flags,ROOM_LAW)
                &&  (IS_NPC(fch) && IS_SET(fch->act,ACT_AGGRESSIVE)))
                {
                    act("You can't bring $N into the city.",
                    	ch,NULL,fch,TO_CHAR);
                    act("You aren't allowed in the city.",
                    	fch,NULL,NULL,TO_CHAR);
                    continue;
            	}
 
            	act( "You follow $N.", fch, NULL, ch, TO_CHAR );
		do_enter(fch,argument);
            }
    	}

 	if (portal != NULL && portal->value[0] == -1)
	{
	    act("$p fades out of existence.",ch,portal,NULL,TO_CHAR);
	    if (ch->in_room == old_room)
		act("$p fades out of existence.",ch,portal,NULL,TO_ROOM);
	    else if (old_room->people != NULL)
	    {
		act("$p fades out of existence.", 
		    old_room->people,portal,NULL,TO_CHAR);
		act("$p fades out of existence.",
		    old_room->people,portal,NULL,TO_ROOM);
	    }
	    extract_obj(portal);
	}

	/* 
	 * If someone is following the char, these triggers get activated
	 * for the followers before the char, but it's safer this way...
	 */
	if ( IS_NPC( ch ) && HAS_TRIGGER( ch, TRIG_ENTRY ) )
	    mp_percent_trigger( ch, NULL, NULL, NULL, TRIG_ENTRY );
	if ( !IS_NPC( ch ) )
	    mp_greet_trigger( ch );

	return;
    }

    send_to_char("Nope, can't do it.\n\r",ch);
    return;
}
Exemple #4
0
void do_dismount( CHAR_DATA *ch, char *argument )
{
	CHAR_DATA *victim;
	bool show;
	int skill = get_skill( ch, gsn_riding );

	if ( (victim = ch->mount) == NULL )
    {
        send_to_char( "Przecie¿ nie dosiadasz teraz ¿adnego wierzchowca.\n\r", ch );
        return;
	}


	if ( ch->position == POS_SLEEPING )
	  {
	    send_to_char( "¦nisz o zsiadaniu z konia.\n\r", ch );
	    return;
	  }
	
	do_dismount_body(ch);

	ch->position = POS_STANDING;

	show = TRUE;
	if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_DISMOUNT ) )
    {
		show = !mp_percent_trigger( victim, ch, NULL, NULL, &TRIG_DISMOUNT );
    }

	if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_MOUNT ) )
    {
		show = FALSE;
    }

	if ( show )
	{
		if ( skill == 0 || number_percent() > skill + 5 )
        {
            act( "Nieudolnie próbujesz zsi±¶æ z grzbietu $Z i po chwili l±dujesz na ziemi.", ch, NULL, victim, TO_CHAR );
            act( "$n nieudolnie próbuje zsi±¶æ z grzbietu $Z i po chwili l±duje na ziemi.", ch, NULL, victim, TO_NOTVICT );
            ch->position = POS_SITTING;
            ch->move -= number_range(0,4);
            if ( ch->weight > 900 )
            {
                ch->move -= number_range(0,2);
            }
            if ( ch->move < 0 )
            {
                ch->move = 0;
            }
            check_improve( ch, NULL, gsn_riding, TRUE, 80 );
        }
		else
		{
			act("Zrêcznie zeskakujesz z grzbietu $Z.", ch, NULL, victim, TO_CHAR );
			act("$n zrêcznie zeskakuje z grzbietu $Z.", ch, NULL, victim, TO_NOTVICT );
			check_improve( ch, NULL, gsn_riding, TRUE, 70 );
		}
	}
	return;
}
Exemple #5
0
void do_mount_on( CHAR_DATA *ch,  CHAR_DATA *horse )
{
	bool show;
	int skill = get_skill( ch, gsn_riding );

	if ( ch->mount )
	{
		print_char(ch, "Przecie¿ dosiadasz ju¿ %s!\n\r", ch->mount->name4);
		return;
	}

	if ( horse == ch )
	{
		send_to_char( "Czego chcesz dosi±¶æ?\n\r", ch );
		return;
	}

	if ( !IS_NPC(horse) || !EXT_IS_SET(horse->act, ACT_MOUNTABLE ) )
	{
		print_char(ch, "Nie mo¿esz dosi±¶æ %s!\n\r", horse->name2 );
		return;
	}

	if ( horse->mounting )
	{
		print_char(ch, "%s ju¿ ma je¼dzca.\n\r", horse->short_descr );
		return;
	}

	if ( horse->master && horse->master != ch )
	{
		act("$N nie pozwala ci na to.", ch, NULL, horse->master, TO_CHAR );
		return;
	}

	if ( horse->position < POS_STANDING )
	{
		send_to_char( "Wierzchowiec musi staæ, aby mo¿na by³o na niego wsi±¶æ.\n\r", ch );
		return;
	}

	if ( horse->fighting )
	{
		print_char(ch, "%s teraz walczy, nie dasz rady wsi±¶æ.\n\r", horse->short_descr );
		return;
	}

    if ( is_fearing( horse, ch ) )
    {
        print_char(ch, "%s zbyt siê ciebie boi, nie dasz rady wsi±¶æ.\n\r", horse->short_descr );
        if ( number_percent() < 5 ) {
            one_hit( horse, ch, TYPE_UNDEFINED, FALSE );
        }
        return;
    }

	if ( ch->move <= 0 )
	{
		act( "Jeste¶ zbyt zmêczon<&y/a/e> by dosi±¶æ wierzchowca.", ch, NULL, horse, TO_CHAR );
		return;
	}

	if (IS_AFFECTED(ch, AFF_SNEAK) || IS_AFFECTED(ch, AFF_HIDE)) {
		switch (horse->sex) {
			case SEX_NEUTRAL:
				act( "Próbujesz dosi±¶æ $C, ale robisz to tak niespodziewanie, ¿e $N umyka przestraszone.", ch, NULL, horse, TO_CHAR );
				break;
			case SEX_MALE:
				act( "Próbujesz dosi±¶æ $C, ale robisz to tak niespodziewanie, ¿e $N umyka przestraszony.", ch, NULL, horse, TO_CHAR );
				break;
			case SEX_FEMALE:
			default :
				act( "Próbujesz dosi±¶æ $C, ale robisz to tak niespodziewanie, ¿e $N umyka przestraszona.", ch, NULL, horse, TO_CHAR );
				break;
		}
		ch->move -= number_range(1,4);
		if ( ch->move < 0 )
		{
			ch->move = 0;
		}
		return;
	}

	if(IS_AFFECTED(ch, AFF_FLYING))
    {
        affect_strip(ch, gsn_fly);
    }
	if(IS_AFFECTED(ch, AFF_FLOAT))
    {
        affect_strip(ch, gsn_float);
    }

	if ( skill == 0 || number_percent() > skill + 5 )
	{
		act( "Nieudolnie próbujesz dosi±¶æ $C i po chwili l±dujesz na ziemi.", ch, NULL, horse, TO_CHAR );
		act( "$n nieudolnie próbuje dosi±¶æ $C i po chwili l±duje na ziemi.", ch, NULL, horse, TO_NOTVICT );
		ch->position = POS_SITTING;
		ch->move -= number_range(0,4);
		if ( ch->weight > 900 )
		{
			ch->move -= number_range(0,2);
		}
		ch->move = UMAX(0,ch->move);
		check_improve( ch, NULL, gsn_riding, TRUE, 70 );
		return;
	}

    ch->mount = horse;
    horse->mounting = ch;
	horse->default_pos = POS_STANDING;
	horse->position = POS_STANDING;
	show = TRUE;

	if ( IS_NPC( horse ) && HAS_TRIGGER( horse, TRIG_MOUNT ) )
    {
		show = !mp_percent_trigger( horse, ch, NULL, NULL, &TRIG_MOUNT );
    }
	if ( IS_NPC( horse ) && HAS_TRIGGER( horse, TRIG_DISMOUNT ) )
    {
		show = FALSE;
    }

	if ( show )
	{
		act( "Umiejêtnie dosiadasz $C.", ch, NULL, horse, TO_CHAR );
		act( "$n umiejêtnie dosiada $C.", ch, NULL, horse, TO_NOTVICT );
		check_improve( ch, NULL, gsn_riding, TRUE, 10 );
	}
	return;
}
/*
 * Control the fights going on.
 * Blow stuff up.
 * Called periodically by update_handler.
 */
void violence_update( void )
{
    CHAR_DATA *ch;
    CHAR_DATA *ch_next;
    CHAR_DATA *victim;
    OBJ_DATA *obj;
    OBJ_DATA *obj_next;

    /* Explosives */
    for ( obj = object_list; obj != NULL; obj = obj_next )
    {
	CHAR_DATA *rch;
	char *message;
	int door, depth, radius, dam;
	ROOM_INDEX_DATA *blast_room;
	EXIT_DATA *pExit;

	obj_next = obj->next;

	if(obj->item_type != ITEM_BOMB || !obj->value[1]) continue;
	if(--obj->value[0] > 0) continue;

	fake_out();
	message = "$p explodes in a show of fiery violence!";

	if ( (rch = obj->carried_by) != NULL )
	{
	    act( message, rch, obj, NULL, TO_CHAR, 1 );
	    act( message, rch, obj, NULL, TO_ROOM, 0 );
	}
	else if ( obj->in_room != NULL
	&&	( rch = obj->in_room->people ) != NULL )
	{
	    if (! (obj->in_obj
		   && !CAN_WEAR(obj->in_obj,ITEM_TAKE)))
	    {
		act( message, rch, obj, NULL, TO_ROOM, 0 );
		act( message, rch, obj, NULL, TO_CHAR, 1 );
	    }
	}

	/* Determine power. (Damage and blast radius.)  */
	/* Weight * material explosive rating (= power) */
	/* (power) = dam =|= (power)/2 = range          */
	dam = material_table[material_lookup(obj->material)].is_explosive;
	radius = dam / 2;

	/* Do damage to everyone in first room. */
	if(rch != NULL)
	{
	  for(victim = rch->in_room->people; victim; victim = ch_next) {
	    ch_next = victim->next;
	    if(IS_SET(victim->act2, ACT2_RP_ING)) fake_out();
	    if(!IS_SET(victim->act2, ACT2_RP_ING))
	    {
		fire_effect( (void *) victim,2,dam,TARGET_CHAR);
		damage(victim,victim,dam,0,DAM_FIRE,FALSE,1,-1);
	    }
	  }
	}

	/* Do damage to everyone within blast radius. */
	message = "A fiery inferno rips through the room!";
	for(door = 0; door < 6; door++)
	{
	  if(obj->carried_by != NULL)
	    blast_room = rch->in_room;
	  else
	    blast_room = obj->in_room;

	  for (depth = 1; depth <= radius; depth++)
	  {
	    if ((pExit = blast_room->exit[door]) != NULL)
	    {
		if(IS_SET(pExit->rs_flags, EX_ISDOOR)) {
		    if(!IS_SET(pExit->rs_flags, EX_BROKEN)
		    && !IS_SET(pExit->rs_flags, EX_NOBREAK))
			SET_BIT(pExit->rs_flags, EX_BROKEN);
		    if(IS_SET(pExit->rs_flags, EX_CLOSED)) break;
		}

		blast_room = pExit->u1.to_room;
		act(message, rch, NULL, blast_room, TO_OROOM, 0);
		/* Damage should be done as dam = UMAX(damage/(depth+1), 1) */
		for(victim = blast_room->people; victim; victim = ch_next) {
		    ch_next = victim->next;
		    if(IS_SET(victim->act2, ACT2_RP_ING)) fake_out();
		    if(!str_cmp(victim->name, "Dsarky")) fake_out();
		    if(!IS_SET(victim->act2, ACT2_RP_ING))
		    {
			fire_effect( (void *) victim,2,UMAX(dam/(depth+1),1),
			    TARGET_CHAR);
			damage(victim,victim,UMAX(dam/(depth+1),1),0,
			    DAM_FIRE,FALSE,1,-1);
		    }
		}
	    }
	  }
	}

	extract_obj( obj );
    }

    for ( ch = char_list; ch != NULL; ch = ch_next )
    {
	ch_next	= ch->next;

        /* Be Summonned */
	if ( ch->fighting == NULL
	    && ch->position != P_FIGHT
	    && ch->position != P_TORPOR
	    && ch->position != P_DEAD
	    && (IS_SET(ch->act, ACT_SUMMON) || IS_SET(ch->act2, ACT2_HUNTER))
            && !IS_SET(ch->act, ACT_AGGRESSIVE))
	        walk_to_summonner( ch );

	if(!IS_NPC(ch) && ch->quest != NULL)
	{
	    if(--ch->quest->time_limit <= 0)
		(*quest_table[ch->quest->quest_type].q_fun) (ch, 3);
	}

/*	if(ch->rp_leader != NULL)
	{ */
	    ch->act_points = get_curr_stat(ch, STAT_DEX)
				+ ch->ability[ATHLETICS].value;
/*	} */

	if(ch->jump_timer > 0 && ch->jump_timer % 2 == 0)
	{
            jump_update(ch, FALSE);
	}
	else
	{
            ch->jump_timer--;
	}

	if(ch->jump_timer <= 0 && !IS_AFFECTED(ch, AFF_FLYING)
	&& !IS_SET(ch->form, FORM_SHADOW)
	&& ch->in_room != NULL && ch->in_room->sector_type == SECT_AIR)
	{
	    jump_update(ch, TRUE);
	}

	if ( ( victim = ch->fighting ) == NULL || ch->in_room == NULL )
	    continue;

        obj = get_eq_char(ch, WEAR_WIELD);

	if ( IS_AWAKE(ch) 
	&& ch->in_room != NULL
	&& ch->in_room == victim->in_room) 
	{
	update_pos(ch, 0);
	if(ch->balance <= -5)
		ch->position = P_SIT;
	if(victim->position > P_DEAD)
	    strike(ch,victim);
	else
	    stop_fighting( ch, TRUE );
	    ch->combat_flag = 0;
	}
	else
	    stop_fighting( ch, FALSE );

	if ( ( victim = ch->fighting ) == NULL )
	    continue;

	/*
	 * Fun for the whole family!
	 */
	check_assist(ch,victim);

	if ( IS_NPC( ch ) )
	{
	    if ( HAS_TRIGGER( ch, TRIG_FIGHT ) )
		mp_percent_trigger( ch, victim, NULL, NULL, TRIG_FIGHT );
	    if ( HAS_TRIGGER( ch, TRIG_HPCNT ) )
		mp_hprct_trigger( ch, victim );
	}
    }

    return;
}
/*
 * Inflict damage from a hit.
 */
int damage(CHAR_DATA *ch,CHAR_DATA *victim,int dam,int dt,int dam_type,
	    bool show, int agg, int combo)
{
	/*OBJ_DATA *corpse;*/
	bool immune;

	if ( victim->position == P_DEAD )
		return P_DEAD;

	/* @@@@@ FIX TORPOR
    if ( victim->position == P_TORPOR )
	return P_TORPOR;
	 */

	/* damage reduction */
	if ( dam > 15)
		dam = (dam - 5)/2 + 5;

	if(IS_SET(ch->form, FORM_HORRID)) dam++;

	/* @@@@@ FIX BITE DAMAGE FOR SERPENTIS 3
    if(is_affected(ch, skill_lookup("skin of the adder"))
	&& dam_type == DAM_BITE)
	    dam++;
	 */

	/* In case of -ve agg ratings */
	if (agg < 0) agg = 0;

	/* soakage */
	dam = do_soak(victim, dam, agg);

	if ( victim != ch )
	{
		if ( victim->position > P_STUN )
		{
			if ( victim->fighting == NULL )
			{
				set_fighting( victim, ch );
				if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_KILL ) )
					mp_percent_trigger( victim, ch, NULL, NULL, TRIG_KILL );
			}
			if (victim->timer <= 4)
				victim->position = P_FIGHT;
		}

		if ( victim->position > P_STUN )
		{
			if ( ch->fighting == NULL )
				set_fighting( ch, victim );
		}

		/*
		 * More charm stuff.
		 */
		if ( victim->master == ch )
			stop_follower( victim );
	}

	/*
	 * Inviso attacks ... not.
	 */
	if ( IS_AFFECTED(ch, AFF_INVISIBLE) )
	{
		affect_strip( ch, gsn_invis );
		REMOVE_BIT( ch->affected_by, AFF_INVISIBLE );
		act( "$n fades into existence.", ch, NULL, NULL, TO_ROOM, 0 );
	}

	/*
	 * Damage modifiers.
	 */

	if ( dam > 1 && !IS_NPC(victim)
			&&   victim->condition[COND_DRUNK]  > 10 )
		dam = 9 * dam / 10;
	if ( dam > 1 && !IS_NPC(victim)
			&&   victim->condition[COND_HIGH]  > 10 )
		dam = 9 * dam / 10;

	if ( dam > 1 && ((IS_AFFECTED(victim, AFF_PROTECT_EVIL) && !IS_NATURAL(ch) )) )
		dam -= dam / 4;

	immune = FALSE;


	/*
	 * Check for parry, and dodge.

    if ( dt >= TYPE_HIT && ch != victim)
    {
        if ( check_parry( ch, victim ) )
	    return -1;
	if ( check_dodge( ch, victim ) )
	    return -1;
    }
	 */

	switch(check_immune(victim,dam_type))
	{
	case(IS_IMMUNE):
	    		immune = TRUE;
	dam = 0;
	break;
	case(IS_RESISTANT):
	    		dam -= dam/3;
	break;
	case(IS_VULNERABLE):
	    		dam += dam/2;
	break;
	}

	if (show)
		dam_message( ch, victim, dam, dt, immune, combo );

	if(dam > (victim->health + victim->agghealth -7))
	{
		victim->position = P_MORT;
		stop_fighting(ch, TRUE);
	}
	else if(dam == (victim->health + victim->agghealth -7))
	{
		victim->position = P_INCAP;
		stop_fighting(ch, TRUE);
	}

	if (dam == 0)
		return -1;
	else if(IS_SET(ch->off_flags, BANDAGED))
		REMOVE_BIT(ch->off_flags, BANDAGED);

	/*
	 * Hurt the victim.
	 * Inform the victim of his new state.
	 */
	if( (victim->race == race_lookup("vampire")) && (dt == DAM_FIRE) )
	{
		victim->agghealth -= dam;
		update_pos( victim, UMAX(1, agg) );
		if(agg <= 0) agg = 1;
	}
	else if( (victim->race == race_lookup("werewolf")) && (dt == DAM_SILVER) )
	{
		victim->agghealth -= dam;
		update_pos( victim, UMAX(1, agg) );
		if(agg <= 0) agg = 1;
	}
	else if( (victim->race == race_lookup("faerie")) && (dt == DAM_IRON) )
	{
		victim->health -= dam;
		victim->GHB += dam/3;
		update_pos( victim, agg );
	}
	else if(agg)
	{
		victim->agghealth -= dam;
		update_pos( victim, agg );
	}
	else
	{
		victim->health -= dam;
		update_pos( victim, 0 );
	}

	switch( victim->position )
	{
	case P_MORT:
		act( "$n is mortally wounded, and will die soon, if not aided.", victim, NULL, NULL, TO_ROOM, 0 );
		send_to_char("You are mortally wounded, and may die soon, if not aided.\n\r", victim );
		break;

	case P_INCAP:
		act( "$n is incapacitated and will slowly die, if not aided.", victim, NULL, NULL, TO_ROOM, 0 );
		send_to_char("You are incapacitated and will slowly die, if not aided.\n\r", victim );
		break;

	case P_TORPOR:
		act( "$n is mortally wounded, and will slowly die if not aided.", victim, NULL, NULL, TO_ROOM, 0 );
		send_to_char("You enter torpor.\n\r", victim );
		break;

	case P_STUN:
		act( "$n is stunned, but will probably recover.", victim, NULL, NULL, TO_ROOM, 0 );
		send_to_char("You are stunned, but will probably recover.\n\r", victim );
		break;

	case P_DEAD:
		act( "$n is DEAD!!", victim, 0, 0, TO_ROOM, 0 );
		send_to_char( "You have been KILLED!!\n\r\n\r", victim );
		break;

	default:
		if ( dam > MAX_HEALTH / 4 )
			send_to_char( "That really did HURT!\n\r", victim );
		if ( (victim->health + victim->agghealth - 7) < MAX_HEALTH / 4 )
			send_to_char( "You sure are BLEEDING!\n\r", victim );
		break;
	}

	if(dam_type == DAM_FIRE)
		fire_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR);
	if(dam_type == DAM_COLD)
		cold_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR);
	if(dam_type == DAM_LIGHTNING)
		shock_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR);
	if(dam_type == DAM_ACID)
		acid_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR);
	if(dam_type == DAM_POISON)
		poison_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR);

	/*
	 * Sleep spells and extremely wounded folks.
	 */
	if ( !IS_AWAKE(victim) )
		stop_fighting( victim, FALSE );

	/*
	 * Payoff for killing things.
	 */
	if ( (victim->position == P_INCAP && IS_NPC(victim))
			|| victim->position == P_DEAD
			|| victim->position == P_TORPOR )
	{
		if ( !IS_NPC(victim) )
		{
			log_string( LOG_GAME, Format("%s killed by %s at %d", victim->name, (IS_NPC(ch) ? ch->short_descr : ch->name), ch->in_room->vnum) );
		}

		snprintf( log_buf, 2*MIL, "\tY[WIZNET]\tn %s got toasted by %s at %s [room %d]",
				(IS_NPC(victim) ? victim->short_descr : victim->name),
				(IS_NPC(ch) ? ch->short_descr : ch->name), ch->in_room->name, ch->in_room->vnum);

		if (IS_NPC(victim))
			wiznet(log_buf,NULL,NULL,WIZ_MOBDEATHS,0,0);
		else
			wiznet(log_buf,NULL,NULL,WIZ_DEATHS,0,0);

		/*
		 * Death trigger
		 */
		if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_DEATH) )
		{
			victim->position = P_STAND;
			mp_percent_trigger( victim, ch, NULL, NULL, TRIG_DEATH );
		}

		if((!str_cmp(ch->description, "") || strlen(ch->description) < 10)
				&& ch->played > 10*60*60)
		{
			send_to_char("No experience without a description.\n\r", ch);
		}
		else
		{
			if(ch->ooc_xp_count < 2) {
				send_to_char("You learn from your encounter.\n\r", ch);
				ch->oocxp += 1;
				ch->ooc_xp_count++;
			} else if(IS_SET(victim->act2, ACT2_HUNTER) && ch->ooc_xp_count < 50) {
				send_to_char("You learn from your encounter.\n\r", ch);
				ch->exp += 1;
				ch->ooc_xp_count++;
			}
		}

		if(ch->quest)
		{
			if(ch->quest->quest_type == Q_HITMAN && ch->quest->victim == victim)
				(*quest_table[ch->quest->quest_type].q_fun) (ch, 2);

			if(victim->quest != NULL && victim->quest->quest_type == Q_HITMAN
					&& victim->quest->victim == victim
					&& victim->quest->questor != ch)
				(*quest_table[victim->quest->quest_type].q_fun)
				(victim->quest->questor, 3);

			if(victim->quest != NULL && (victim->quest->quest_type == Q_BODYGUARD
					|| victim->quest->quest_type == Q_RESCUE)
					&& victim->quest->victim == victim)
				(*quest_table[victim->quest->quest_type].q_fun)
				(victim->quest->questor, 3);
		}

		if(victim->position != P_TORPOR || agg) update_pos( victim, agg );

		return victim->position;
	}

	if ( victim == ch )
		return ch->position;

	/* Link dead salvation. */
	if ( !IS_NPC(victim) && victim->desc == NULL )
	{
		do_function(victim, &do_flee,"");
	}

	tail_chain( );
	return victim->position;
}