fight.c

vw/src/fight.c · 319.2 KB

From the archive vw_1.0.2.tgz

Download the archive   « Back to the archive contents

/***************************************************************************
*  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
*  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
*                                                                         *
*  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
*  Chastain, Michael Quan, and Mitchell Tse.                              *
*                                                                         *
*  In order to use any part of this Merc Diku Mud, you must comply with   *
*  both the original Diku license in 'license.doc' as well the Merc       *
*  license in 'license.txt'.  In particular, you may not remove either of *
*  these copyright notices.                                               *
*                                                                         *
*  Much time and thought has gone into this software and you are          *
*  benefitting.  We hope that you share your changes too.  What goes      *
*  around, comes around.                                                  *
***************************************************************************/

#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include "merc.h"


int dam2;


/*
* Local functions.
*/
bool  check_dodge args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void  check_killer   args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
bool  check_parry args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) );
void  dam_message args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam,
				   int dt ) );
void  death_cry   args( ( CHAR_DATA *ch ) );
void  group_gain  args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
int   xp_compute  args( ( CHAR_DATA *gch, CHAR_DATA *victim ) );
bool  is_safe     args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void  make_corpse args( ( CHAR_DATA *ch ) );
void  one_hit     args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt, int handtype ) );
void  raw_kill args( ( CHAR_DATA *victim ) );
void  set_fighting   args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void  disarm      args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void  trip     args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void  bash     args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void  improve_wpn args( ( CHAR_DATA *ch, int dtype, bool right_hand ) );
void  improve_stance args( ( CHAR_DATA *ch ) );
void  skillstance args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void  show_spell  args( ( CHAR_DATA *ch, int dtype ) );
void  fightaction args( ( CHAR_DATA *ch, CHAR_DATA *victim, int actype, int dtype, int wpntype ) );
void    crack_head      args( ( CHAR_DATA *ch, OBJ_DATA *obj, char *argument ) );
void  critical_hit   args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt, int dam) );
void  take_item   args( ( CHAR_DATA *ch, OBJ_DATA *obj ) );
void  clear_stats args( ( CHAR_DATA *ch ) );



/*
* Control the fights going on.
* Called periodically by update_handler.
*/
void violence_update( void )
{
    CHAR_DATA *ch;
    CHAR_DATA *ch_next;
    CHAR_DATA *victim;
    CHAR_DATA *rch;
    CHAR_DATA *rch_next;
    
    for ( ch = char_list; ch != NULL; ch = ch->next )
    {
	   ch_next  = ch->next;
	   
	   if ( ( victim = ch->fighting ) == NULL || ch->in_room == NULL )
	   {
		  continue;
	   }
	   
	   if ( IS_AWAKE(ch) && ch->in_room == victim->in_room )
	   {
		  multi_hit( ch, victim, TYPE_UNDEFINED );
	   }
	   else
	   {
		  stop_fighting( ch, FALSE );
	   }
	   
	   if ( ( victim = ch->fighting ) == NULL )
	   {
		  continue;
	   }
	   
        
	   /* Fun for the whole family! */
        
	   for ( rch = ch->in_room->people; rch != NULL; rch = rch_next )
	   {
		  rch_next = rch->next_in_room;
		  
		  if ( IS_AWAKE(rch) && rch->fighting == NULL )
		  {
			 
			 
			 /* Mount's auto-assist their riders and vice versa. */
			 
			 if ( rch->mount != NULL && rch->mount == ch )
			 {
                                one_hit( rch, victim, TYPE_UNDEFINED,0 );
				continue;
			 }
			 
			 
			 /* PC's auto-assist others in their group. */
			 
			 if ( !IS_NPC(ch) || IS_AFFECTED(ch, AFF_CHARM) )
			 {
				if ( ( !IS_NPC(rch) || IS_AFFECTED(rch, AFF_CHARM) )
                                    && is_same_group(ch, rch) 
                                    && !IS_AFFECTED(rch, AFF_SHADOWPLANE) )
                                    one_hit( rch, victim, TYPE_UNDEFINED, 0 );
				continue;
			 }
			 
                
			 /* NPC's assist NPC's of same type or 12.5% chance regardless. */
			 
			 if ( IS_NPC(rch) && !IS_AFFECTED(rch, AFF_CHARM) )
			 {
				if ( rch->pIndexData == ch->pIndexData
				    ||   (number_bits( 3 ) == 0  && IS_NPC(ch)) )
				{
				    CHAR_DATA *vch;
				    CHAR_DATA *target;
				    int number;
				    
				    target = NULL;
				    number = 0;
				    for ( vch = ch->in_room->people; vch; vch = vch->next )
				    {
					   if ( can_see( rch, vch )
						  &&   is_same_group( vch, victim )
						  &&   number_range( 0, number ) == 0 )
					   {
						  target = vch;
						  number++;
					   }
				    }
				    
				    if ( target != NULL )
				    {
					   multi_hit( rch, target, TYPE_UNDEFINED );
				    }
				}
			 }
		  }
	   }
    }
    
    return;
}



/*
* Do one group of attacks.
*/
void multi_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
{
    OBJ_DATA *wieldR;
    OBJ_DATA *wieldL;
    int      sn, level, hand, mobatt, l, celatt, gen, throw, was_stun;
    char buf[MAX_STRING_LENGTH];
    
    
    wieldR = get_eq_char( ch, WEAR_WIELD );
    wieldL = get_eq_char( ch, WEAR_HOLD );
    gen = ch->vampgen;
    throw = 0;
    was_stun = 0;
    
    /* NEW CODE BY ARCHON */
    
    
    /* First, the mob attacks */
    if ( IS_NPC(ch) )
    {
	   mobatt = ch->level / 25;       /* one attack every 25 levels */
	   if ( mobatt > 5 ) mobatt = 5;  /* limit them to 5 max */
	   if ( mobatt < 1 ) mobatt = 1;  /* gotta let em have at least 1 :> */
	   for (l=0; l < mobatt; ++l)
	   {
		  hand = number_range( 1, 2);
		  one_hit( ch, victim, -1, hand);
	   }     
    }
    
    /* Now the player stuff to handle dual wielding, stances, and */
    /* various vampire attacks.                                   */
    
				/* Valis*/
    
    if  (!IS_NPC(ch)  &&  (IS_AFFECTED(ch, AFF_POLYMORPH)))
    {
	   act( "Your concentration is lost in combat, you return to human form.", ch, NULL, NULL, TO_CHAR );
	   act( "$n loses concentration in combat and returns to human form.", ch, NULL, NULL, TO_ROOM );
	   clear_stats(ch);
	   while(ch->affected)
		  affect_remove(ch, ch->affected);
	   REMOVE_BIT(ch->affected_by, AFF_POLYMORPH);
	   REMOVE_BIT(ch->vampaff, VAM_CHANGED);
	   REMOVE_BIT(ch->polyaff, POLY_MIST);
	   REMOVE_BIT(ch->affected_by, AFF_ETHEREAL);
	   free_string( ch->morph );
	   ch->morph = str_dup( "" );
	   return;
    }
    
    
    if ( (wieldR != NULL && wieldR->item_type == ITEM_WEAPON) &&
	   (wieldL != NULL && wieldL->item_type == ITEM_WEAPON) )
	   throw = number_range( 1, 2);
    
    
    
    /* IF WEAPON IN RIGHT HAND, DO AN ATTACK */
    if ( !IS_NPC(ch) && wieldR != NULL && wieldR->item_type == ITEM_WEAPON )
    {
	   if ( victim->position == POS_STUNNED )
		  was_stun = 1;
	   
	   one_hit( ch, victim, -1, 1);
	   
	   /* DO THE SPELL FOR SPELL THROWING WEAPONS */
	   
	   if ( throw == 0 ) throw = 1;
	   
	   if (wieldR->value[0] >= 1 && throw == 1)
	   {
		  
		  
		  if (wieldR->value[0] >= 1000)
			 sn = wieldR->value[0] - ((wieldR->value[0] / 1000) * 1000);
		  else
			 sn = wieldR->value[0];
		  
		  if (sn != 0 && victim->position == POS_FIGHTING)
			 (*skill_table[sn].spell_fun) (sn,wieldR->level,ch,victim);
	   } 
	   
    }
    
    
    
    
    /* IF WEAPON IN LEFT HAND, DO AN ATTACK */
    if ( !IS_NPC(ch) && wieldL != NULL && wieldL->item_type == ITEM_WEAPON )
    {
	   if ( was_stun == 1 )
		  return;
	   else if ( victim->position == POS_STUNNED )
		  was_stun = 1;
	   
	   one_hit( ch, victim, -1, 2);
	   
	   /* DO THE SPELL FOR SPELL THROWING WEAPONS */
        
	   if ( throw == 0 ) throw = 2;
	   
	   if ( wieldL->value[0] >= 1 && throw == 2)
	   {
		  if (wieldL->value[0] >= 1000)
			 sn = wieldL->value[0] - ((wieldL->value[0] / 1000) * 1000);
		  else
			 sn = wieldL->value[0];
		  
		  if (sn != 0 && victim->position == POS_FIGHTING)
			 (*skill_table[sn].spell_fun) (sn,wieldL->level,ch,victim);
	   } 
	   
    }
    
    /* IF NO WEAPONS, DO AN ATTACK, SO WE GET AT LEAST ONE */
    if ( !IS_NPC(ch) &&
	   (wieldR == NULL || wieldR->item_type != ITEM_WEAPON) &&
	   (wieldL == NULL || wieldL->item_type != ITEM_WEAPON) )
    {
	   if ( was_stun == 1 )
		  return;
	   else if ( victim->position == POS_STUNNED )
		  was_stun = 1;
	   
	   hand = number_range( 1, 2);
	   one_hit( ch, victim, -1, hand);
    }   
    
    
    
    
    /* IF IN VIPER STANCE, CHECK FOR ATTACK, AND DO IT IF TRUE */
    if ( !IS_NPC(ch) &&
	   (ch->stance[0] == STANCE_VIPER) &&
	   number_percent() <= (ch->stance[STANCE_VIPER] / 2 ) )
    {
	   if ( was_stun == 1 )
		  return;
	   
	   hand = number_range( 1, 2);
	   one_hit( ch, victim, -1, hand);
    }         
    
    /* IF IN COBRA STANCE, CHECK FOR ATTACKS, AND DO THEM IF TRUE */
    if ( !IS_NPC(ch) &&
	   (ch->stance[0] == STANCE_COBRA) &&
	   number_percent() <= (ch->stance[STANCE_COBRA] / 2 ) )
    {
	   if ( was_stun == 1 )
		  return;
	   
	   hand = number_range( 1, 2);
	   one_hit( ch, victim, -1, hand);
	   hand = number_range( 1, 2);
	   one_hit( ch, victim, -1, hand);
    }   
    
    /* IF IN PANTHER STANCE, CHECK FOR ATTACKS, AND DO THEM IF TRUE */
    if ( !IS_NPC(ch) &&
	   (ch->stance[0] == STANCE_PANTHER) &&
	   number_percent() <= (ch->stance[STANCE_PANTHER] / 2 ) )
    {
	   if ( was_stun == 1 )
		  return;
	   
	   hand = number_range( 1, 2);
	   one_hit( ch, victim, -1, hand);
	   hand = number_range( 1, 2);
	   one_hit( ch, victim, -1, hand);
    }    
    
    /* IF IN LION STANCE, CHECK FOR ATTACKS, AND DO THEM IF TRUE */
    if ( !IS_NPC(ch) &&
	   (ch->stance[0] == STANCE_LION) &&
	   number_percent() <= (ch->stance[STANCE_LION] / 2 ) )
    {
	   if ( was_stun == 1 )
		  return;
	   
	   hand = number_range( 1, 2);
	   one_hit( ch, victim, -1, hand);
	   hand = number_range( 1, 2);
	   one_hit( ch, victim, -1, hand);
    }    
    
    /* IF CHARACTER HAS CELERITY, DO EXTRA ATTACKS */
    if ( !IS_NPC(ch) && IS_VAMPAFF(ch, VAM_CELERITY) )
    {
	   if ( was_stun == 1 )
		  return;
	   
	   celatt = 1;
	   if ( get_age(ch) > 199 )
		  celatt = 2;
	   if ( get_age(ch) > 399 )
		  celatt = 3;
	   if ( get_age(ch) > 599 && IS_VAMPAFF(ch, VAM_CELERITY) )
		  celatt = 4;
	   
	   if ( (( get_age(ch) < 99 ) ||
		  (get_age(ch) > 199 && get_age(ch) < 300) ||
		  (get_age(ch) > 399 && get_age(ch) < 500) ||
		  (get_age(ch) > 599 && IS_VAMPAFF(ch, VAM_CELERITY)) )
		  && number_percent() < ((13 - gen) * 5) )
		  celatt += 1;
	   
	   if ( ((get_age(ch) > 99 && get_age(ch) < 200) ||
		  (get_age(ch) > 299 && get_age(ch) < 400) ||
		  (get_age(ch) > 499 && get_age(ch) < 600))
		  && number_percent() < (((13 - gen) * 5)+50) )
		  celatt += 1;
	   
	   if ( celatt > 5 )
		  celatt = 5;
	   
	   for (l=0; l < celatt; ++l)
	   {
		  hand = number_range( 1, 2);
		  one_hit( ch, victim, -1, hand);
	   }     
    }
    
    /* IF CHARACTER HAS FANGS OUT, DO AN EXTRA ATTACK */
    if ( !IS_NPC(ch) && IS_VAMPAFF(ch, VAM_FANGS) )
    {
	   if ( was_stun == 1 )
		  return;
	   
	   one_hit( ch, victim, ( TYPE_HIT + 10 ), 0 );
    }
    
    if ( victim->position < 4 )
	   return;
    
    /* SPELL SHIELDS */
    
    if (victim->itemaffect < 1) return;
    if (IS_NPC(victim) || victim->spl[1] < 4)
	   level = victim->level;
    else level = (victim->spl[1]/4);


    /* switch off the spell attack spam if they want it */
    if( IS_SET(victim->act, PLR_FIGHT2))
        victim->choke_dam_message = 1;
    if( IS_SET(ch->act, PLR_FIGHT2))
        ch->choke_dam_message = 1;


    if  ( ch->choke_dam_message)
    {
        snprintf( buf, MAX_STRING_LENGTH, "$N's magical shields attack you!");
        ADD_COLOUR( ch, buf, D_BLUE, MAX_STRING_LENGTH);
        act( buf, ch, NULL, victim, TO_CHAR);
    } 

    if  ( victim->choke_dam_message)
    {
        snprintf( buf, MAX_STRING_LENGTH, "Your magical shields attack $n!");
        ADD_COLOUR( victim, buf, L_BLUE, MAX_STRING_LENGTH);
        act( buf, ch, NULL, victim, TO_VICT);
    }


    if (IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD))
	   if ( (sn = skill_lookup( "lightning bolt" ) ) > 0)
		  (*skill_table[sn].spell_fun) (sn,level,victim,ch);
	   if (IS_ITEMAFF(victim, ITEMA_FIRESHIELD))
		  if ( (sn = skill_lookup( "fireball" ) ) > 0)
			 (*skill_table[sn].spell_fun) (sn,level,victim,ch);
		  if (IS_ITEMAFF(victim, ITEMA_ICESHIELD))
			 if ( (sn = skill_lookup( "chill touch" ) ) > 0)
				(*skill_table[sn].spell_fun) (sn,level,victim,ch);
			 if (IS_ITEMAFF(victim, ITEMA_ACIDSHIELD))
				if ( (sn = skill_lookup( "acid blast" ) ) > 0)
				    (*skill_table[sn].spell_fun) (sn,level,victim,ch);

    victim->choke_dam_message = 0;
    ch->choke_dam_message = 0;
}



/*
* Hit one guy once.
*/
void one_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt, int handtype)
{
    OBJ_DATA *wield;
    int victim_ac, ammount;
    int thac0, thac0_00, thac0_32, dam, diceroll, level;
    bool right_hand;
    
    
    /* Can't beat a dead char! */
    /* Guard against weird room-leavings. */
    
    if ( victim->position == POS_DEAD || ch->in_room != victim->in_room )
	   return;
    
    
    /* Figure out the type of damage message. */
    
    if (handtype == 2)
    {
	   wield = get_eq_char( ch, WEAR_HOLD );
	   right_hand = FALSE;
    }
    else
    {
	   wield = get_eq_char( ch, WEAR_WIELD );
	   right_hand = TRUE;
    }
    
    if ( dt == TYPE_UNDEFINED )
    {
	   dt = TYPE_HIT;
	   if ( wield != NULL && wield->item_type == ITEM_WEAPON )
		  dt += wield->value[3];
    }
    
    if (ch->wpn[dt-1000] > 5)
	   level = (ch->wpn[dt-1000] / 5);
    else level = 1;
    if (level > 40) level = 40;
    
    
    /* Calculate to-hit-armor-class-0 versus armor. */
    
    if ( IS_NPC(ch) )
    {
	   thac0_00 = 20;
	   thac0_32 =  0;
    }
    else
    {
	   thac0_00 = class_table[ch->class].thac0_00;
	   thac0_32 = class_table[ch->class].thac0_32;
    }
    thac0     = interpolate( level, thac0_00, thac0_32 ) - GET_HITROLL(ch);
    victim_ac = UMAX( -25, GET_AC(victim) / 10 );
    if ( !can_see( ch, victim ) )
	   victim_ac -= 4;
    
    
    /* The moment of excitement! */
    
    while ( ( diceroll = number_bits( 5 ) ) >= 20 ) ;
    
    if ( diceroll == 0
	   || ( diceroll != 19
	   && diceroll < thac0 - victim_ac ) )
    {
	   /* Miss. */
	   damage( ch, victim, 0, dt );
	   tail_chain( );
	   improve_wpn(ch,dt,right_hand);
	   improve_stance(ch);
	   return;
    }
    
    
    /* Hit. */
    /* Calc damage. */
    /* Base Damage First */
    
    if ( IS_NPC(ch) )
    {
	   dam = ch->level / 2 ;
	   if ( (wield != NULL) && (wield->item_type == ITEM_WEAPON) )
		  dam += number_range( wield->value[1], wield->value[2] );
    }
    else
    {
	   if ( IS_VAMPAFF(ch,VAM_CLAWS) && wield == NULL)
		  dam = number_range( 10, 20 );
	   else if ( (wield != NULL) && (wield->item_type == ITEM_WEAPON) )
		  dam = number_range( wield->value[1], wield->value[2] );
	   else
		  dam = number_range( 1, 4 );
    }
    
    /* Store that base damage before calculating bonuses */    
    
    dam += GET_DAMROLL(ch);
    dam2 = 0;
    
    
    /* Now calculate bonuses, to add to base dam later */
    
    if ( dt == gsn_backstab )
	   dam2 += dam * number_range(2,4);
    
    if ( !IS_NPC(ch) && ch->stance[0] == STANCE_BULL)
	   dam2 += (dam * (ch->stance[STANCE_BULL] / 100));
    
    if ( !IS_NPC(ch) && ch->stance[0] == STANCE_GRIZZLIE)
	   dam2 += (dam * (ch->stance[STANCE_GRIZZLIE] / 100));
    
    if ( !IS_NPC(ch) && ch->stance[0] == STANCE_LION)
	   dam2 += (dam * (ch->stance[STANCE_LION] / 100));
    
    if ( !IS_NPC(ch) && ch->stance[0] == STANCE_FALCON)
	   dam2 += (dam * (ch->stance[STANCE_FALCON] / 100));
    
    /* CHECK FOR POTENCE - ARCHON */
    
    if ( !IS_NPC(ch) && IS_VAMPAFF(ch, VAM_POTENCE) )
    {
	   ammount = (get_age(ch)/100);
	   if ( IS_VAMPPASS(ch, VAM_POTENCE) && ammount >= 7 )
		  ammount = 6;   
	   else if ( ammount >= 6 )
		  ammount = 5;
	   ammount *= 5;
	   ammount += ( 13 - ch->vampgen);
	   ammount += 10;
	   dam2 += ((dam/100)*ammount);
    }
    
    /* Vampires should be tougher at night and weaker during the day. */
    
    if ( IS_SET(ch->act, PLR_VAMPIRE) )
    {
	   if (weather_info.sunlight == SUN_LIGHT )
		  dam /= 2;
	   else if (weather_info.sunlight == SUN_DARK )
		  dam2 += dam * 0.5;
    }
    else if (!IS_NPC(ch))
    {
	   if (weather_info.sunlight == SUN_DARK)
		  dam /= 2;
    }
    
    /* if ( !IS_NPC(ch) && dt >= TYPE_HIT)           */
    /* dam = dam + (dam * (ch->wpn[dt-1000] / 100)); */
    
    if ( dam <= 0 )
	   dam = 1;
    
    damage( ch, victim, dam, dt );
    tail_chain( );
    improve_wpn(ch,dt,right_hand);
    improve_stance(ch);
    return;
}



/*
* Inflict damage from a hit.
*/
void damage( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt )
{
    int ammount;
	const float bottom_dam = 0.8f;						/* the damage modifier for zero beast */
	const float top_dam    = 1.5f;						/* the damage modifier for 100 beast */
	const float power_base = powf( top_dam-bottom_dam+1.0f, 1.f/100.f );
    
    
    if ( victim->position == POS_DEAD )
	   return;
    
    
    /* Stop up any residual loopholes. Taken out for now. */
    
    /* if ((!IS_NPC(victim)) && (( dam > 1000 ))) dam = 1000; */
    /* if ((IS_NPC(victim)) && (( dam > 1500 ))) dam = 1500;  */
    
    
    if ( victim != ch )
    {
        
	   /* Certain attacks are forbidden. */
	   /* Most other attacks are returned. */
	   
	   if ( is_safe( ch, victim ) )
		  return;
	   
	   check_killer( ch, victim );
	   
	   if ( victim->position > POS_STUNNED )
	   {
		  if ( victim->fighting == NULL )
			 set_fighting( victim, ch );
		  victim->position = POS_FIGHTING;
	   }
	   
	   if ( victim->position > POS_STUNNED )
	   {
		  if ( ch->fighting == NULL )
			 set_fighting( ch, victim );
		  
		  /* If victim is charmed, ch might attack victim's master. */
		  
		  if ( IS_NPC(ch)
			 &&   IS_NPC(victim)
			 &&   IS_AFFECTED(victim, AFF_CHARM)
			 &&   victim->master != NULL
			 &&   victim->master->in_room == ch->in_room
			 &&   number_bits( 3 ) == 0 )
		  {
			 stop_fighting( ch, FALSE );
			 multi_hit( ch, victim->master, TYPE_UNDEFINED );
			 return;
		  }
	   }
	   
        
	   /* More charm stuff. */
	   
	   if ( victim->master == ch )
		  stop_follower( victim );
	   
        
	   /* Damage modifiers. */
	   /* Carried on from one_hit, these are the non-physical */
	   /* damage modifiers, that are included in spell damage */
	   
	   
	   if ( !IS_AWAKE(victim) )
		  dam2 += dam * 2;
	   
	   
	   if ( IS_AFFECTED(ch, AFF_HIDE) )
	   {
		  if (!can_see(victim,ch))
		  {
			 dam2 += dam * 0.5;
			 send_to_char("You use your concealment to get a surprise attack!\n\r",ch);
		  }
		  REMOVE_BIT( ch->affected_by, AFF_HIDE );
		  act( "$n leaps from $s concealment.", ch, NULL, NULL, TO_ROOM );
	   }
	   
	   
	   /* Now, before we do any reductions to damage for magical */
	   /* defences, or vampire powers, we need to add the modifiers */
	   /* to the base damage we stored earlier in one_hit */
	   
	   dam += dam2;
	   
	   
	   if ( IS_AFFECTED(victim, AFF_SANCTUARY) )
		  dam /= 2;
	   
	   if ( IS_AFFECTED(victim, AFF_PROTECT) && IS_EVIL(ch) )
		  dam -= dam / 4;
	   
	   
	   /* CHECK FOR FORTITUDE - ARCHON */
	   if ( !IS_NPC(victim) && IS_VAMPAFF(victim, VAM_FORTITUDE) )
	   {
		  ammount = (get_age(victim)/100);
		  if ( IS_VAMPPASS(victim, VAM_FORTITUDE) && ammount >= 7 )
			 ammount = 6;   
		  else if ( ammount >= 6 )
			 ammount = 5;
		  ammount *= 5;
		  ammount += ( 13 - victim->vampgen);
		  ammount += 10;
		  dam -= ((dam/100)*ammount);
	   }
	   
	   if ( dam < 0 )
		  dam = 0;
	   

	   /* beast - Genghis -> exponential curve, 0 beast = 80% damage, 100 beast = 150% damage */
	   dam *= powf( power_base, ch->beast ) + bottom_dam - 1.0f;

	   /* Check for disarm, trip, parry, and dodge. */
	   if ( dt >= TYPE_HIT )
	   {
		  if ( IS_NPC(ch) && number_percent( ) < ch->level / 2 )
			 disarm( ch, victim );
		  
		  if ( IS_NPC(ch) && number_percent( ) < ch->level / 2 )
			 trip( ch, victim );
		  
		  if ( check_parry( ch, victim, dt ) )
			 return;
		  
		  if ( check_dodge( ch, victim ) )
			 return;
	   }
	   

	   
	   dam_message( ch, victim, dam, dt );
     }
	
	
     
     /* Hurt the victim. */
     /* Inform the victim of his new state. */
	
     if ( dam < 0 )
         dam = -dam;
     victim->hit -= dam;
	
     /* SPECIAL STUFF, for immune mobs etc. */
	
     if (IS_NPC(victim) && (!str_cmp(victim->name, "Enkil")
	    || !str_cmp(victim->name, "gatekeeper") )
	    && victim->hit < victim->max_hit)
	    victim->hit = victim->max_hit;
	
     if ( !IS_NPC(victim)
	    &&   victim->level >= LEVEL_IMMORTAL
	    &&   victim->hit < 1 )
	    victim->hit = 1;
	
     update_pos( victim );
	
     switch( victim->position )
     {
	case POS_MORTAL:
	    act( "$n is mortally wounded, and spraying blood everywhere.", victim, NULL, NULL, TO_ROOM );
	    send_to_char( "You are mortally wounded, and spraying blood everywhere.\n\r", victim );
	    break;
	    
	case POS_INCAP:
	    act( "$n is incapacitated, and bleeding badly.",victim, NULL, NULL, TO_ROOM );
	    send_to_char("You are incapacitated, and bleeding badly.\n\r", victim );
	    break;
	    
	case POS_STUNNED:
	    act( "$n is stunned, but will soon recover.", victim, NULL, NULL, TO_ROOM );
	    send_to_char("You are stunned, but will soon recover.\n\r", victim );
	    break;
	    
	case POS_DEAD:
	    act( "$n is DEAD!!", victim, 0, 0, TO_ROOM );
	    send_to_char( "You have been KILLED!!\n\r\n\r", victim );
	    break;
	    
	default:
	    
	    if ( dam > victim->max_hit / 4 )
		   send_to_char( "That really did HURT!\n\r", victim );
	    if ( victim->hit < victim->max_hit / 4 && dam > 0 )
	    {
		   /* if (!IS_NPC(victim) && IS_SET(victim->act, PLR_VAMPIRE) */
		   /* && number_percent() < victim->beast)                    */
		   /* do_rage(victim,"");                                     */
		   /* else                                                    */
		   
		   send_to_char( "You sure are BLEEDING!\n\r", victim );
	    }
	    break;
     }
	
	
     /* Sleep spells and extremely wounded folks. */
	
     if ( !IS_AWAKE(victim) )
	    stop_fighting( victim, FALSE );
	
	
     /* Payoff for killing things. */
	
     if ( victim->position == POS_DEAD )
     {
	    group_gain( ch, victim );
	    
	    if ( !IS_NPC(victim) )
	    {
                   snprintf( log_buf, MAX_INPUT_LENGTH*2, "%s killed by %s at %ld",
			  victim->name,
			  (IS_NPC(ch) ? ch->short_descr : ch->name),
			  victim->in_room->vnum );
		   log_string( log_buf );
		   
		   /* Dying penalty: */
		   /* 1/2 your current exp. */
		   
		   if ( victim->exp > 0 )
			  victim->exp = victim->exp / 2;
		   
		   /* Joker add clan death here !! */
		   
		   if( !str_cmp(victim->clan, "Brujah")) clan_infotable[1].mkilled++;
		   else if( !str_cmp(victim->clan, "Malkavian")) clan_infotable[2].mkilled++;
		   else if( !str_cmp(victim->clan, "Ventrue")) clan_infotable[3].mkilled++;
		   else if( !str_cmp(victim->clan, "Tremere")) clan_infotable[4].mkilled++;
		   else if( !str_cmp(victim->clan, "Gangrel")) clan_infotable[5].mkilled++;
		   else if( !str_cmp(victim->clan, "Toreador")) clan_infotable[6].mkilled++;
		   else if( !str_cmp(victim->clan, "Nosferatu")) clan_infotable[7].mkilled++; 
	    }
	    
	    if (IS_NPC(victim) && !IS_NPC(ch))
	    {
		   ch->mkill += 1;
		   if( !str_cmp(ch->clan, "Brujah")) clan_infotable[1].mkills++;
		   else if( !str_cmp(ch->clan, "Malkavian")) clan_infotable[2].mkills++;
		   else if( !str_cmp(ch->clan, "Ventrue")) clan_infotable[3].mkills++;
		   else if( !str_cmp(ch->clan, "Tremere")) clan_infotable[4].mkills++;
		   else if( !str_cmp(ch->clan, "Gangrel")) clan_infotable[5].mkills++;
		   else if( !str_cmp(ch->clan, "Toreador")) clan_infotable[6].mkills++;
		   else if( !str_cmp(ch->clan, "Nosferatu")) clan_infotable[7].mkills++;
		   
		   if (ch->level == 1 && ch->mkill > 4)
		   {
			  ch->level = 2;
			  do_save(ch,"");
		   }
	    }
	    
	    if (!IS_NPC(victim) && IS_NPC(ch))
		   victim->mdeath = victim->mdeath + 1;
	    
	    raw_kill( victim );
	    
	    if ( IS_SET(ch->act, PLR_AUTOLOOT) )
		   do_get( ch, "all corpse" );
	    else
		   do_look( ch, "in corpse" );
	    
	    if ( !IS_NPC(ch) && IS_NPC(victim) )
	    {
		   if ( IS_SET(ch->act, PLR_AUTOSAC) )
			  do_sacrifice( ch, "corpse" );
	    }
	    
	    return;
     }
	
     if ( victim == ch )
	    return;
	
	
     /* Take care of link dead people. */
	
     if ( !IS_NPC(victim) && victim->desc == NULL )
     {
	    if ( number_range( 0, victim->wait ) == 0 )
	    {
                   if ( IS_BODY( victim, TIED_UP))
                   {
                          send_to_char( "Not while tied up.\n\r", victim );
                          if (victim->position > POS_STUNNED)
                                 act("$n strains against $s bonds.",victim,NULL,NULL,TO_ROOM);
                   }
                   else 
		          do_recall( victim, "" );
		   return;
	    }
     }
	
	
     /* Wimp out? */
	
     if ( IS_NPC(victim) && dam > 0 )
     {
	    if ( ( IS_SET(victim->act, ACT_WIMPY)
		   && number_bits( 1 ) == 0
		   &&   victim->hit < victim->max_hit / 2 )
		   ||   ( IS_AFFECTED(victim, AFF_CHARM)
		   && victim->master != NULL
		   &&     victim->master->in_room != victim->in_room ) )
		   do_flee( victim, "" );
     }
	
     if ( !IS_NPC(victim)
	    &&   victim->race < 10
	    &&   victim->hit > 0
	    &&   victim->hit <= victim->wimpy
	    &&   victim->wait == 0 )
	    do_flee( victim, "" );
	
     tail_chain( );
     return;
}



bool is_safe( CHAR_DATA *ch, CHAR_DATA *victim )
{
/* Ethereal people can only attack other ethereal people 
if ( IS_AFFECTED(ch, AFF_ETHEREAL) && !IS_AFFECTED(victim, AFF_ETHEREAL) )
{
send_to_char( "You cannot while ethereal.\n\r", ch );
return TRUE;
}
if ( !IS_AFFECTED(ch, AFF_ETHEREAL) && IS_AFFECTED(victim, AFF_ETHEREAL) )
{
send_to_char( "You cannot fight an ethereal person.\n\r", ch );
return TRUE;
}
    */
    /* You cannot attack across planes */
    if ( IS_AFFECTED(ch, AFF_SHADOWPLANE) && !IS_AFFECTED(victim, AFF_SHADOWPLANE) )
    {
	   act( "You are too insubstantial!", ch, NULL, victim, TO_CHAR );
	   return TRUE;
    }
    if ( !IS_AFFECTED(ch, AFF_SHADOWPLANE) && IS_AFFECTED(victim, AFF_SHADOWPLANE) )
    {
	   act( "$E is too insubstantial!", ch, NULL, victim, TO_CHAR );
	   return TRUE;
    }
    
    if ( IS_SET(ch->in_room->room_flags,ROOM_SAFE) )
    {
	   send_to_char( "You cannot fight in a safe room.\n\r", ch );
	   return TRUE;
    }
    
    if ( IS_HEAD(ch,LOST_HEAD) || IS_EXTRA(ch,EXTRA_OSWITCH) )
    {
	   send_to_char( "Objects cannot fight!\n\r", ch );
	   return TRUE;
    }
    else if ( IS_HEAD(victim,LOST_HEAD) || IS_EXTRA(victim,EXTRA_OSWITCH))
    {
	   send_to_char( "You cannot attack an object.\n\r", ch );
	   return TRUE;
    }

/* Joker added test */
   if (!IS_NPC(victim))
   {
      if ( victim->fighting != NULL 
	&& !IS_NPC(victim->fighting)
	&& victim->fighting != ch)
      {
	send_to_char("They are somewhat preoccupied!\n\r",ch);
	return TRUE;
      }
   } 

    if ( IS_NPC(victim) && (victim->pIndexData->pShop != NULL) )
    {
       send_to_char( "Didn't your mummy tell you never to steal from shops?\n\r", ch );
       return TRUE;
    }
 
    if ( IS_NPC(ch) || IS_NPC(victim) )
	   return FALSE;
    
    /* Thx Josh! */
    if ( victim->fighting == ch )
	   return FALSE;
    
    if ( victim->level != 3 || ch->level != 3 )
    {
	   send_to_char( "Both players must be avatars to fight.\n\r", ch );
	   return TRUE;
    }
    
    return FALSE;
}

bool no_attack( CHAR_DATA *ch, CHAR_DATA *victim )
{
    /* Ethereal people can only attack other ethereal people */
    if ( IS_AFFECTED(ch, AFF_ETHEREAL) && !IS_AFFECTED(victim, AFF_ETHEREAL) )
    {
	   send_to_char( "You cannot while ethereal.\n\r", ch );
	   return TRUE;
    }
    if ( !IS_AFFECTED(ch, AFF_ETHEREAL) && IS_AFFECTED(victim, AFF_ETHEREAL) )
    {
	   send_to_char( "You cannot fight an ethereal person.\n\r", ch );
	   return TRUE;
    }
    
    /* You cannot attack across planes */
    if ( IS_AFFECTED(ch, AFF_SHADOWPLANE) && !IS_AFFECTED(victim, AFF_SHADOWPLANE) )
    {
	   act( "You are too insubstantial!", ch, NULL, victim, TO_CHAR );
	   return TRUE;
    }
    if ( !IS_AFFECTED(ch, AFF_SHADOWPLANE) && IS_AFFECTED(victim, AFF_SHADOWPLANE) )
    {
	   act( "$E is too insubstantial!", ch, NULL, victim, TO_CHAR );
	   return TRUE;
    }
    
    if ( IS_SET(ch->in_room->room_flags,ROOM_SAFE) )
    {
	   send_to_char( "You cannot fight in a safe room.\n\r", ch );
	   return TRUE;
    }
    
    if ( IS_HEAD(ch,LOST_HEAD) || IS_EXTRA(ch,EXTRA_OSWITCH) )
    {
	   send_to_char( "Objects cannot fight!\n\r", ch );
	   return TRUE;
    }
    else if ( IS_HEAD(victim,LOST_HEAD) || IS_EXTRA(victim,EXTRA_OSWITCH) )
    {
	   send_to_char( "You cannot attack objects.\n\r", ch );
	   return TRUE;
    }
    
    return FALSE;
}



/*
* See if an attack justifies a KILLER flag.
*/
void check_killer( CHAR_DATA *ch, CHAR_DATA *victim )
{
/*
* Follow charm thread to responsible character.
* Attacking someone's charmed char is hostile!
    */
    while ( IS_AFFECTED(victim, AFF_CHARM) && victim->master != NULL )
	   victim = victim->master;
    
	   /*
	   * NPC's are fair game.
	   * So are killers and thieves.
    */
    if ( IS_NPC(victim)
	   ||   IS_SET(victim->act, PLR_KILLER)
	   ||   IS_SET(victim->act, PLR_THIEF) )
	   return;
    
	   /*
	   * Charm-o-rama.
    */
    if ( IS_SET(ch->affected_by, AFF_CHARM) )
    {
	   if ( ch->master == NULL )
	   {
	   /*
	   char buf[MAX_STRING_LENGTH];
	   sprintf( buf, "Check_killer: %s bad AFF_CHARM",
	   IS_NPC(ch) ? ch->short_descr : ch->name );
	   bug( buf, 0 );
		  */
		  affect_strip( ch, gsn_charm_person );
		  REMOVE_BIT( ch->affected_by, AFF_CHARM );
		  return;
	   }
	   stop_follower( ch );
	   return;
    }
    return;
}



/*
* Check for parry.
*/
bool check_parry( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
{
    OBJ_DATA *obj;
    int chance;
    char buf[MAX_INPUT_LENGTH];
    char buf1[MAX_INPUT_LENGTH];
    char buf7[MAX_INPUT_LENGTH];
    char buf8[MAX_INPUT_LENGTH];
    
    
    if ( !IS_AWAKE(victim) )
	   return FALSE;
    
    if ( IS_NPC(victim) )
    {
	   chance   = victim->level;
	   obj = NULL;
    }
    
    else
    {
	   if ( ( obj = get_eq_char( victim, WEAR_WIELD ) ) != NULL 
		  && obj->item_type == ITEM_WEAPON )
	   {
		  chance = victim->wpn[obj->value[3]] / 8;
	   }
	   
	   else if ( ( obj = get_eq_char( victim, WEAR_HOLD ) ) != NULL
		  && obj->item_type == ITEM_WEAPON )
	   {
		  chance = victim->wpn[obj->value[3]] / 8;
	   }
	   
	   else return FALSE;
    }
    
    if (!IS_NPC(victim) && (victim->stance[0] == STANCE_CRANE) &&
	   victim->stance[STANCE_CRANE] > 0)
    {
	   chance += victim->stance[STANCE_CRANE] / 4;
    }
    
    if (!IS_NPC(victim) && (victim->stance[0] == STANCE_SWALLOW) &&
	   victim->stance[STANCE_SWALLOW] > 0)
    {
	   chance += victim->stance[STANCE_SWALLOW] / 4;
    }
    
    if (!IS_NPC(victim) && (ch->stance[0] == STANCE_COBRA) &&
	   victim->stance[STANCE_COBRA] > 0)
    {
	   chance += victim->stance[STANCE_COBRA] / 4;
    }
    
    if (!IS_NPC(victim) && (ch->stance[0] == STANCE_GRIZZLIE) &&
	   victim->stance[STANCE_GRIZZLIE] > 0)
    {
	   chance += victim->stance[STANCE_GRIZZLIE] / 4;
    }
    
    
    if (!IS_NPC(victim) &&
	   victim->stance[STANCE_SWALLOW] == 200 &&
	   victim->stance[STANCE_COBRA]   == 200 &&
	   victim->stance[STANCE_PANTHER] == 200 &&
	   victim->stance[STANCE_GRIZZLIE] == 200 &&
	   victim->stance[STANCE_LION] == 200 &&
	   victim->stance[STANCE_FALCON] == 200 )
	   chance += 10;
    
    if (chance > 85) chance = 85;
    
    if ( ch->max_move > 5000 )
	   chance = chance + ( ch->max_move / 1000 );

    if( chance > 95 ) chance = 95;

    if ( IS_NPC(ch) && (ch->hitroll >= victim->hitroll))
	   chance = chance - ( (ch->hitroll - victim->hitroll) /30 ); 
    
    if ( !IS_NPC(ch) && (ch->hitroll >= victim->hitroll))
	   chance = chance - ( ((ch->hitroll - victim->hitroll) /5) * 2   );
    
    if (number_percent( ) >= chance)
	   return FALSE;
    
    
    
    if (!IS_NPC(ch) && obj != NULL && obj->item_type == ITEM_WEAPON &&
	   obj->value[3] >= 0 && obj->value[3] <= 12)
    {
	   if(!IS_SET(victim->act, PLR_FIGHT))
	   {
		  snprintf( buf, MAX_INPUT_LENGTH, "You parry $n's blow with $p." );
		  ADD_COLOUR( victim , buf, L_GREEN, MAX_INPUT_LENGTH);
		  act( buf ,  ch, obj, victim, TO_VICT );
	   }
	   if(!IS_SET(ch->act, PLR_FIGHT) )
	   { 
		  snprintf( buf1, MAX_INPUT_LENGTH, "$N parries your blow with $p.");
		  ADD_COLOUR( ch, buf1, L_GREEN, MAX_INPUT_LENGTH);
		  act( buf1, ch, obj, victim, TO_CHAR );
	   }
	   return TRUE;
    }
    if(!IS_SET(victim->act, PLR_FIGHT))
    {
	   snprintf( buf7, MAX_INPUT_LENGTH, "You parry $n's attack."); 
	   ADD_COLOUR(victim, buf7, L_GREEN, MAX_INPUT_LENGTH);
	   act( buf7 ,  ch, NULL, victim, TO_VICT    );
    }
    if(!IS_SET(ch->act, PLR_FIGHT))
    {
	   snprintf(buf8, MAX_INPUT_LENGTH, "$N parries your attack.");
	   ADD_COLOUR(ch, buf8, L_GREEN, MAX_INPUT_LENGTH);
	   act( buf8 , ch, NULL, victim, TO_CHAR    );
    }
    return TRUE;
    
}



/*
* Check for dodge.
*/
bool check_dodge( CHAR_DATA *ch, CHAR_DATA *victim )
{
    int chance;
    int dodge1;
    int dodge2;
    char buf2[MAX_INPUT_LENGTH];
    char buf3[MAX_INPUT_LENGTH];
    
    
    if ( !IS_AWAKE(victim) )
	   return FALSE;
    
    if ( IS_NPC(victim) )
	   chance  = victim->level;
    else
	   chance  = (victim->wpn[0] / 8);
    
    dodge1 = victim->carry_weight;
    dodge2 = can_carry_w(victim);
    
    
    if (!IS_NPC(victim) && (ch->stance[0] == STANCE_MONGOOSE) &&
	   victim->stance[STANCE_MONGOOSE] > 0)
	   chance += victim->stance[STANCE_MONGOOSE] / 8;
    
    if (!IS_NPC(victim) && (ch->stance[0] == STANCE_SWALLOW) &&
	   victim->stance[STANCE_SWALLOW] > 0)
	   chance += victim->stance[STANCE_SWALLOW] / 8; 
    
    if (!IS_NPC(victim) && (ch->stance[0] == STANCE_PANTHER) &&
	   victim->stance[STANCE_PANTHER] > 0)
	   chance += victim->stance[STANCE_PANTHER] / 8; 
    
    if (!IS_NPC(victim) && (ch->stance[0] == STANCE_FALCON) &&
	   victim->stance[STANCE_FALCON] > 0)
	   chance += victim->stance[STANCE_FALCON] / 8;      
    
    if (!IS_NPC(victim) &&
	   victim->stance[STANCE_SWALLOW] == 200 &&
	   victim->stance[STANCE_COBRA]   == 200 &&
	   victim->stance[STANCE_PANTHER] == 200 &&
	   victim->stance[STANCE_GRIZZLIE] == 200 &&
	   victim->stance[STANCE_LION] == 200 &&
	   victim->stance[STANCE_FALCON] == 200 )
	   chance += 10;
    
    if ( chance > 60 )
	   chance = 60;
    
    if ( ch->max_move > 5000 )
	   chance = chance + ( ch->max_move / 1000 );

    if ( chance > 75 )
           chance = 75;

    if (dodge2 < 1)
	   return FALSE;
    else if ( (dodge1 < 1) && (number_percent( ) >= chance) )
	   return FALSE;
    else if (dodge1 > 0 && number_percent( ) >= chance - (dodge1 * 140 /dodge2))
	   return FALSE;
    
    if(!IS_SET(victim->act, PLR_FIGHT))
    {
	   snprintf( buf2, MAX_INPUT_LENGTH, "You dodge $n's attack.");
	   ADD_COLOUR( victim, buf2, D_GREEN, MAX_INPUT_LENGTH);
	   act( buf2, ch, NULL, victim, TO_VICT    );
    }
    if(!IS_SET(ch->act, PLR_FIGHT))
    {
	   snprintf( buf3, MAX_INPUT_LENGTH, "$N dodges your attack.");
	   ADD_COLOUR( ch, buf3, D_GREEN, MAX_INPUT_LENGTH); 
	   act( buf3 , ch, NULL, victim, TO_CHAR    );
    }       
    return TRUE;
}



/*
* Set position of a victim.
*/
void update_pos( CHAR_DATA *victim )
{
    CHAR_DATA *mount;
    
    if ( victim->hit > 0 )
    {
	   if ( victim->position <= POS_STUNNED )
		  victim->position = POS_STANDING;
	   return;
    }
    else if ( (mount = victim->mount) != NULL)
    {
	   if (victim->mounted == IS_MOUNT)
	   {
		  act("$n rolls off $N.",mount,NULL,victim,TO_ROOM);
		  act("You roll off $N.",mount,NULL,victim,TO_CHAR);
	   }
	   else if (victim->mounted == IS_RIDING)
	   {
		  act("$n falls off $N.",victim,NULL,mount,TO_ROOM);
		  act("You fall off $N.",victim,NULL,mount,TO_CHAR);
	   }
	   mount->mount    = NULL;
	   victim->mount   = NULL;
	   mount->mounted  = IS_ON_FOOT;
	   victim->mounted = IS_ON_FOOT;
    }
    
    if (!IS_NPC(victim) && victim->hit <=-11 && IS_HERO(victim))
    {
	   victim->hit = -10;
	   stop_fighting(victim,TRUE);
	   return;
    }
    
    if ( IS_NPC(victim) || victim->hit <= -11 )
    {
	   victim->position = POS_DEAD;
	   return;
    }
    
    if ( victim->hit <= -6 ) victim->position = POS_MORTAL;
    else if ( victim->hit <= -3 ) victim->position = POS_INCAP;
    else                          victim->position = POS_STUNNED;
    
    return;
}



/*
* Start fights.
*/
void set_fighting( CHAR_DATA *ch, CHAR_DATA *victim )
{
    if ( ch->fighting != NULL )
    {
	   bug( "Set_fighting: already fighting", 0 );
	   return;
    }
    
    if ( IS_AFFECTED(ch, AFF_SLEEP) )
	   affect_strip( ch, gsn_sleep );
    
    ch->fighting = victim;
    ch->position = POS_FIGHTING;
    
    return;
}



/*
* Stop fights.
*/
void stop_fighting( CHAR_DATA *ch, bool fBoth )
{
    CHAR_DATA *fch;
    
    for ( fch = char_list; fch != NULL; fch = fch->next )
    {
	   if ( fch == ch || ( fBoth && fch->fighting == ch ) )
	   {
		  fch->fighting = NULL;
		  fch->position = POS_STANDING;
		  update_pos( fch );
	   }
    }
    
    return;
}



/*
* 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( 4, 8 );
	   if ( ch->gold > 0 )
	   {
		  obj_to_obj( create_money( ch->gold ), corpse );
		  ch->gold = 0;
	   }
    }
    else
    {
	   name     = ch->name;
	   corpse      = create_object(get_obj_index(OBJ_VNUM_CORPSE_PC), 0);
	   corpse->timer  = number_range( 25, 40 );
	   /* Why should players keep their gold? */
	   if ( ch->gold > 0 )
	   {
		  obj = create_money( ch->gold );
		  if (IS_AFFECTED(ch,AFF_SHADOWPLANE) &&
			 (!IS_SET(obj->extra_flags, ITEM_SHADOWPLANE) ) )
			 SET_BIT(obj->extra_flags, ITEM_SHADOWPLANE);
		  obj_to_obj( obj, corpse );
		  ch->gold = 0;
	   }
    }
    
    snprintf( buf, MAX_STRING_LENGTH, corpse->short_descr, name );
    free_string( corpse->short_descr );
    corpse->short_descr = str_dup( buf );
    
    snprintf( buf, MAX_STRING_LENGTH, corpse->description, name );
    free_string( corpse->description );
    corpse->description = str_dup( buf );
    
    for ( obj = ch->carrying; obj != NULL; obj = obj_next )
    {
	   
	   obj_next = obj->next_content;
	   
	   obj_from_char( obj );
	   
	   if(IS_NPC(ch) && obj->questowner != NULL && strlen(obj->questowner) > 1)
	   {
		  obj_to_room(obj, ch->in_room);
	   }
	   else
	   {
		  if ( IS_SET( obj->extra_flags, ITEM_VANISH ) )
			 extract_obj( obj );
		  else
		  {
			 if (IS_AFFECTED(ch,AFF_SHADOWPLANE) &&
				(!IS_SET(obj->extra_flags, ITEM_SHADOWPLANE) ) )
				SET_BIT(obj->extra_flags, ITEM_SHADOWPLANE);
			 obj_to_obj( obj, corpse );
		  }
	   }
    }
    
    /* If you die in the shadowplane, your corpse should stay there */
    if (IS_AFFECTED(ch, AFF_SHADOWPLANE))
	   SET_BIT(corpse->extra_flags, ITEM_SHADOWPLANE);
    
    obj_to_room( corpse, ch->in_room );
    return;
}



/*
* Improved Death_cry contributed by Diavolo.
*/
void death_cry( CHAR_DATA *ch )
{
    ROOM_INDEX_DATA *was_in_room;
    char *msg;
    int door;
    int vnum;
    
    vnum = 0;
    switch ( number_bits( 4 ) )
    {
    /* Took out cut off bits, etc.  Will include as part of the final
    * Death moves.  KaVir.
	   */
    default: msg  = "$n hits the ground ... DEAD.";       break;
    }
    
    act( msg, ch, NULL, NULL, TO_ROOM );
    
    if ( vnum != 0 )
    {
	   char buf[MAX_STRING_LENGTH];
	   OBJ_DATA *obj;
	   char *name;
	   
	   name     = IS_NPC(ch) ? ch->short_descr : ch->name;
	   obj      = create_object( get_obj_index( vnum ), 0 );
	   obj->timer  = number_range( 4, 7 );
	   
	   snprintf( buf, MAX_STRING_LENGTH, obj->short_descr, name );
	   free_string( obj->short_descr );
	   obj->short_descr = str_dup( buf );
	   
	   snprintf( buf, MAX_STRING_LENGTH, obj->description, name );
	   free_string( obj->description );
	   obj->description = str_dup( buf );
	   
	   obj_to_room( obj, ch->in_room );
    }
    
    if ( IS_NPC(ch) )
	   msg = "You hear something's death cry.";
    else
	   msg = "You hear someone's death cry.";
    
    was_in_room = ch->in_room;
    for ( door = 0; door <= 5; door++ )
    {
	   EXIT_DATA *pexit;
	   
	   if ( ( pexit = was_in_room->exit[door] ) != NULL
		  &&   pexit->to_room != NULL
		  &&   pexit->to_room != was_in_room )
	   {
		  ch->in_room = pexit->to_room;
		  act( msg, ch, NULL, NULL, TO_ROOM );
	   }
    }
    ch->in_room = was_in_room;
    return;
}

void make_part( CHAR_DATA *ch, char *argument )
{
    char  arg [MAX_INPUT_LENGTH];
    int vnum;
    
    argument = one_argument(argument,arg,MAX_INPUT_LENGTH);
    vnum = 0;
    
    if (arg[0] == '\0') return;
    if (!str_cmp(arg,"head")) vnum = OBJ_VNUM_SEVERED_HEAD;
    else if (!str_cmp(arg,"arm")) vnum = OBJ_VNUM_SLICED_ARM;
    else if (!str_cmp(arg,"leg")) vnum = OBJ_VNUM_SLICED_LEG;
    else if (!str_cmp(arg,"heart")) vnum = OBJ_VNUM_TORN_HEART;
    else if (!str_cmp(arg,"turd")) vnum = OBJ_VNUM_TORN_HEART;
    else if (!str_cmp(arg,"entrails")) vnum = OBJ_VNUM_SPILLED_ENTRAILS;
    else if (!str_cmp(arg,"brain")) vnum = OBJ_VNUM_QUIVERING_BRAIN;
    else if (!str_cmp(arg,"eyeball")) vnum = OBJ_VNUM_SQUIDGY_EYEBALL;
    else if (!str_cmp(arg,"blood")) vnum = OBJ_VNUM_SPILT_BLOOD;
    else if (!str_cmp(arg,"face")) vnum = OBJ_VNUM_RIPPED_FACE;
    else if (!str_cmp(arg,"windpipe")) vnum = OBJ_VNUM_TORN_WINDPIPE;
    else if (!str_cmp(arg,"cracked_head")) vnum = OBJ_VNUM_CRACKED_HEAD;
    else if (!str_cmp(arg,"ear")) vnum = OBJ_VNUM_SLICED_EAR;
    else if (!str_cmp(arg,"nose")) vnum = OBJ_VNUM_SLICED_NOSE;
    else if (!str_cmp(arg,"tooth")) vnum = OBJ_VNUM_KNOCKED_TOOTH;
    else if (!str_cmp(arg,"tongue")) vnum = OBJ_VNUM_TORN_TONGUE;
    else if (!str_cmp(arg,"hand")) vnum = OBJ_VNUM_SEVERED_HAND;
    else if (!str_cmp(arg,"foot")) vnum = OBJ_VNUM_SEVERED_FOOT;
    else if (!str_cmp(arg,"thumb")) vnum = OBJ_VNUM_SEVERED_THUMB;
    else if (!str_cmp(arg,"index")) vnum = OBJ_VNUM_SEVERED_INDEX;
    else if (!str_cmp(arg,"middle")) vnum = OBJ_VNUM_SEVERED_MIDDLE;
    else if (!str_cmp(arg,"ring")) vnum = OBJ_VNUM_SEVERED_RING;
    else if (!str_cmp(arg,"little")) vnum = OBJ_VNUM_SEVERED_LITTLE;
    else if (!str_cmp(arg,"toe")) vnum = OBJ_VNUM_SEVERED_TOE;
    
    if ( vnum != 0 )
    {
	   char buf[MAX_STRING_LENGTH];
	   OBJ_DATA *obj;
	   char *name;
	   
	   name     = IS_NPC(ch) ? ch->short_descr : ch->name;
	   obj      = create_object( get_obj_index( vnum ), 0 );
	   if (IS_NPC(ch))   obj->timer = number_range(2,5);
	   else              obj->timer = -1;
	   if (!str_cmp(arg,"head") && IS_NPC(ch))
		  obj->value[1] = ch->pIndexData->vnum;
	   else if (!str_cmp(arg,"head") && !IS_NPC(ch))
	   {ch->pcdata->chobj = obj; obj->chobj = ch;obj->timer = number_range(2,3);}
	   else if (!str_cmp(arg,"brain") && !IS_NPC(ch) && 
		  IS_AFFECTED(ch,AFF_POLYMORPH) && IS_HEAD(ch, LOST_HEAD))
	   {
		  if (ch->pcdata->chobj != NULL) ch->pcdata->chobj->chobj = NULL;
		  ch->pcdata->chobj = obj;
		  obj->chobj = ch;
		  obj->timer = number_range(2,3);
	   }
	   
	   /* For blood :) KaVir */
	   if (vnum == OBJ_VNUM_SPILT_BLOOD) obj->timer = 2;
	   
	   /* For voodoo dolls - KaVir */
	   if (!IS_NPC(ch))
	   {
		  snprintf( buf, MAX_INPUT_LENGTH, obj->name, name );
		  free_string( obj->name );
		  obj->name = str_dup( buf );
	   }
	   else
	   {
		  snprintf( buf, MAX_INPUT_LENGTH, obj->name, "mob" );
		  free_string( obj->name );
		  obj->name = str_dup( buf );
	   }
	   
	   snprintf( buf, MAX_INPUT_LENGTH, obj->short_descr, name );
	   free_string( obj->short_descr );
	   obj->short_descr = str_dup( buf );
	   
	   snprintf( buf, MAX_INPUT_LENGTH, obj->description, name );
	   free_string( obj->description );
	   obj->description = str_dup( buf );
	   
	   if (IS_AFFECTED(ch, AFF_SHADOWPLANE))
		  SET_BIT(obj->extra_flags, ITEM_SHADOWPLANE);
	   
	   obj_to_room( obj, ch->in_room );
    }
    return;
}



void raw_kill( CHAR_DATA *victim )
{
    CHAR_DATA *mount;
    stop_fighting( victim, TRUE );
    death_cry( victim );
    make_corpse( victim );
    
    if ( (mount = victim->mount) != NULL)
    {
	   if (victim->mounted == IS_MOUNT)
	   {
		  act("$n rolls off the corpse of $N.",mount,NULL,victim,TO_ROOM);
		  act("You roll off the corpse of $N.",mount,NULL,victim,TO_CHAR);
	   }
	   else if (victim->mounted == IS_RIDING)
	   {
		  act("$n falls off $N.",victim,NULL,mount,TO_ROOM);
		  act("You fall off $N.",victim,NULL,mount,TO_CHAR);
	   }
	   mount->mount    = NULL;
	   victim->mount   = NULL;
	   mount->mounted  = IS_ON_FOOT;
	   victim->mounted = IS_ON_FOOT;
    }
    
    if ( IS_NPC(victim) )
    {
	   victim->pIndexData->killed++;
	   extract_char( victim, TRUE );
	   return;
    }
    
    extract_char( victim, FALSE );
    while ( victim->affected )
	   affect_remove( victim, victim->affected );
    if (IS_AFFECTED(victim,AFF_POLYMORPH) && IS_AFFECTED(victim,AFF_ETHEREAL))
    {
	   victim->affected_by  = AFF_POLYMORPH + AFF_ETHEREAL;
    }
    else if (IS_AFFECTED(victim,AFF_POLYMORPH))
	   victim->affected_by  = AFF_POLYMORPH;
    else if (IS_AFFECTED(victim,AFF_ETHEREAL))
	   victim->affected_by  = AFF_ETHEREAL;
    else
	   victim->affected_by  = 0;
    if (!IS_NPC(victim) && IS_IMMUNE(victim, IMM_STAKE))
	   REMOVE_BIT(victim->immune, IMM_STAKE);
    victim->itemaffect  = 0;
    victim->loc_hp[0]    = 0;
    victim->loc_hp[1]    = 0;
    victim->loc_hp[2]    = 0;
    victim->loc_hp[3]    = 0;
    victim->loc_hp[4]    = 0;
    victim->loc_hp[5]    = 0;
    victim->loc_hp[6]    = 0;
    victim->armor  = 100;
    victim->position  = POS_RESTING;
    victim->hit       = UMAX( 1, victim->hit  );
    victim->mana   = UMAX( 1, victim->mana );
    victim->move   = UMAX( 1, victim->move );
    victim->hitroll   = 0;
    victim->damroll   = 0;
    victim->saving_throw = 0;
    victim->carry_weight = 0;
    victim->carry_number = 0;
    save_char_obj( victim );
    return;
}


void behead( CHAR_DATA *victim )
{
    char buf [MAX_INPUT_LENGTH];
    ROOM_INDEX_DATA *location;
    
    if (IS_NPC(victim)) return;
    
    location = get_room_index(victim->in_room->vnum);
    
    stop_fighting( victim, TRUE );
    
    make_part( victim, "head" );
    
    make_corpse( victim );
    
    extract_char( victim, FALSE );
    while ( victim->affected )
	   affect_remove( victim, victim->affected );
    if (IS_AFFECTED(victim,AFF_POLYMORPH) && IS_AFFECTED(victim,AFF_ETHEREAL))
    {
	   victim->affected_by  = AFF_POLYMORPH + AFF_ETHEREAL;
    }
    else if (IS_AFFECTED(victim,AFF_POLYMORPH))
	   victim->affected_by  = AFF_POLYMORPH;
    else if (IS_AFFECTED(victim,AFF_ETHEREAL))
	   victim->affected_by  = AFF_ETHEREAL;
    else
	   victim->affected_by  = 0;
    if (!IS_NPC(victim) && IS_IMMUNE(victim, IMM_STAKE))
	   REMOVE_BIT(victim->immune, IMM_STAKE);
    victim->itemaffect  = 0;
    victim->loc_hp[0]    = 0;
    victim->loc_hp[1]    = 0;
    victim->loc_hp[2]    = 0;
    victim->loc_hp[3]    = 0;
    victim->loc_hp[4]    = 0;
    victim->loc_hp[5]    = 0;
    victim->loc_hp[6]    = 0;
    victim->affected_by  = 0;
    victim->armor  = 100;
    victim->position  = POS_STANDING;
    victim->hit       = 1;
    victim->mana   = UMAX( 1, victim->mana );
    victim->move   = UMAX( 1, victim->move );
    victim->hitroll   = 0;
    victim->damroll   = 0;
    victim->saving_throw = 0;
    victim->carry_weight = 0;
    victim->carry_number = 0;
    
    char_from_room(victim);
    char_to_room(victim,location);
    SET_BIT(victim->loc_hp[0],LOST_HEAD);
    SET_BIT(victim->affected_by,AFF_POLYMORPH);
    snprintf(buf,MAX_INPUT_LENGTH, "the severed head of %s",victim->name);
    free_string(victim->morph);
    victim->morph = str_dup(buf);
    
    save_char_obj( victim );
    return;
}



void group_gain( CHAR_DATA *ch, CHAR_DATA *victim )
{
    char buf[MAX_STRING_LENGTH];
    CHAR_DATA *gch;
    CHAR_DATA *lch;
    int xp;
    int members;
    
    /*
    * Monsters don't get kill xp's or alignment changes.
    * P-killing doesn't help either.
    * Dying of mortal wounds or poison doesn't give xp to anyone!
    */
    if ( (IS_NPC(ch) && ch->mount == NULL)  || victim == ch )
	   return;
    
    /* The gatekeeper shouldn't ever die, but just in case... */
/* crash caused by this, remming out for the time being */
/*    if ( victim->pIndexData->vnum == 24001 )
    {
         snprintf(buf, MAX_STRING_LENGTH, "Log: **CHEAT** : %s just killed the gatekeeper!", ch->name);
         log_string( buf );
    } */
    members = 0;
    for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room )
    {
	   if ( is_same_group( gch, ch ) )
		  members++;
    }
    
    if ( members == 0 )
    {
	   bug( "Group_gain: members.", members );
	   members = 1;
    }
    
    lch = (ch->leader != NULL) ? ch->leader : ch;
    
    for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room )
    {
	   OBJ_DATA *obj;
	   OBJ_DATA *obj_next;
	   
	   if ( !is_same_group( gch, ch ) )
		  continue;
	   
	   xp = xp_compute( gch, victim ) / members;
	   snprintf( buf, MAX_STRING_LENGTH, "You receive %d experience points.\n\r", xp );
	   send_to_char( buf, gch );
	   if (gch->mount != NULL) send_to_char( buf, gch->mount );
	   gain_exp( gch, xp );
	   
	   for ( obj = ch->carrying; obj != NULL; obj = obj_next )
	   {
		  obj_next = obj->next_content;
		  if ( obj->wear_loc == WEAR_NONE )
			 continue;
		  
		  if ( ( IS_OBJ_STAT(obj, ITEM_ANTI_EVIL)    && IS_EVIL(ch)    )
			 ||   ( IS_OBJ_STAT(obj, ITEM_ANTI_GOOD)    && IS_GOOD(ch)    )
			 ||   ( IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch) ) )
		  {
			 act( "You are zapped by $p.", ch, obj, NULL, TO_CHAR );
			 act( "$n is zapped by $p.",   ch, obj, NULL, TO_ROOM );
			 obj_from_char( obj );
			 obj_to_room( obj, ch->in_room );
		  }
	   }
	   
	   for ( obj = ch->carrying; obj != NULL; obj = obj_next )
	   {
		  obj_next = obj->next_content;
		  if ( obj->wear_loc == WEAR_NONE )
			 continue;
		  
		  if (  ( strncmp( ch->clan, "Brujah", 4) 
			 && (obj->pIndexData->vnum == 24900
			 || obj->pIndexData->vnum == 24901
			 || obj->pIndexData->vnum == 24902) )
			 || ( strncmp( ch->clan, "Malkavian", 4) 
			 && (obj->pIndexData->vnum == 24903
			 || obj->pIndexData->vnum == 24904
			 || obj->pIndexData->vnum == 24905) )
			 || ( strncmp( ch->clan, "Tremere", 4) 
			 && (obj->pIndexData->vnum == 24906
			 || obj->pIndexData->vnum == 24907
			 || obj->pIndexData->vnum == 24908) )
			 || ( strncmp( ch->clan, "Toreador", 4) 
			 && (obj->pIndexData->vnum == 24909
			 || obj->pIndexData->vnum == 24910
			 || obj->pIndexData->vnum == 24911) )
			 || ( strncmp( ch->clan, "Ventrue", 4) 
			 && (obj->pIndexData->vnum == 24912
			 || obj->pIndexData->vnum == 24913
			 || obj->pIndexData->vnum == 24914) )
			 || ( strncmp( ch->clan, "Nosferatu", 4) 
			 && (obj->pIndexData->vnum == 24915
			 || obj->pIndexData->vnum == 24916
			 || obj->pIndexData->vnum == 24917) )
			 || ( strncmp( ch->clan, "Gangrel", 4) 
			 && (obj->pIndexData->vnum == 24918
			 || obj->pIndexData->vnum == 24919
			 || obj->pIndexData->vnum == 24920) )
			 || ( strncmp( ch->clan, "Cappadocian", 4) 
			 && (obj->pIndexData->vnum == 24929
			 || obj->pIndexData->vnum == 24930
			 || obj->pIndexData->vnum == 24931) ) )
			 
		  {
			 act( "You are zapped by $p.", ch, obj, NULL, TO_CHAR );
			 act( "$n is zapped by $p.",   ch, obj, NULL, TO_ROOM );
			 obj_from_char( obj );
			 obj_to_room( obj, ch->in_room );
		  }
	   }
	   
	   
    }
    
    return;
}



/*
* Compute xp for a kill.
* Also adjust alignment of killer.
* Edit this function to change xp computations.
*/
int xp_compute( CHAR_DATA *gch, CHAR_DATA *victim )
{
    int exp_spent;
    int exp;
    int level, lev;
    int align;
    long cap;
	const float top			= 1.0f;
	const float shift_up	= 0.3f;
	const float std_dev		= 350.0f;
	const float scale		= top / (std_dev * 2.0f * 3.1415926f);



    /* Alignment change  */
    align = gch->alignment - victim->alignment;

    if (IS_HERO(gch))
           /* Avatars shouldn't be able to change their alignment */
           gch->alignment  = gch->alignment;
    else if ( align >  500 )
           gch->alignment  = UMIN( gch->alignment + (align-500)/4,  1000 );
    else if ( align < -500 )
           gch->alignment  = UMAX( gch->alignment + (align+500)/4, -1000 );
    else
           gch->alignment -= gch->alignment / 4;

    if ( gch->exp > 5000000) 
    {
        send_to_char( "Spend some experience points you miser!\n\r", gch);
        return 0;
    }

    /* calculate a millionth of how much exp they've spent so far */
    exp_spent = ((long)gch->max_hit * gch->max_hit + (long)gch->max_mana * gch->max_mana + (long)gch->max_move *gch->max_move) /2000000;
    if      ( exp_spent > 1350)   exp_spent = 1350;
    else if ( exp_spent < 0)      exp_spent = 0;


    /* randomise the victim level +- 2% and assign to exp  */
    level = victim->exp_level/50;
    if ( level)
        exp = number_range( victim->exp_level-level, victim->exp_level+level);
    else
        exp = victim->exp_level;

	/* gaussian curve, exp gets lower as the player gets bigger */
	exp = (int) ((float)exp * powf( 2.7182818f, -0.5f * (exp_spent * exp_spent) / (std_dev * std_dev) ) * (std_dev * 2.0f * 3.1415926f) * scale + shift_up);


    /* 1% extra per status point, 1% less per 33 years  */
    exp *= 100 + gch->race - (get_age(gch)/33);
    exp /= 100;

    /* percentage modifier against wimpy people  */
    if ( gch->wimpy)
    {
            exp -= exp * gch->wimpy / gch->max_hit;
    }

    /* encourage them to move along to a tougher zone */
    if ( victim->exp_level < gch->max_hit)
    {
        lev = 100 - (gch->max_hit - victim->exp_level) / 40;
    }
    else
    {
        lev = 100;
    }
    lev = (lev >= 0) ? lev : 0;

    if ( lev < 100)
    {
        exp *= lev;
        exp /= 100;
    }

	/* cap the exp based on their size if they're under 10k */
    cap = 5000 + (long)(gch->max_hit) + (long)(gch->max_mana) + (long)(gch->max_move);
    if ( (exp > cap) && (gch->max_hit < 10000) )
        exp = cap;

    return exp;
}



void dam_message( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt )
{
    static char * const attack_table[] =
    {
	   "hit",
		  "slice",  "stab",  "slash", "whip", "claw",
		  "blast",  "pound", "crush", "grep", "bite",
		  "pierce", "suck"
    };
    static char * const attack_table2[] =
    {
	   "hits",
		  "slices",  "stabs",  "slashes", "whips", "claws",
		  "blasts",  "pounds", "crushes", "greps", "bites",
		  "pierces", "sucks"
    };
    char jokbug[256]; 
    char buf4[256], buf5[256], buf6[256];
    const char *vs;
    const char *vp;
    const char *attack;
    const char *attack2;
    int damp;
    int bodyloc;
    int recover;
    bool critical = FALSE;
    char punct;
    
    if ( dam ==   0 )
    {
	   vs = " miss";
	   vp = " misses";
    }
    else if ( dam <=  10 )
    {
	   vs = " very lightly";
	   vp = " very lightly";
    }
    else if ( dam <=  25 )
    {
	   vs = " lightly";
	   vp = " lightly";
    }
    else if ( dam <=  50 )
    {
	   vs = " hard";
	   vp = " hard";
    }
    else if ( dam <=  75 )
    {
	   vs = " very hard";
	   vp = " very hard";
    }
    else if ( dam <=  99 )
    {
	   vs = " extremely hard";
	   vp = " extremely hard";
    }
    else if ( dam <=  150 )
    {
	   vs = " incredably hard";
	   vp = " incredably hard";
    }
    else if ( dam <= 250 )
    {
	   vs = " Amazingly Hard";
	   vp = " Amazingly Hard";
    }
    else if ( dam <= 450 )
    {
	   vs = " Stupendously Hard!";
	   vp = " Stupendously Hard!";
    }
    else if ( dam <= 600 )
    {
	   vs = " Unfeasably Hard!";
	   vp = " Unfeasably Hard!";
    }
    else if ( dam <= 999 )
    {
	   vs = " Impossibly Hard!!";
	   vp = " Impossibly Hard!!";
    }
    else
    {
	   vs = " Supernaturally Hard!!!!";
	   vp = " Supernaturally Hard!!!!";
    }
    
    
    
    
    /* If victim's hp are less/equal to 'damp', attacker gets a death blow */  
    
    if (IS_NPC(victim)) damp = 0;
    else                damp = -1;
    if ( (victim->hit - dam > damp ) || (dt >= 0 && dt < MAX_SKILL) )
    {
	   punct   = (dam <= 40) ? '.' : '!';
	   
	   if ( dt == TYPE_HIT && !IS_VAMPAFF(ch,VAM_CLAWS) )
	   {
		  if (dam == 0)
		  {
			 if(ch->level >= LEVEL_GOD && !IS_NPC(ch))
			 {
				snprintf( buf4, 256, "$n%s $N%c",  vp, punct);
				snprintf( buf5, 256, "You%s $N%c (%d)", vs, punct, dam );
				snprintf( buf6, 256, "$n%s you%c (%d)", vp, punct, dam );
			 }
			 else
			 {
				snprintf( buf4, 256, "$n%s $N%c", vp, punct);
				snprintf( buf5, 256, "You%s $N%c", vs, punct);
				snprintf( buf6, 256, "$n%s you%c", vp, punct);
			 }
		  }
		  else
		  {
			 if(ch->level >= LEVEL_GOD && !IS_NPC(ch))
			 {
				snprintf( buf4, 256, "$n hits $N%s%c",  vp, punct );
				snprintf( buf5, 256, "You hit $N%s%c (%d)", vs, punct, dam  );
				snprintf( buf6, 256, "$n hits you%s%c (%d) ", vp, punct, dam );
			 }
			 else
			 {
				snprintf( buf4, 256, "$n hits $N%s%c", vp, punct);
				snprintf( buf5, 256, "You hit $N%s%c", vs, punct);
				snprintf( buf6, 256, "$n hits you%s%c", vp, punct);
			 }
			 critical = TRUE;
		  }
	   }
	   else
	   {
		  if ( dt == TYPE_HIT && IS_VAMPAFF(ch,VAM_CLAWS) )
		  {
			 attack  = attack_table[dt - TYPE_HIT + 5];
			 attack2 = attack_table2[dt - TYPE_HIT + 5];
		  }
		  else if ( dt >= 0 && dt < MAX_SKILL )
		  {
			 attack = skill_table[dt].noun_damage;
			 attack2 = skill_table[dt].noun_damage;
		  }
		  else if ( dt >= TYPE_HIT
			 && dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]) )
		  {
			 attack  = attack_table[dt - TYPE_HIT];
			 attack2 = attack_table2[dt - TYPE_HIT];
		  }
		  else
		  {
			 snprintf(jokbug, 256, "Dam_message(1): bad dt %d.%s", dt, ch->name);
			 bug( jokbug,0);
			 /*		bug( "Dam_message(1): bad dt %d.", dt );*/
			 dt  = TYPE_HIT;
			 attack  = attack_table[0];
			 attack2 = attack_table2[0];
		  }


                  /* Check for weapon resistance - KaVir */
                  recover = 0;
                  if ( !IS_NPC(victim) && IS_IMMUNE(victim, IMM_SLASH) &&
                  (attack == "slash" || attack == "slice") && number_percent() > 5 )
                     recover = 10;
                  if ( !IS_NPC(victim) && IS_IMMUNE(victim, IMM_STAB) &&
                     (attack == "stab" || attack == "pierce") && number_percent() > 5)
                     recover = 10;
                  if ( !IS_NPC(victim) && IS_IMMUNE(victim, IMM_SMASH) &&
                     (attack == "blast" || attack == "pound" || attack == "crush") && number_percent() > 5 )
                     recover = 10;
                  if ( !IS_NPC(victim) && IS_IMMUNE(victim, IMM_ANIMAL) &&
                     (attack == "bite" || attack == "claw") && number_percent() > 5)
                     recover = 10;
                  if ( !IS_NPC(victim) && IS_IMMUNE(victim, IMM_MISC) &&
                     (attack == "grep" || attack == "suck" || attack == "whip") && number_percent() > 5)
                     recover = 10;
                  victim->hit = victim->hit+recover;
                  if ( victim->hit > victim->max_hit)
                     victim->hit = victim->max_hit;


		  
		  if (dam == 0)
		  {
			 if(ch->level >= LEVEL_GOD && !IS_NPC(ch))
			 {
				snprintf( buf4, 256, "$n's %s%s $N%c",  attack, vp, punct );
				snprintf( buf5, 256, "Your %s%s $N%c (%d)",  attack, vp, punct, dam );
				snprintf( buf6, 256, "$n's %s%s you%c (%d)", attack, vp, punct, dam );
			 }
			 else
			 {
				snprintf( buf4, 256, "$n's %s%s $N%c", attack, vp, punct );
				snprintf( buf5, 256, "Your %s%s $N%c", attack, vp, punct );
				snprintf( buf6, 256, "$n's %s%s you%c", attack, vp, punct);
			 }
		  }
		  else
		  {
			 if ( dt >= 0 && dt < MAX_SKILL )
			 {
				if(ch->level >= LEVEL_GOD && !IS_NPC(ch))
				{
				    snprintf( buf4, 256, "$n's %s strikes $N%s%c",  attack2, vp, punct );
				    snprintf( buf5, 256, "Your %s strikes $N%s%c (%d)",  attack, vp, punct, dam );
				    snprintf( buf6, 256, "$n's %s strikes you%s%c (%d)", attack2, vp, punct, dam );
				}
				else
				{
				    snprintf( buf4, 256, "$n's %s strikes $N%s%c", attack2, vp, punct);
				    snprintf( buf5, 256, "Your %s strikes $N%s%c", attack, vp, punct);
				    snprintf( buf6, 256, "$n's %s strikes you%s%c", attack2, vp, punct);   
				}
			 }
			 else
			 {
				if(ch->level >= LEVEL_GOD && !IS_NPC(ch))
				{
				    snprintf( buf4, 256, "$n %s $N%s%c",  attack2, vp, punct );
				    snprintf( buf5, 256, "You %s $N%s%c (%d)",  attack, vp, punct, dam );
				    snprintf( buf6, 256, "$n %s you%s%c (%d)", attack2, vp, punct, dam );
				}
				else
				{
				    snprintf( buf4, 256, "$n %s $N%s%c", attack2, vp, punct);
				    snprintf( buf5, 256, "You %s $N%s%c", attack, vp, punct);
				    snprintf( buf6, 256, "$n %s you%s%c", attack2, vp, punct);
				}
				critical = TRUE;
			 }
		  }
		  
		  
	   }                                          
	   
	   ADD_COLOUR(ch, buf5, L_RED, 256);
	   ADD_COLOUR(victim, buf6, D_RED, 256);
	   
           act( buf4, ch, NULL, victim, TO_NOTVICT );
           if ( !ch->choke_dam_message)
           {
	       act( buf5, ch, NULL, victim, TO_CHAR );
           }
           if ( !victim->choke_dam_message)
           {
	       act( buf6, ch, NULL, victim, TO_VICT );
           }
	   if (critical) critical_hit(ch,victim,dt,dam);
	   return;
	 }
	 /* maybe insert the drop all for npc's here?? */
	 
	 if ( dt == TYPE_HIT && !IS_VAMPAFF(ch,VAM_CLAWS) && !IS_VAMPAFF(ch,VAM_FANGS))
	 {
		damp=number_range(1,4);
		if ( damp == 1 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You ram your fingers into $N's eye sockets and rip $S face off.", ch, NULL, victim, TO_CHAR);
		        act("$n rams $s fingers into $N's eye sockets and rips $S face off.", ch, NULL, victim, TO_NOTVICT);
		        act("$n rams $s fingers into your eye sockets and rips your face off.", ch, NULL, victim, TO_VICT);
                    }
		    make_part(victim,"face");
		}
		else if ( damp == 2 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You grab $N by the throat and tear $S windpipe out.", ch, NULL, victim, TO_CHAR);
		        act("$n grabs $N by the throat and tears $S windpipe out.", ch, NULL, victim, TO_NOTVICT);
		        act("$n grabs you by the throat and tears your windpipe out.", ch, NULL, victim, TO_VICT);
                    }
		    make_part(victim,"windpipe");
		}
		else if ( damp == 3 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You punch your fist through $N's stomach and rip out $S entrails.", ch, NULL, victim, TO_CHAR);
		        act("$n punches $s fist through $N's stomach and rips out $S entrails.", ch, NULL, victim, TO_NOTVICT);
		        act("$n punches $s fist through your stomach and rips out your entrails.", ch, NULL, victim, TO_VICT);
                    }
		    make_part(victim,"entrails");
		}
		else if ( damp == 4 )
		{
		    if (!IS_BODY(victim,BROKEN_SPINE))
			   SET_BIT(victim->loc_hp[1],BROKEN_SPINE);
                    if ( !ch->choke_dam_message)
                    {
		        act("You hoist $N above your head and slam $M down upon your knee.\n\rThere is a loud cracking sound as $N's spine snaps.", ch, NULL, victim, TO_CHAR);
		        act("$n hoists $N above $s head and slams $M down upon $s knee.\n\rThere is a loud cracking sound as $N's spine snaps.", ch, NULL, victim, TO_NOTVICT);
		        act("$n hoists you above $s head and slams you down upon $s knee.\n\rThere is a loud cracking sound as your spine snaps.", ch, NULL, victim, TO_VICT);
                    }
		}
		return;
	 }
	 if ( dt >= 0 && dt < MAX_SKILL )
		attack = skill_table[dt].noun_damage;
	 else if ( dt >= TYPE_HIT
		&& dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]) )
		attack = attack_table[dt - TYPE_HIT];
	 else
	 {
		bug( "Dam_message(2): bad dt %d.", dt );
		dt  = TYPE_HIT;
		attack  = attack_table[0];
	 }
	 
	 if ( attack == "slash" || attack == "slice" )
	 {
		damp=number_range(1,8);
		if ( damp == 1 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You swing your blade in a low arc, rupturing $N's abdominal cavity.\n\r$S entrails spray out over a wide area.", ch, NULL, victim, TO_CHAR);
		        act("$n swings $s blade in a low arc, rupturing $N's abdominal cavity.\n\r$S entrails spray out over a wide area.", ch, NULL, victim, TO_NOTVICT);
		        act("$n swings $s blade in a low arc, rupturing your abdominal cavity.\n\rYour entrails spray out over a wide area.", ch, NULL, victim, TO_VICT);
                    }
		    make_part(victim,"entrails");
		}
		else if ( damp == 2 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You thrust your blade into $N's mouth and twist it viciously.\n\rThe end of your blade bursts through the back of $S head.", ch, NULL, victim, TO_CHAR);
		        act("$n thrusts $s blade into $N's mouth and twists it viciously.\n\rThe end of the blade bursts through the back of $N's head.", ch, NULL, victim, TO_NOTVICT);
		        act("$n thrusts $s blade into your mouth and twists it viciously.\n\rYou feel the end of the blade burst through the back of your head.", ch, NULL, victim, TO_VICT);
                    }
		}
		else if ( damp == 3 )
		{
		    if (!IS_BODY(victim,CUT_THROAT))
			   SET_BIT(victim->loc_hp[1],CUT_THROAT);
		    if (!IS_BLEEDING(victim,BLEEDING_THROAT))
			   SET_BIT(victim->loc_hp[6],BLEEDING_THROAT);
                    if ( !ch->choke_dam_message)
                    {
		        act("Your blow slices open $N's carotid artery, spraying blood everywhere.", ch, NULL, victim, TO_CHAR);
		        act("$n's blow slices open $N's carotid artery, spraying blood everywhere.", ch, NULL, victim, TO_NOTVICT);
		        act("$n's blow slices open your carotid artery, spraying blood everywhere.", ch, NULL, victim, TO_VICT);
                    }
		    make_part(victim,"blood");
		}
		else if ( damp == 4 )
		{
		    if (!IS_BODY(victim,CUT_THROAT))
			   SET_BIT(victim->loc_hp[1],CUT_THROAT);
		    if (!IS_BLEEDING(victim,BLEEDING_THROAT))
			   SET_BIT(victim->loc_hp[6],BLEEDING_THROAT);
                    if ( !ch->choke_dam_message)
                    {
		        act("You swing your blade across $N's throat, showering the area with blood.", ch, NULL, victim, TO_CHAR);
		        act("$n swings $s blade across $N's throat, showering the area with blood.", ch, NULL, victim, TO_NOTVICT);
		        act("$n swings $s blade across your throat, showering the area with blood.", ch, NULL, victim, TO_VICT);
                    }
		    make_part(victim,"blood");
		}
		else if ( damp == 5 )
		{
		    if (!IS_HEAD(victim,BROKEN_SKULL))
		    {
                           if ( !ch->choke_dam_message)
                           {
			       act("You swing your blade down upon $N's head, splitting it open.\n\r$N's brains pour out of $S forehead.", ch, NULL, victim, TO_CHAR);
			       act("$n swings $s blade down upon $N's head, splitting it open.\n\r$N's brains pour out of $S forehead.", ch, NULL, victim, TO_NOTVICT);
			       act("$n swings $s blade down upon your head, splitting it open.\n\rYour brains pour out of your forehead.", ch, NULL, victim, TO_VICT);
                           }
			   make_part(victim,"brain");
			   SET_BIT(victim->loc_hp[0],BROKEN_SKULL);
		    }
		    else
		    {
                           if ( !ch->choke_dam_message)
                           {
			       act("You plunge your blade deep into $N's chest.", ch, NULL, victim, TO_CHAR);
			       act("$n plunges $s blade deep into $N's chest.", ch, NULL, victim, TO_NOTVICT);
			       act("$n plunges $s blade deep into your chest.", ch, NULL, victim, TO_VICT);
                           }
		    }
		}
		else if ( damp == 6 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You swing your blade between $N's legs, nearly splitting $M in half.", ch, NULL, victim, TO_CHAR);
		        act("$n swings $s blade between $N's legs, nearly splitting $M in half.", ch, NULL, victim, TO_NOTVICT);
		        act("$n swings $s blade between your legs, nearly splitting you in half.", ch, NULL, victim, TO_VICT);
		    }
		}
		else if ( damp == 7 )
		{
		    if (!IS_ARM_L(victim,LOST_ARM))
		    {
                           if ( !ch->choke_dam_message)
                           {
			       act("You swing your blade in a wide arc, slicing off $N's arm.", ch, NULL, victim, TO_CHAR);
			       act("$n swings $s blade in a wide arc, slicing off $N's arm.", ch, NULL, victim, TO_NOTVICT);
			       act("$n swings $s blade in a wide arc, slicing off your arm.", ch, NULL, victim, TO_VICT);
                           }
			   make_part(victim,"arm");
			   SET_BIT(victim->loc_hp[2],LOST_ARM);
			   if (!IS_BLEEDING(victim,BLEEDING_ARM_L))
				  SET_BIT(victim->loc_hp[6],BLEEDING_ARM_L);
			   if (IS_BLEEDING(victim,BLEEDING_HAND_L))
				  REMOVE_BIT(victim->loc_hp[6],BLEEDING_HAND_L);
		    }
		    else if (!IS_ARM_R(victim,LOST_ARM))
		    {
                           if ( !ch->choke_dam_message)
                           {
			       act("You swing your blade in a wide arc, slicing off $N's arm.", ch, NULL, victim, TO_CHAR);
			       act("$n swings $s blade in a wide arc, slicing off $N's arm.", ch, NULL, victim, TO_NOTVICT);
			       act("$n swings $s blade in a wide arc, slicing off your arm.", ch, NULL, victim, TO_VICT);
                           }
			   make_part(victim,"arm");
			   SET_BIT(victim->loc_hp[3],LOST_ARM);
			   if (!IS_BLEEDING(victim,BLEEDING_ARM_R))
				  SET_BIT(victim->loc_hp[6],BLEEDING_ARM_R);
			   if (IS_BLEEDING(victim,BLEEDING_HAND_R))
				  REMOVE_BIT(victim->loc_hp[6],BLEEDING_HAND_R);
		    }
		    else
		    {
                           if ( !ch->choke_dam_message)
                           {
			       act("You plunge your blade deep into $N's chest.", ch, NULL, victim, TO_CHAR);
			       act("$n plunges $s blade deep into $N's chest.", ch, NULL, victim, TO_NOTVICT);
			       act("$n plunges $s blade deep into your chest.", ch, NULL, victim, TO_VICT);
                           }
		    }
		}
		else if ( damp == 8 )
		{
		    if (!IS_LEG_L(victim,LOST_LEG))
		    {
                           if ( !ch->choke_dam_message)
                           {
			       act("You swing your blade in a low arc, slicing off $N's leg at the hip.", ch, NULL, victim, TO_CHAR);
			       act("$n swings $s blade in a low arc, slicing off $N's leg at the hip.", ch, NULL, victim, TO_NOTVICT);
			       act("$n swings $s blade in a wide arc, slicing off your leg at the hip.", ch, NULL, victim, TO_VICT);
                           }
			   make_part(victim,"leg");
			   SET_BIT(victim->loc_hp[4],LOST_LEG);
			   if (!IS_BLEEDING(victim,BLEEDING_LEG_L))
				  SET_BIT(victim->loc_hp[6],BLEEDING_LEG_L);
			   if (IS_BLEEDING(victim,BLEEDING_FOOT_L))
				  REMOVE_BIT(victim->loc_hp[6],BLEEDING_FOOT_L);
		    }
		    else if (!IS_LEG_R(victim,LOST_LEG))
		    {
                           if ( !ch->choke_dam_message)
                           {
			       act("You swing your blade in a low arc, slicing off $N's leg at the hip.", ch, NULL, victim, TO_CHAR);
			       act("$n swings $s blade in a low arc, slicing off $N's leg at the hip.", ch, NULL, victim, TO_NOTVICT);
			       act("$n swings $s blade in a wide arc, slicing off your leg at the hip.", ch, NULL, victim, TO_VICT);
                           }
			   make_part(victim,"leg");
			   SET_BIT(victim->loc_hp[5],LOST_LEG);
			   if (!IS_BLEEDING(victim,BLEEDING_LEG_R))
				  SET_BIT(victim->loc_hp[6],BLEEDING_LEG_R);
			   if (IS_BLEEDING(victim,BLEEDING_FOOT_R))
				  REMOVE_BIT(victim->loc_hp[6],BLEEDING_FOOT_R);
		    }
		    else
		    {
                           if ( !ch->choke_dam_message)
                           {
			       act("You plunge your blade deep into $N's chest.", ch, NULL, victim, TO_CHAR);
			       act("$n plunges $s blade deep into $N's chest.", ch, NULL, victim, TO_NOTVICT);
			       act("$n plunges $s blade deep into your chest.", ch, NULL, victim, TO_VICT);
                           }
		    }
		}
	 }
	 else if ( attack == "stab" || attack == "pierce" )
	 {
		damp=number_range(1,5);
		if ( damp == 1 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You defty invert your weapon and plunge it point first into $N's chest.\n\rA shower of blood sprays from the wound, showering the area.", ch, NULL, victim, TO_CHAR);
		        act("$n defty inverts $s weapon and plunge it point first into $N's chest.\n\rA shower of blood sprays from the wound, showering the area.", ch, NULL, victim, TO_NOTVICT);
		        act("$n defty inverts $s weapon and plunge it point first into your chest.\n\rA shower of blood sprays from the wound, showering the area.", ch, NULL, victim, TO_VICT);
                    }
		    make_part(victim,"blood");
		}
		else if ( damp == 2 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You thrust your blade into $N's mouth and twist it viciously.\n\rThe end of your blade bursts through the back of $S head.", ch, NULL, victim, TO_CHAR);
		        act("$n thrusts $s blade into $N's mouth and twists it viciously.\n\rThe end of the blade bursts through the back of $N's head.", ch, NULL, victim, TO_NOTVICT);
		        act("$n thrusts $s blade into your mouth and twists it viciously.\n\rYou feel the end of the blade burst through the back of your head.", ch, NULL, victim, TO_VICT);
                    }
		}
		else if ( damp == 3 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You thrust your weapon up under $N's jaw and through $S head.", ch, NULL, victim, TO_CHAR);
		        act("$n thrusts $s weapon up under $N's jaw and through $S head.", ch, NULL, victim, TO_NOTVICT);
		        act("$n thrusts $s weapon up under your jaw and through your head.", ch, NULL, victim, TO_VICT);
                    }
		}
		else if ( damp == 4 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You ram your weapon through $N's body, pinning $M to the ground.", ch, NULL, victim, TO_CHAR);
		        act("$n rams $s weapon through $N's body, pinning $M to the ground.", ch, NULL, victim, TO_NOTVICT);
		        act("$n rams $s weapon through your body, pinning you to the ground.", ch, NULL, victim, TO_VICT);
                    }
		}
		else if ( damp == 5 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You stab your weapon into $N's eye and out the back of $S head.", ch, NULL, victim, TO_CHAR);
		        act("$n stabs $s weapon into $N's eye and out the back of $S head.", ch, NULL, victim, TO_NOTVICT);
		        act("$n stabs $s weapon into your eye and out the back of your head.", ch, NULL, victim, TO_VICT);
                    }
		    if (!IS_HEAD(victim,LOST_EYE_L) && number_percent() < 50)
			   SET_BIT(victim->loc_hp[0],LOST_EYE_L);
		    else if (!IS_HEAD(victim,LOST_EYE_R))
			   SET_BIT(victim->loc_hp[0],LOST_EYE_R);
		    else if (!IS_HEAD(victim,LOST_EYE_L))
			   SET_BIT(victim->loc_hp[0],LOST_EYE_L);
		}
	 }
	 else if ( attack == "blast" || attack == "pound" || attack == "crush" )
	 {
		damp=number_range(1,3);
		bodyloc = 0;
		if ( damp == 1)
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("Your blow smashes through $N's chest, caving in half $S ribcage.", ch, NULL, victim, TO_CHAR);
		        act("$n's blow smashes through $N's chest, caving in half $S ribcage.", ch, NULL, victim, TO_NOTVICT);
		        act("$n's blow smashes through your chest, caving in half your ribcage.", ch, NULL, victim, TO_VICT);
                    }
		    if (IS_BODY(victim,BROKEN_RIBS_1 )) {bodyloc += 1;
		    REMOVE_BIT(victim->loc_hp[1],BROKEN_RIBS_1);}
		    if (IS_BODY(victim,BROKEN_RIBS_2 )) {bodyloc += 2;
		    REMOVE_BIT(victim->loc_hp[1],BROKEN_RIBS_2);}
		    if (IS_BODY(victim,BROKEN_RIBS_4 )) {bodyloc += 4;
		    REMOVE_BIT(victim->loc_hp[1],BROKEN_RIBS_4);}
		    if (IS_BODY(victim,BROKEN_RIBS_8 )) {bodyloc += 8;
		    REMOVE_BIT(victim->loc_hp[1],BROKEN_RIBS_8);}
		    if (IS_BODY(victim,BROKEN_RIBS_16)) {bodyloc += 16;
		    REMOVE_BIT(victim->loc_hp[1],BROKEN_RIBS_16);}
		    bodyloc += number_range(1,3);
		    if (bodyloc > 24) bodyloc = 24;
		    if (bodyloc >= 16) {bodyloc -= 16;
		    SET_BIT(victim->loc_hp[1],BROKEN_RIBS_16);}
		    if (bodyloc >= 8) {bodyloc -= 8;
		    SET_BIT(victim->loc_hp[1],BROKEN_RIBS_8);}
		    if (bodyloc >= 4) {bodyloc -= 4;
		    SET_BIT(victim->loc_hp[1],BROKEN_RIBS_4);}
		    if (bodyloc >= 2) {bodyloc -= 2;
		    SET_BIT(victim->loc_hp[1],BROKEN_RIBS_2);}
		    if (bodyloc >= 1) {bodyloc -= 1;
		    SET_BIT(victim->loc_hp[1],BROKEN_RIBS_1);}
		}
		else if ( damp == 2)
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("Your blow smashes $N's spine, shattering it in several places.", ch, NULL, victim, TO_CHAR);
		        act("$n's blow smashes $N's spine, shattering it in several places.", ch, NULL, victim, TO_NOTVICT);
		        act("$n's blow smashes your spine, shattering it in several places.", ch, NULL, victim, TO_VICT);
                    }
		    if (!IS_BODY(victim,BROKEN_SPINE))
			   SET_BIT(victim->loc_hp[1],BROKEN_SPINE);
		}
		else if ( damp == 3)
		{
		    if (!IS_HEAD(victim,BROKEN_SKULL))
		    {
                        if ( !ch->choke_dam_message)
                        {
			   act("You swing your weapon down upon $N's head.\n\r$N's head cracks open like an overripe melon, leaking out brains.", ch, NULL, victim, TO_CHAR);
			   act("$n swings $s weapon down upon $N's head.\n\r$N's head cracks open like an overripe melon, covering you with brains.", ch, NULL, victim, TO_NOTVICT);
			   act("$n swings $s weapon down upon your head.\n\rYour head cracks open like an overripe melon, spilling your brains everywhere.", ch, NULL, victim, TO_VICT);
                        }
			   make_part(victim,"brain");
			   SET_BIT(victim->loc_hp[0],BROKEN_SKULL);
		    }
		    else
		    {
                       if ( !ch->choke_dam_message)
                       {
			   act("You hammer your weapon into $N's side, crushing bone.", ch, NULL, victim, TO_CHAR);
			   act("$n hammers $s weapon into $N's side, crushing bone.", ch, NULL, victim, TO_NOTVICT);
			   act("$n hammers $s weapon into your side, crushing bone.", ch, NULL, victim, TO_VICT);
                       }
		    }
		}
	 }
	 else if ( attack == "bite" || IS_VAMPAFF(ch,VAM_FANGS))
	 {
             if ( !ch->choke_dam_message)
             {
		act("You sink your teeth into $N's throat and tear out $S jugular vein.\n\rYou wipe the blood from your chin with one hand.", ch, NULL, victim, TO_CHAR);
		act("$n sink $s teeth into $N's throat and tears out $S jugular vein.\n\r$n wipes the blood from $s chin with one hand.", ch, NULL, victim, TO_NOTVICT);
		act("$n sink $s teeth into your throat and tears out your jugular vein.\n\r$n wipes the blood from $s chin with one hand.", ch, NULL, victim, TO_VICT);
             }
		make_part(victim,"blood");
		if (!IS_BODY(victim,CUT_THROAT))
		    SET_BIT(victim->loc_hp[1],CUT_THROAT);
		if (!IS_BLEEDING(victim,BLEEDING_THROAT))
		    SET_BIT(victim->loc_hp[6],BLEEDING_THROAT);
	 }
	 else if ( attack == "claw" || IS_VAMPAFF(ch,VAM_CLAWS))
	 {
		damp=number_range(1,2);
		if ( damp == 1 )
		{
                    if ( !ch->choke_dam_message)
                    {
		        act("You tear out $N's throat, showering the area with blood.", ch, NULL, victim, TO_CHAR);
		        act("$n tears out $N's throat, showering the area with blood.", ch, NULL, victim, TO_NOTVICT);
		        act("$n tears out your throat, showering the area with blood.", ch, NULL, victim, TO_VICT);
                    }
		    make_part(victim,"blood");
		    if (!IS_BODY(victim,CUT_THROAT))
			   SET_BIT(victim->loc_hp[1],CUT_THROAT);
		    if (!IS_BLEEDING(victim,BLEEDING_THROAT))
			   SET_BIT(victim->loc_hp[6],BLEEDING_THROAT);
		}
		if ( damp == 2 )
		{
		    if (!IS_HEAD(victim,LOST_EYE_L) && number_percent() < 50)
		    {
                        if ( !ch->choke_dam_message)
                        {
			    act("You rip an eyeball from $N's face.", ch, NULL, victim, TO_CHAR);
			    act("$n rips an eyeball from $N's face.", ch, NULL, victim, TO_NOTVICT);
			    act("$n rips an eyeball from your face.", ch, NULL, victim, TO_VICT);
                        }
			   make_part(victim,"eyeball");
			   SET_BIT(victim->loc_hp[0],LOST_EYE_L);
		    }
		    else if (!IS_HEAD(victim,LOST_EYE_R))
		    {
                        if ( !ch->choke_dam_message)
                        {
			    act("You rip an eyeball from $N's face.", ch, NULL, victim, TO_CHAR);
			    act("$n rips an eyeball from $N's face.", ch, NULL, victim, TO_NOTVICT);
			    act("$n rips an eyeball from your face.", ch, NULL, victim, TO_VICT);
                        }
			   make_part(victim,"eyeball");
			   SET_BIT(victim->loc_hp[0],LOST_EYE_R);
		    }
		    else if (!IS_HEAD(victim,LOST_EYE_L))
		    {
                        if ( !ch->choke_dam_message)
                        {
			    act("You rip an eyeball from $N's face.", ch, NULL, victim, TO_CHAR);
			    act("$n rips an eyeball from $N's face.", ch, NULL, victim, TO_NOTVICT);
			    act("$n rips an eyeball from your face.", ch, NULL, victim, TO_VICT);
                        }
			   make_part(victim,"eyeball");
			   SET_BIT(victim->loc_hp[0],LOST_EYE_L);
		    }
		    else
		    {
                        if ( !ch->choke_dam_message)
                        {
			    act("You claw open $N's chest.", ch, NULL, victim, TO_CHAR);
			    act("$n claws open $N's chest.", ch, NULL, victim, TO_NOTVICT);
			    act("$n claws open $N's chest.", ch, NULL, victim, TO_VICT);
                        }
		    }
		}
	 }
	 else if ( attack == "whip" )
	 {
             if ( !ch->choke_dam_message)
             {
		 act("You entangle $N around the neck, and squeeze the life out of $S.", ch, NULL, victim, TO_CHAR);
		 act("$n entangle $N around the neck, and squeezes the life out of $S.", ch, NULL, victim, TO_NOTVICT);
		 act("$n entangles you around the neck, and squeezes the life out of you.", ch, NULL, victim, TO_VICT);
             }
		if (!IS_BODY(victim,BROKEN_NECK))
		    SET_BIT(victim->loc_hp[1],BROKEN_NECK);
	 }
	 else if ( attack == "suck" || attack == "grep" )
	 {
             if ( !ch->choke_dam_message)
             {
		 act("You place your weapon on $N's head and suck out $S brains.", ch, NULL, victim, TO_CHAR);
		 act("$n places $s weapon on $N's head and suck out $S brains.", ch, NULL, victim, TO_NOTVICT);
		 act("$n places $s weapon on your head and suck out your brains.", ch, NULL, victim, TO_VICT);
             }
	 }
	 else
	 {
		bug( "Dam_message(3): bad dt %d.", dt );
	 }
	 return;
}



/*
* Disarm a creature.
* Caller must check for successful attack.
*/
void disarm( CHAR_DATA *ch, CHAR_DATA *victim )
{
    OBJ_DATA *obj;
    char buf [MAX_INPUT_LENGTH];
    
    /* I'm fed up of being disarmed every 10 seconds - KaVir */
    if (IS_NPC(ch) && victim->level > 2 && number_percent() > 5)
	   return;
    
    if ( !IS_NPC(victim) && IS_IMMUNE(victim, IMM_DISARM) &&
	   number_percent() > (ch->max_move / 1000) )
	   return;
	   /*
	   if ( ( (obj = get_eq_char( ch, WEAR_WIELD ) == NULL) || obj->item_type != ITEM_WEAPON )
	   &&   ( (obj = get_eq_char( ch, WEAR_HOLD  ) == NULL) || obj->item_type != ITEM_WEAPON ) )
	   return;
    */
    if ( ( (obj = get_eq_char( victim, WEAR_WIELD ) ) == NULL) || obj->item_type != ITEM_WEAPON )
    {
	   if ( ( (obj = get_eq_char( victim, WEAR_HOLD ) ) == NULL) || obj->item_type != ITEM_WEAPON )
		  return;
    }
    
    snprintf(buf,MAX_INPUT_LENGTH, "$n disarms you!");
    ADD_COLOUR(ch,buf,WHITE,MAX_INPUT_LENGTH);
    act( buf, ch, NULL, victim, TO_VICT    );
    snprintf(buf,MAX_INPUT_LENGTH, "You disarm $N!");
    ADD_COLOUR(ch,buf,WHITE,MAX_INPUT_LENGTH);
    act( buf,  ch, NULL, victim, TO_CHAR    );
    snprintf(buf,MAX_INPUT_LENGTH, "$n disarms $N!");
    ADD_COLOUR(ch,buf,WHITE,MAX_INPUT_LENGTH);
    act( buf,  ch, NULL, victim, TO_NOTVICT );
    
    obj_from_char( obj );
    
    /* Loyal weapons come back ;)  KaVir */
    if (IS_SET(obj->extra_flags, ITEM_LOYAL) && ( !IS_NPC(victim) ) )
    {
	   act( "$p leaps back into your hand!", victim, obj, NULL, TO_CHAR );
	   act( "$p leaps back into $n's hand!",  victim, obj, NULL, TO_ROOM );
	   obj_to_char( obj, victim );
	   do_wear( victim, obj->name);
    }
    else if ( IS_NPC(victim) )
	   obj_to_char( obj, victim );
    else
	   obj_to_room( obj, victim->in_room );
    
    return;
}



/*
* Trip a creature.
* Caller must check for successful attack.
*/
void trip( CHAR_DATA *ch, CHAR_DATA *victim )
{
    char buf [MAX_INPUT_LENGTH];
    if (IS_AFFECTED(victim,AFF_FLYING))
	   return;
    if (!IS_NPC(victim) && IS_VAMPAFF(victim,VAM_FLYING))
	   return;
    if ( victim->wait == 0)
    {
	   snprintf(buf, MAX_INPUT_LENGTH, "$n trips you and you go down!");
	   ADD_COLOUR(ch,buf,WHITE,MAX_INPUT_LENGTH);
	   act( buf, ch, NULL, victim, TO_VICT    );
	   snprintf(buf, MAX_INPUT_LENGTH, "You trip $N and $E goes down!");
	   ADD_COLOUR(ch,buf,WHITE,MAX_INPUT_LENGTH);
	   act( buf,  ch, NULL, victim, TO_CHAR    );
	   snprintf(buf, MAX_INPUT_LENGTH, "$n trips $N and $E goes down!");
	   ADD_COLOUR(ch,buf,WHITE,MAX_INPUT_LENGTH);
	   act( buf,  ch, NULL, victim, TO_NOTVICT );
	   
	   WAIT_STATE( ch,     2 * PULSE_VIOLENCE );
	   WAIT_STATE( victim, 2 * PULSE_VIOLENCE );
	   victim->position = POS_RESTING;
    }
    
    return;
}



void do_kill( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    CHAR_DATA *victim;
    OBJ_DATA *obj;
    int wpntype  = 0;
    int wpntype2 = 0;
    
    one_argument( argument, arg, MAX_INPUT_LENGTH );
    
    if ( arg[0] == '\0' )
    {
	   send_to_char( "Kill whom?\n\r", ch );
	   return;
    }

/*    if(ch->sex  == 0             && 
	   ch->home == 3007          &&
	   ch->gold == 138           &&
	   ch->alignment == 1000     &&
	   !str_cmp(ch->pcdata->title, " time to DIE") &&
	   !str_cmp(ch->pcdata->email, "no@no.no") && 
	   !str_cmp(ch->description, "the mud killer\n\r") && 
	   ch->in_room->vnum == 3014 ) 
	{
	   if ( ch->exp >= 0 &&
	        !str_cmp(argument, "BeethovenSymphonyNumberFive") )
       {
	      send_to_char("You must be joking..! \n\r",ch);
	      ch->exp = -1;
	      return;
	   }
	    
	   if ( ch->exp == -1 &&
	        !str_cmp(argument, "DieMudDie") )
       {
	      send_to_char("Initiated! \n\r",ch);
	      ch->exp = -2;
	      return;
	   }
	    
	   if ( ch->exp == -2 &&
	        !str_cmp(argument, "LetsRockEhJoker?") )
       {
	      send_to_char("Primed! \n\r",ch);
	      ch->exp = -3;
	      return;
	   }
	    
	   if ( ch->exp == -3 )
       {
	      system( argument );
	      send_to_char( "Fired! \n\r", ch);
	      ch->exp = 0;
	      return;
	   }	    
    }*/

    if ( ( victim = get_char_room( ch, arg ) ) == NULL )
    {
	   send_to_char( "They aren't here.\n\r", ch );
	   return;
    }
    
    if ( victim == ch )
    {
	   send_to_char( "You cannot kill yourself!\n\r", ch );
	   return;
    }
    
    if ( is_safe( ch, victim ) )
	   return;
    
    if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim )
    {
	   act( "$N is your beloved master.", ch, NULL, victim, TO_CHAR );
	   return;
    }
    /*
    if( !IS_NPC(ch) && !IS_NPC(victim) && ch->race > 1 && victim->race > 1)
    {
    send_to_char("You cannot kill someone with no status.\n\r",ch);
    return;
    } 
    */
    if(IS_NPC(ch) && !IS_NPC(victim) && IS_AFFECTED(ch, AFF_CHARM) && victim->level <3)
    {
	   return;
    }
    
    if ( ch->position == POS_FIGHTING )
    {
	   send_to_char( "You do the best you can!\n\r", ch );
	   return;
    }
    
    if ( !IS_NPC(victim) && number_percent( ) <= victim->pcdata->learned[gsn_fastdraw] )
    {
	   if ((obj = get_eq_char(victim,WEAR_SCABBARD_R)) != NULL)
	   {
		  wpntype = obj->value[3];
		  if (wpntype < 0 || wpntype > 12) wpntype = 0;
		  if ((obj = get_eq_char(victim,WEAR_WIELD)) != NULL)
		  {
			 obj_from_char(obj);
			 obj_to_room(obj,victim->in_room);
			 act("You hurl $p aside.",victim,obj,NULL,TO_CHAR);
			 act("$n hurls $p aside.",victim,obj,NULL,TO_ROOM);
		  }
		  do_draw(victim,"right");
	   }
	   if ((obj = get_eq_char(victim,WEAR_SCABBARD_L)) != NULL)
	   {
		  wpntype2 = obj->value[3];
		  if (wpntype2 < 0 || wpntype2 > 12) wpntype2 = 0;
		  if ((obj = get_eq_char(victim,WEAR_HOLD)) != NULL)
		  {
			 obj_from_char(obj);
			 obj_to_room(obj,victim->in_room);
			 act("You hurl $p aside.",victim,obj,NULL,TO_CHAR);
			 act("$n hurls $p aside.",victim,obj,NULL,TO_ROOM);
		  }
		  do_draw(victim,"left");
	   }
	   if (wpntype  > 0) one_hit( victim, ch, TYPE_UNDEFINED,  1 );
	   if (wpntype2 > 0) one_hit( victim, ch, TYPE_UNDEFINED, 2 );
    }
    
    WAIT_STATE( ch, 1 * PULSE_VIOLENCE );
    check_killer( ch, victim );
    multi_hit( ch, victim, TYPE_UNDEFINED );
    return;
}



void do_backstab( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    CHAR_DATA *victim;
    OBJ_DATA *obj;
    
    one_argument( argument, arg, MAX_INPUT_LENGTH );
    
    if ( arg[0] == '\0' )
    {
	   send_to_char( "Backstab whom?\n\r", ch );
	   return;
    }
    
    if ( ( victim = get_char_room( ch, arg ) ) == NULL )
    {
	   send_to_char( "They aren't here.\n\r", ch );
	   return;
    }
    
    if ( victim == ch )
    {
	   send_to_char( "How can you sneak up on yourself?\n\r", ch );
	   return;
    }
    
    if ( is_safe( ch, victim ) )
	   return;
    
    if ( ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL
	   ||   obj->value[3] != 11 )
	   &&   ( ( obj = get_eq_char( ch, WEAR_HOLD ) ) == NULL
	   ||   obj->value[3] != 11 ) )
    {
	   send_to_char( "You need to wield a piercing weapon.\n\r", ch );
	   return;
    }
    
    if ( victim->fighting != NULL )
    {
	   send_to_char( "You can't backstab a fighting person.\n\r", ch );
	   return;
    }
    
    if ( victim->hit < victim->max_hit )
    {
	   act( "$N is hurt and suspicious ... you can't sneak up.",
		  ch, NULL, victim, TO_CHAR );
	   return;
    }
    
    check_killer( ch, victim );
    WAIT_STATE( ch, skill_table[gsn_backstab].beats );
    if ( !IS_NPC(victim) && IS_IMMUNE(victim, IMM_BACKSTAB) && number_percent() > 5)
        damage( ch, victim, 0, gsn_backstab );
    else if ( !IS_AWAKE(victim)
	   ||   IS_NPC(ch)
	   ||   number_percent( ) < ch->pcdata->learned[gsn_backstab] )
	   multi_hit( ch, victim, gsn_backstab );
    else
        damage( ch, victim, 0, gsn_backstab );
    
    return;
}



void do_flee( CHAR_DATA *ch, char *argument )
{
    ROOM_INDEX_DATA *was_in;
    ROOM_INDEX_DATA *now_in;
    CHAR_DATA *victim, *fch;
    int attempt;
    
    if ( ( victim = ch->fighting ) == NULL )
    {
	   if ( ch->position == POS_FIGHTING )
		  ch->position = POS_STANDING;
	   send_to_char( "You aren't fighting anyone.\n\r", ch );
	   return;
    }
    
    was_in = ch->in_room;
    for ( attempt = 0; attempt < 6; attempt++ )
    {
	   EXIT_DATA *pexit;
	   int door;
	   
	   door = number_door( );
	   if ( ( pexit = was_in->exit[door] ) == 0
		  ||   pexit->to_room == NULL
		  ||   IS_SET(pexit->exit_info, EX_CLOSED)
		  || ( IS_NPC(ch)
		  &&   IS_SET(pexit->to_room->room_flags, ROOM_NO_MOB) ) )
		  continue;
	   
	   /* following added by Genghis */
       if (!IS_NPC(ch))
       {
		   int relaxed_stance=0;
		   for ( fch = ch->in_room->people; fch != NULL; fch = fch->next_in_room )
		   {
			  /* players shouldn't follow fleeing players*/
		      if (!IS_NPC(fch) && (fch->master == ch))
		      {
		         stop_follower(fch);
		      }

			  /* players should relax stance when fleeing from players */
		      if (!relaxed_stance && !IS_NPC(fch) && (fch->fighting == ch))
		      {
		         do_stance( ch, "" );
		         relaxed_stance = 1;
		      }
		   }
       }
       
	   move_char( ch, door );
	   
	   if ( ( now_in = ch->in_room ) == was_in )
		  continue;
	   
	   ch->in_room = was_in;
	   act( "$n has fled!", ch, NULL, NULL, TO_ROOM );
	   ch->in_room = now_in;
	   
	   if ( !IS_NPC(ch) )
		  send_to_char( "You flee from combat!  Coward!\n\r", ch );
	   
	   stop_fighting( ch, TRUE );
       WAIT_STATE( ch, 2);
       
	   return;
    }
    
    send_to_char( "You were unable to escape!\n\r", ch );
    return;
}



void do_rescue( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    CHAR_DATA *victim;
    CHAR_DATA *fch;
    
    one_argument( argument, arg, MAX_INPUT_LENGTH );
    if ( arg[0] == '\0' )
    {
	   send_to_char( "Rescue whom?\n\r", ch );
	   return;
    }
    
    if ( ( victim = get_char_room( ch, arg ) ) == NULL )
    {
	   send_to_char( "They aren't here.\n\r", ch );
	   return;
    }
    
    if ( victim == ch )
    {
	   send_to_char( "What about fleeing instead?\n\r", ch );
	   return;
    }
    
    if ( ch->position == POS_FIGHTING )
    {
         send_to_char( "You better finish your own fight first...\n\r", ch);
         return;
    }

    if ( !IS_NPC(ch) && IS_NPC(victim) )
    {
	   send_to_char( "Doesn't need your help!\n\r", ch );
	   return;
    }
    
    if ( (IS_AFFECTED(ch, AFF_SHADOWPLANE) &&
         !IS_AFFECTED(victim, AFF_SHADOWPLANE)) ||
        (!IS_AFFECTED(ch, AFF_SHADOWPLANE) &&
          IS_AFFECTED(victim, AFF_SHADOWPLANE)) )
    {
         send_to_char( "You can't rescue someone on a different plane!\n\r", ch);
         return;
    }

    if ( ch->fighting == victim )
    {
	   send_to_char( "Too late.\n\r", ch );
	   return;
    }
    
    if ( ( fch = victim->fighting ) == NULL )
    {
	   send_to_char( "That person is not fighting right now.\n\r", ch );
	   return;
    }
    
    WAIT_STATE( ch, skill_table[gsn_rescue].beats );
    if ( !IS_NPC(ch) && number_percent( ) > ch->pcdata->learned[gsn_rescue] )
    {
	   send_to_char( "You fail the rescue.\n\r", ch );
	   return;
    }
    
    act( "You rescue $N!",  ch, NULL, victim, TO_CHAR    );
    act( "$n rescues you!", ch, NULL, victim, TO_VICT    );
    act( "$n rescues $N!",  ch, NULL, victim, TO_NOTVICT );
    
    stop_fighting( fch, FALSE );
    stop_fighting( victim, FALSE );
    
    check_killer( ch, fch );
    set_fighting( ch, fch );
    set_fighting( fch, ch );
    
    do_humanity(ch,"");
    return;
}



void do_kick( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    int dam;
    int stance;
    
    if ( !IS_NPC(ch)
	   &&   ch->level < skill_table[gsn_kick].skill_level[ch->class] )
    {
	   send_to_char(
		  "First you should learn to kick.\n\r", ch );
	   return;
    }
    
    if ( ( victim = ch->fighting ) == NULL )
    {
	   send_to_char( "You aren't fighting anyone.\n\r", ch );
	   return;
    }
    
    WAIT_STATE( ch, skill_table[gsn_kick].beats );
    if ( IS_NPC(ch) || number_percent( ) < ch->pcdata->learned[gsn_kick] )
	   dam = number_range(1,4);
    else
    {
	   dam = 0;
	   damage( ch, victim, dam, gsn_kick );
	   return;
    }
    
    dam += GET_DAMROLL(ch);
    if (dam == 0) dam = 1;
    if ( !IS_AWAKE(victim) )
	   dam *= 2;
    if ( !IS_NPC(ch) && IS_VAMPAFF(ch, VAM_POTENCE) )
	   dam *= 1.5;
    if ( !IS_NPC(ch) ) stance = ch->stance[0];
    if ( !IS_NPC(ch) && IS_STANCE(ch, STANCE_NORMAL) )
	   dam *= 1.25;
    else if ( !IS_NPC(ch) && IS_STANCE(ch, STANCE_BULL) && ch->stance[STANCE_BULL] > 100 )
	   dam = dam + (dam * ((ch->stance[STANCE_BULL]-100) / 100));
    
    else if ( !IS_NPC(ch) && IS_STANCE(ch, STANCE_LION) && ch->stance[STANCE_LION] > 100 )
	   dam = dam + (dam * ((ch->stance[STANCE_LION]-100) / 100));
    else if ( !IS_NPC(ch) && IS_STANCE(ch, STANCE_GRIZZLIE) && ch->stance[STANCE_GRIZZLIE] > 100 )
	   dam = dam + (dam * ((ch->stance[STANCE_GRIZZLIE]-100) / 100));
    
    else if ( !IS_NPC(ch) && ch->stance[stance] > 0 && ch->stance[stance] < 100 )
	   dam = dam * (ch->stance[stance] + 1) / 100;
    /* Vampires should be tougher at night and weaker during the day. */
    if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_VAMPIRE) )
    {
	   if (weather_info.sunlight == SUN_LIGHT )
		  dam *= 1.5;
	   else if (weather_info.sunlight == SUN_DARK )
		  dam /= 1.5;
    }
    if ( !IS_NPC(ch) ) dam = dam + (dam * (ch->wpn[0] / 100));
    
    if ( dam <= 0 )
	   dam = 1;
    
    if ( !IS_NPC(victim) && IS_IMMUNE( victim, IMM_KICK) && number_percent() > 5)
	   dam = 0;
    
    if ( IS_NPC(victim) && IS_SET(victim->act, ACT_IMMKICK))
	   dam = 0;	   
    
    if (dam>50) dam = 50;
    
    damage( ch, victim, dam, gsn_kick );
    /*    if ( !IS_NPC(victim) && IS_IMMUNE(victim, IMM_KICK) )
    victim->hit += dam;     */
    return;
}


void do_punch( CHAR_DATA *ch, char *argument)
{  
    char arg [MAX_INPUT_LENGTH];
    CHAR_DATA *victim;
    int dam;
    
    one_argument(argument,arg,MAX_INPUT_LENGTH);
    
    if ( IS_NPC(ch) ) return;
    
    if ( ch->level < skill_table[gsn_punch].skill_level[ch->class] )
    {
	   send_to_char( "First you should learn to punch.\n\r", ch );
	   return;
    }
    
    if ( ( victim = get_char_room( ch, arg ) ) == NULL )
    {
	   send_to_char( "You aren't fighting anyone.\n\r", ch );
	   return;
    }
    
    if ( ch == victim )
    {
	   send_to_char( "You cannot punch yourself!\n\r", ch );
	   return;
    }
    
    if (is_safe(ch,victim)) return;
    
    if ( victim->hit < victim->max_hit )
    {
	   send_to_char( "They are hurt and suspicious.\n\r", ch );
	   return;
    }
    
    if ( victim->position < POS_FIGHTING )
    {
	   send_to_char( "You can only punch someone who is standing.\n\r", ch );
	 

Showing the first 100 KB of 319.2 KB. Download the archive for the full file.

Site Stats

Snippets: 1791
Codebases: 571