fight.c

paradox/src/fight.c · 186.6 KB

From the archive paradox_no_release.tar.gz

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.                                                  *
 ***************************************************************************/

/***************************************************************************
*	ROM 2.4 is copyright 1993-1995 Russ Taylor			   *
*	ROM has been brought to you by the ROM consortium		   *
*	    Russ Taylor (rtaylor@pacinfo.com)				   *
*	    Gabrielle Taylor (gtaylor@pacinfo.com)			   *
*	    Brian Moore (rom@rom.efn.org)				   *
*	By using this code, you have agreed to follow the terms of the	   *
*	ROM license, in the file Rom24/doc/rom.license			   *
***************************************************************************/

/*************************************************************************** 
*       ROT 1.4 is copyright 1996-1997 by Russ Walsh                       * 
*       By using this code, you have agreed to follow the terms of the     * 
*       ROT license, in the file doc/rot.license                           * 
***************************************************************************/

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

/* command procedures needed */
DECLARE_DO_FUN(do_assassinate 	);
DECLARE_DO_FUN(do_backstab	);
DECLARE_DO_FUN(do_emote		);
DECLARE_DO_FUN(do_berserk	);
DECLARE_DO_FUN(do_bash		);
DECLARE_DO_FUN(do_trip		);
DECLARE_DO_FUN(do_earthbind	);
DECLARE_DO_FUN(do_dirt		);
DECLARE_DO_FUN(do_flee		);
DECLARE_DO_FUN(do_kick		);
DECLARE_DO_FUN(do_disarm	);
DECLARE_DO_FUN(do_get		);
DECLARE_DO_FUN(do_recall	);
DECLARE_DO_FUN(do_yell		);
DECLARE_DO_FUN(do_sacrifice	);
DECLARE_DO_FUN(do_circle	);
DECLARE_DO_FUN(do_feed		);
DECLARE_DO_FUN(do_gouge		);
DECLARE_DO_FUN(do_vdpi		);
DECLARE_DO_FUN(do_vdtr		);
DECLARE_DO_FUN(do_vdth		);
DECLARE_DO_FUN(do_look		);
DECLARE_DO_FUN(do_rub		);
DECLARE_DO_FUN(do_blackjack	);
DECLARE_DO_FUN(do_charge	);
DECLARE_DO_FUN(do_shield_smash	);
DECLARE_DO_FUN(do_strike	);
DECLARE_DO_FUN(do_whirlwind	);

DECLARE_SPELL_FUN(spell_null	);

/*
 * Local functions.
 */
void	check_assist	args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
bool	check_dodge	args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
bool	check_parry	args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
bool    check_shield_block     args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
bool    check_critical_hit args((CHAR_DATA *ch, CHAR_DATA *victim));
bool	check_phase	args((CHAR_DATA *ch,	CHAR_DATA *victim));
bool	check_force	args((CHAR_DATA *ch,	CHAR_DATA *victim));
bool	check_armor	args((CHAR_DATA *ch, CHAR_DATA *victim, int dam));
bool 	check_shield	args((CHAR_DATA *ch, CHAR_DATA *victim, int dam));
bool	check_stone_skin args((CHAR_DATA *ch, CHAR_DATA *victim, int dam));
void	counter_attack	args((CHAR_DATA *ch,	CHAR_DATA *victim));

void    dam_message 	args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam,
                            int dt, bool immune, int suppress, bool singular ) );
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, 
			    int total_levels, int members ) );
bool	is_safe		args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
bool	is_voodood	args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void	make_corpse	args( ( CHAR_DATA *ch, CHAR_DATA *killer, int lootpoint ) );
void	one_hit	args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt, bool secondary ) );
void    mob_hit		args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) );
void	raw_kill	args( ( CHAR_DATA *victim, CHAR_DATA *killer, int lootpoint ) );
void	set_fighting	args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void	disarm		args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void    process_shields args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
int     monk_style      args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt, int dam ));
void	check_arena	args( ( CHAR_DATA *ch, CHAR_DATA *victim));
void	check_quest	args( ( CHAR_DATA *ch, CHAR_DATA *victim));
void	check_leech	args( ( CHAR_DATA *ch, CHAR_DATA *victim));
void	iquest_announce	args((const char *buf));

TEAM_DATA *team_list = NULL;

/*
 * Control the fights going on.
 * Called periodically by update_handler.
 */
void violence_update( void )
{
    CHAR_DATA *ch;
    CHAR_DATA *ch_next;
    CHAR_DATA *victim;

    for ( ch = char_list; ch != NULL; ch = ch->next )
    {
	AFFECT_DATA *paf;
        AFFECT_DATA *paf_next;

        ch_next	= ch->next;
        
        for( paf = ch->affected; paf!=NULL; paf=paf_next)
        {
          paf_next = paf->next;
          if( paf->duration>1000)
           paf->duration--;
          else if( paf->duration<1000 )
               ;
          else
          {
           if(paf_next==NULL
            || paf_next->type != paf->type
            || ((paf_next->duration > 0)&&(paf_next->duration!=1000)))
           {
            if( paf->type > 0 && skill_table[paf->type].msg_off)
            {
              send_to_char(skill_table[paf->type].msg_off,ch);
              send_to_char("\n\r",ch);
            }
           }
          paf->duration=0;
          affect_remove(ch,paf);
        } 
      }              
        if(ch->fighting==NULL && !IS_NPC(ch) && (ch->pcdata->pkflag>0))
        {
         if(--ch->pcdata->pkflag==0)
          send_to_char("Your heart stops pounding.\n\r",ch);
        }
         
         
	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 );
            process_shields(ch, victim);
        }
	else
	    stop_fighting( ch, FALSE );

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

	/*
	 * Fun for the whole family!
	 */
	check_assist(ch,victim);
    
	if ( IS_NPC( ch ) )
	{
	    if ( HAS_TRIGGER( ch, TRIG_FIGHT ) )
		mp_percent_trigger( ch, victim, NULL, NULL, TRIG_FIGHT );
	    if ( HAS_TRIGGER( ch, TRIG_HPCNT ) )
		mp_hprct_trigger( ch, victim );
	}
    }

    return;
}

/* for auto assisting */
void check_assist(CHAR_DATA *ch,CHAR_DATA *victim)
{
    CHAR_DATA *rch, *rch_next;

    for (rch = ch->in_room->people; rch != NULL; rch = rch_next)
    {
	rch_next = rch->next_in_room;
	
	if (IS_AWAKE(rch) && rch->fighting == NULL)
	{

	    /* quick check for ASSIST_PLAYER */
	    if (!IS_NPC(ch) && IS_NPC(rch) 
	    && IS_SET(rch->off_flags,ASSIST_PLAYERS)
	    &&  rch->level + 6 > victim->level)
	    {
		do_emote(rch,"{Rscreams and attacks!{x");
		multi_hit(rch,victim,TYPE_UNDEFINED);
		continue;
	    }

	    /* PCs next */
	    if (!IS_NPC(ch) || IS_AFFECTED(ch,AFF_CHARM))
	    {
		if ( ( (!IS_NPC(rch) && IS_SET(rch->act,PLR_AUTOASSIST))
		||     IS_AFFECTED(rch,AFF_CHARM)) 
		&&   is_same_group(ch,rch) 
		&&   !is_safe_spell(rch, victim,FALSE))
		    multi_hit (rch,victim,TYPE_UNDEFINED);
		
		continue;
	    }
  	
	    /* now check the NPC cases */
	    
 	    if (IS_NPC(ch) && !IS_AFFECTED(ch,AFF_CHARM))
	
	    {
		if ( (IS_NPC(rch) && IS_SET(rch->off_flags,ASSIST_ALL))

		||   (IS_NPC(rch) && rch->group && rch->group == ch->group)

		||   (IS_NPC(rch) && rch->race == ch->race 
		   && IS_SET(rch->off_flags,ASSIST_RACE))

		||   (IS_NPC(rch) && IS_SET(rch->off_flags,ASSIST_ALIGN)
		   &&   ((IS_GOOD(rch)    && IS_GOOD(ch))
		     ||  (IS_EVIL(rch)    && IS_EVIL(ch))
		     ||  (IS_NEUTRAL(rch) && IS_NEUTRAL(ch)))) 

		||   (rch->pIndexData == ch->pIndexData 
		   && IS_SET(rch->off_flags,ASSIST_VNUM)))

	   	{
		    CHAR_DATA *vch;
		    CHAR_DATA *target;
		    int number;

		    if (number_bits(1) == 0)
			continue;
		
		    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)
		    {
			do_emote(rch,"{Rscreams and attacks!{x");
			multi_hit(rch,target,TYPE_UNDEFINED);
		    }
		}	
	    }
	}
    }
}


/*
 * Do one group of attacks.
 */
void multi_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
{
    int     chance;
    int lastfailed=0;

    /* decrement the wait */
    if (ch->desc == NULL)
	ch->wait = UMAX(0,ch->wait - PULSE_VIOLENCE);

    if (ch->desc == NULL)
	ch->daze = UMAX(0,ch->daze - PULSE_VIOLENCE); 


    /* no attacks for stunnies -- just a check */
    if (ch->position < POS_RESTING)
	return;

    if (ch->stunned)
    {
	ch->stunned--;
	if (!ch->stunned)
	{
	    send_to_char( "You regain your equilibrium.\n\r", ch);
	    act( "$n regains $s equilibrium.", ch, NULL, NULL, TO_ROOM );
	}
        return;
    }

    if (IS_NPC(ch))
    {
	mob_hit(ch,victim,dt);
	return;
    }

    one_hit( ch, victim, dt, FALSE );
    
    if(ch->fighting != victim)
     return;
   
    if (get_eq_char (ch, WEAR_SECONDARY) && (dt!=gsn_charge))
    {
	chance = (get_skill(ch,gsn_dual_wield)*2)/3;
        if(IS_AFFECTED(ch, AFF_SLOW))
         chance/=2;
	if ( number_percent( ) < chance )
	{
	    one_hit( ch, victim, dt, TRUE );
	    if ( get_skill(ch,gsn_dual_wield) != 0 && (!IS_NPC(ch)
	    && ch->level >= skill_table[gsn_dual_wield].skill_level[ch->class]))
	    {
		check_improve(ch,gsn_dual_wield,TRUE,6);
	    }
	} else {
          lastfailed=1;
        }
        if((dt!=gsn_backstab)&&(dt!=gsn_circle)&&(dt!=gsn_assassinate)
              &&(dt!=gsn_strike))
        {
         if ( ch->fighting != victim )
             return;
         chance=(get_skill(ch,gsn_2nd_dual)*2)/3;
         if(IS_AFFECTED(ch, AFF_SLOW))
          chance/=3;
         if(lastfailed)
         {
          chance/=2;
          lastfailed=0;
         }
         if(number_percent()<chance)
         { 
          one_hit(ch, victim, dt, TRUE);
          check_improve(ch,gsn_2nd_dual,TRUE,6);
          if(ch->fighting!=victim)   
           return;
         } else {
          lastfailed=1;
         }
        chance=(get_skill(ch,gsn_3rd_dual)*2)/3;
        if(IS_AFFECTED(ch,AFF_SLOW))
          chance/=4;
        if(lastfailed)
        {
         chance/=2;
         lastfailed=0;
        }
        if(number_percent()<chance)
        {
         one_hit(ch, victim, dt, TRUE);
         check_improve(ch,gsn_3rd_dual,TRUE,6);
         if(ch->fighting!=victim)
          return;
        } else {
         lastfailed=1;
        }
        chance=(get_skill(ch,gsn_4th_dual)*2)/3;
        if(IS_AFFECTED(ch,AFF_SLOW))
         chance/=5;
        if(lastfailed)
        {
         chance/=2;
         lastfailed=0;
        }
        if(number_percent()<chance)
        {
         one_hit(ch,victim,dt,TRUE);
         check_improve(ch,gsn_4th_dual,TRUE,6);
         if(ch->fighting!=victim)
          return;
        } else {
         lastfailed=1;
        }
      }
    } /* end dual attacks */

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

    if(dt==gsn_strike)
     return;

    if(IS_AFFECTED(ch,AFF_HASTE))
      one_hit(ch,victim,dt,FALSE);

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

    if(dt==gsn_backstab || dt==gsn_circle || dt==gsn_assassinate)
    {
     bool success=FALSE;
     chance=get_skill(ch,gsn_offhand);
     if(!chance) return;
     if(IS_AFFECTED(ch,AFF_SLOW))
      chance/=2;
     chance=(chance*3)/4 + (ch->level-victim->level);
     if(number_percent()<chance){
      one_hit(ch,victim,dt,FALSE); success=TRUE; }
     if((number_percent()<chance) && (ch->fighting==victim)
       && get_eq_char(ch,WEAR_SECONDARY)){
      one_hit(ch,victim,dt,TRUE); success=TRUE; }
     if(success)
      check_improve(ch,gsn_offhand,TRUE,5); 
    }	

    if ( ch->fighting != victim || dt == gsn_backstab || dt == gsn_circle || dt == gsn_assassinate)
	return;

    chance = (get_skill(ch,gsn_second_attack)*2)/3;

    if (IS_AFFECTED(ch,AFF_SLOW))
	chance /= 2;

    if ( number_percent( ) < chance )
    {
	one_hit( ch, victim, dt, FALSE );
	check_improve(ch,gsn_second_attack,TRUE,5);
	if ( ch->fighting != victim )
	    return;
    } else {
	lastfailed=1;
    }

    chance = (get_skill(ch,gsn_third_attack)*2)/3;

    if (IS_AFFECTED(ch,AFF_SLOW))
	chance /= 2;
    if (lastfailed)
    {
     chance /= 2;
     lastfailed=0;
    }
    
    if ( number_percent( ) < chance )
    {
	one_hit( ch, victim, dt, FALSE );
	check_improve(ch,gsn_third_attack,TRUE,6);
	if ( ch->fighting != victim )
	    return;
    } else {
	lastfailed=1;
    }

    chance = (get_skill(ch, gsn_fourth_attack)*2)/3;

    if (IS_AFFECTED(ch, AFF_SLOW))
	chance /= 3;

    if (lastfailed)
    {
       chance /= 2;
       lastfailed=0;
    }
    if (number_percent( ) < chance)
    {
	one_hit( ch, victim, dt, FALSE );
	check_improve(ch, gsn_fourth_attack, TRUE, 6);
	if (ch->fighting != victim)
	    return;
    } else {
	lastfailed=1;
    }

    chance = (get_skill(ch, gsn_fifth_attack)*2)/3;

    if (IS_AFFECTED(ch, AFF_SLOW))
	chance /= 4 ;
    
    if (lastfailed)
    {
      chance /= 2;
      lastfailed=0;
    }
    if (number_percent( ) < chance)
    {
	one_hit( ch, victim, dt, FALSE );
	check_improve(ch, gsn_fifth_attack, TRUE, 6);
	if (ch->fighting != victim)
	    return;
    } else {
       lastfailed=1;
    }
    
    chance = (get_skill(ch, gsn_sixth_attack)*2)/3;

    if (IS_AFFECTED(ch, AFF_SLOW))
       chance /= 5;

    if (lastfailed)
    {
     chance /= 2;
     lastfailed=0;
    }
    if(number_percent() < chance)
    {
     one_hit(ch, victim, dt, FALSE);
     check_improve(ch, gsn_sixth_attack, TRUE, 6);
     if(ch->fighting != victim)
      return;
    } else {
      lastfailed=1;
    }
   
    chance = (get_skill(ch, gsn_seventh_attack)*2)/3;
    
    if(IS_AFFECTED(ch, AFF_SLOW))
       chance/=6;
    
    if(lastfailed)
    {
     chance /= 2;
     lastfailed=0;
    }
    if(number_percent() < chance)
    {
     one_hit(ch, victim, dt, FALSE);
     check_improve(ch, gsn_seventh_attack, TRUE, 6);
     if(ch->fighting != victim)
      return;
    } else {
      lastfailed=1;
    }
    if(dt==gsn_ambush)
     return;
    check_leech(ch,victim);
    counter_attack(ch,victim);
    return;
 
}

/* procedure for all mobile attacks */
void mob_hit (CHAR_DATA *ch, CHAR_DATA *victim, int dt)
{
    int chance,number;
    int lastfailed=0;
    CHAR_DATA *vch, *vch_next;

    one_hit(ch,victim,dt, FALSE);

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

    if (ch->stunned)
	return;

    /* Area attack -- BALLS nasty! */
 
    if (IS_SET(ch->off_flags,OFF_AREA_ATTACK))
    {
	for (vch = ch->in_room->people; vch != NULL; vch = vch_next)
	{
	    vch_next = vch->next;
	    if ((vch != victim && vch->fighting == ch))
		one_hit(ch,vch,dt, FALSE);
	}
    }

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

    if (get_eq_char (ch, WEAR_SECONDARY) && (dt!=gsn_charge))
    {
	chance = (get_skill(ch,gsn_dual_wield)*2)/3;
        if(IS_AFFECTED(ch, AFF_SLOW)&& !IS_SET(ch->off_flags,OFF_FAST))
         chance/=2;
	if ( number_percent( ) < chance )
	{
	    one_hit( ch, victim, dt, TRUE );
	
	} else {
          lastfailed=1;
        }
        if((dt!=gsn_backstab)&&(dt!=gsn_circle)&&(dt!=gsn_assassinate)
          &&(dt!=gsn_strike))
        {
         if ( ch->fighting != victim )
             return;
         chance=(get_skill(ch,gsn_2nd_dual)*2)/3;
         if(IS_AFFECTED(ch, AFF_SLOW)&& !IS_SET(ch->off_flags,OFF_FAST))
          chance/=3;
         if(lastfailed)
         {
          chance/=2;
          lastfailed=0;
         }
         if(number_percent()<chance)
         {
          one_hit(ch, victim, dt, TRUE);
          if(ch->fighting!=victim)
           return;
         } else {
          lastfailed=1;
         }
        chance=(get_skill(ch,gsn_3rd_dual)*2)/3;
        if(IS_AFFECTED(ch,AFF_SLOW)&& !IS_SET(ch->off_flags,OFF_FAST))
         chance/=4;
        if(lastfailed)
        {
         chance/=2;
         lastfailed=0;
        }
        if(number_percent()<chance)
        {
         one_hit(ch, victim, dt, TRUE);
         if(ch->fighting!=victim)
          return;
        } else {
         lastfailed=1;
        }
        chance=(get_skill(ch,gsn_4th_dual)*2)/3;
        if(IS_AFFECTED(ch,AFF_SLOW)&& !IS_SET(ch->off_flags,OFF_FAST))
         chance/=5;
        if(lastfailed)
        {
         chance/=2;
         lastfailed=0;
        }
        if(number_percent()<chance)
        {
         one_hit(ch,victim,dt,TRUE);
         if(ch->fighting!=victim)
          return;
        } else {
         lastfailed=1;
        }
     }
    }

    if(dt==gsn_strike)
     return;

    if (IS_AFFECTED(ch,AFF_HASTE)
    ||  (IS_SET(ch->off_flags,OFF_FAST) && !IS_AFFECTED(ch,AFF_SLOW)))
	one_hit(ch,victim,dt, FALSE);

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

    if(dt==gsn_backstab || dt==gsn_circle || dt==gsn_assassinate)
    {
     chance=get_skill(ch,gsn_offhand);
     if(!chance) return;
     if(IS_AFFECTED(ch,AFF_SLOW)&& !IS_AFFECTED(ch,AFF_SLOW) )
      chance/=2;
     chance=(chance*3)/4 + (ch->level-victim->level);
     if(number_percent()<chance)
      one_hit(ch,victim,dt,FALSE);
     if((number_percent()<chance) && (ch->fighting==victim) &&
       get_eq_char(ch,WEAR_SECONDARY))
      one_hit(ch,victim,dt,TRUE);
     }

    if (ch->fighting != victim || dt == gsn_backstab || dt == gsn_circle || dt==gsn_assassinate)
	return;
    chance = (get_skill(ch,gsn_second_attack)*2)/3;

    if (IS_AFFECTED(ch,AFF_SLOW)&& !IS_AFFECTED(ch,AFF_SLOW))
	chance /= 2;

    if ( number_percent( ) < chance )
    {
	one_hit( ch, victim, dt, FALSE );
	if ( ch->fighting != victim )
	    return;
    } else {
	lastfailed=1;
    }

    chance = (get_skill(ch,gsn_third_attack)*2)/3;

    if (IS_AFFECTED(ch,AFF_SLOW)&& !IS_AFFECTED(ch,AFF_SLOW))
	chance /= 2;
    if (lastfailed)
    {
     chance /= 2;
     lastfailed=0;
    }

    if ( number_percent( ) < chance )
    {
	one_hit( ch, victim, dt, FALSE );
	if ( ch->fighting != victim )
	    return;
    } else {
	lastfailed=1;
    }

    chance = (get_skill(ch, gsn_fourth_attack)*2)/3;

    if (IS_AFFECTED(ch, AFF_SLOW)&& !IS_AFFECTED(ch,AFF_SLOW))
	chance /= 3;

    if (lastfailed)
    {
       chance /= 2;
       lastfailed=0;
    }
    if (number_percent( ) < chance)
    {
	one_hit( ch, victim, dt, FALSE );
	if (ch->fighting != victim)
	    return;
    } else {
	lastfailed=1;
    }

    chance = (get_skill(ch, gsn_fifth_attack)*2)/3;

    if (IS_AFFECTED(ch, AFF_SLOW)&& !IS_AFFECTED(ch,AFF_SLOW))
	chance /= 4 ;

    if (lastfailed)
    {
      chance /= 2;
      lastfailed=0;
    }
    if (number_percent( ) < chance)
    {
	one_hit( ch, victim, dt, FALSE );
	if (ch->fighting != victim)
	    return;
    } else {
       lastfailed=1;
    }

    chance = (get_skill(ch, gsn_sixth_attack)*2)/3;

    if (IS_AFFECTED(ch, AFF_SLOW)&& !IS_AFFECTED(ch,AFF_SLOW))
       chance /= 5;

    if (lastfailed)
    {
     chance /= 2;
     lastfailed=0;
    }
    if(number_percent() < chance)
    {
     one_hit(ch, victim, dt, FALSE);
     if(ch->fighting != victim)
      return;
    } else {
      lastfailed=1;
    }

    chance = (get_skill(ch, gsn_seventh_attack)*2)/3;

    if(IS_AFFECTED(ch, AFF_SLOW)&& !IS_AFFECTED(ch,AFF_SLOW))
       chance/=6;

    if(lastfailed)
    {
     chance /= 2;
     lastfailed=0;
    }
    if(number_percent() < chance)
    {
     one_hit(ch, victim, dt, FALSE);
     if(ch->fighting != victim)
      return;
    } else {
      lastfailed=1;
    }
    check_leech(ch,victim);
    counter_attack(ch,victim);
    /* oh boy!  Fun stuff! */

    if (ch->wait > 0)
	return;

    number = number_range(0,2);

    if (number == 1 && IS_SET(ch->act,ACT_MAGE))
    {
	/*  { mob_cast_mage(ch,victim); return; } */ ;
    }

    if (number == 2 && IS_SET(ch->act,ACT_CLERIC))
    {	
	/* { mob_cast_cleric(ch,victim); return; } */ ;
    }

    /* now for the skills */

    number = number_range(0,8);

    switch(number) 
    {
    case (0) :
	if (IS_SET(ch->off_flags,OFF_BASH))
	    do_bash(ch,"");
	break;

    case (1) :
	if (IS_SET(ch->off_flags,OFF_BERSERK) && !IS_AFFECTED(ch,AFF_BERSERK))
	    do_berserk(ch,"");
	break;


    case (2) :
	if (IS_SET(ch->off_flags,OFF_DISARM) 
	|| (get_weapon_sn(ch) != gsn_hand_to_hand 
	&& (IS_SET(ch->act,ACT_WARRIOR)
	||  IS_SET(ch->act,ACT_VAMPIRE)
   	||  IS_SET(ch->act,ACT_THIEF))))
	    do_disarm(ch,"");
	break;

    case (3) :
	if (IS_SET(ch->off_flags,OFF_KICK))
	    do_kick(ch,"");
	break;

    case (4) :
	if (IS_SET(ch->off_flags,OFF_KICK_DIRT))
	    do_dirt(ch,"");
	break;

    case (5) :
	if (IS_SET(ch->off_flags,OFF_CIRCLE))
           do_circle(ch,"");
        break; 

    case (6) :
	if (IS_SET(ch->off_flags,OFF_TRIP))
	    do_trip(ch,"");
	break;

    case (7) :
	if (IS_SET(ch->off_flags,OFF_FEED))
           do_feed(ch,"");
        break;
    case (8) :
	if (IS_SET(ch->off_flags,OFF_BACKSTAB))
	{
	    do_backstab(ch,"");
	}
    }
}
	

/*
 * Hit one guy once.
 */
void one_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt, bool secondary )
{
    OBJ_DATA *wield;
    int victim_ac;
    int thac0;
    int thac0_00;
    int thac0_32;
    int dam;
    int diceroll;
    int sn,skill;
    int dam_type;
    int result;

    sn = -1;


    /* just in case */
    if (victim == ch || ch == NULL || victim == NULL)
	return;

    /*
     * 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 secondary == true, use the second weapon.
     */
    if (!secondary)
        wield = get_eq_char( ch, WEAR_WIELD );
    else
        wield = get_eq_char( ch, WEAR_SECONDARY );
    if ( dt == TYPE_UNDEFINED )
    {
	dt = TYPE_HIT;
	if ( wield != NULL && wield->item_type == ITEM_WEAPON )
	    dt += wield->value[3];
        else if((ch->class == class_lookup("sensai")) ||
                 (ch->class == class_lookup("shaolin")))
        {
         int chance;
         int range=0;
         chance = get_skill(ch, gsn_tiger_style) * 3/4;
         if(chance < number_percent())
          dt = TYPE_HIT + 17; /* punch */
         else
         {
          range+=5;
          check_improve(ch, gsn_tiger_style, TRUE, 6);
          chance = get_skill(ch, gsn_dragon_style) *3/4;
          if(chance > number_percent())
          {
           range+=5;
           check_improve(ch, gsn_dragon_style, TRUE, 6);
           chance = get_skill(ch, gsn_chaos_style) *3/4;
           if(chance > number_percent())
           {
            range+=5;
            check_improve(ch, gsn_chaos_style, TRUE, 6);
            chance = get_skill(ch, gsn_elemental_style) *3/4;
            if(chance > number_percent())
            {
             range+=5;
             check_improve(ch, gsn_elemental_style, TRUE, 6);
            }
           }
          }
          dt = TYPE_HIT + 40 + number_range(1,range);
         }
        }
	else 
	    dt += ch->dam_type;
    }

    if (dt < TYPE_HIT)
    	if (wield != NULL)
    	    dam_type = attack_table[wield->value[3]].damage;
    	else
    	    dam_type = attack_table[ch->dam_type].damage;
    else
    	dam_type = attack_table[dt - TYPE_HIT].damage;

    if (dam_type == -1)
	dam_type = DAM_BASH;

    /* get the weapon skill */
    sn = get_weapon_sn(ch);
    skill = 20 + get_weapon_skill(ch,sn);

    /*
     * Calculate to-hit-armor-class-0 versus armor.
     */
    if ( IS_NPC(ch) )
    {
	thac0_00 = 20;
	thac0_32 = -4;   /* as good as a thief */ 
	if (IS_SET(ch->act,ACT_VAMPIRE))
	    thac0_32 = -30;
        else if (IS_SET(ch->act,ACT_DRUID))
            thac0_32 = 0;
        else if (IS_SET(ch->act,ACT_RANGER))
            thac0_32 = -4;
	else if (IS_SET(ch->act,ACT_WARRIOR))
	    thac0_32 = -10;
	else if (IS_SET(ch->act,ACT_THIEF))
	    thac0_32 = -4;
	else if (IS_SET(ch->act,ACT_CLERIC))
	    thac0_32 = 2;
	else if (IS_SET(ch->act,ACT_MAGE))
	    thac0_32 = 6;
    }
    else
    {
	thac0_00 = class_table[ch->class].thac0_00;
	thac0_32 = class_table[ch->class].thac0_32;
    }
    thac0  = interpolate( ch->level, thac0_00, thac0_32 );

    if (thac0 < 0)
        thac0 = thac0/2;

    if (thac0 < -5)
        thac0 = -5 + (thac0 + 5) / 2;

    thac0 -= GET_HITROLL(ch)/10 * skill/100;
    thac0 += 5 * (100 - skill) / 100;

    if (dt == gsn_backstab)
	thac0 -= 10 * (100 - get_skill(ch,gsn_backstab));

    if (dt == gsn_assassinate)
        thac0 -= 10 * (100 - get_skill(ch,gsn_assassinate));

    if (dt == gsn_circle)
	thac0 -= 10 * (100 - get_skill(ch,gsn_circle));

    if (dt == gsn_charge)
        thac0 -= 10 * (100 - get_skill(ch,gsn_charge));

    if (dt == gsn_strike)
        thac0 -= 10 * (100 - get_skill(ch,gsn_strike));

    if (dt == gsn_ambush)
        thac0 -= 10 * (100 - get_skill(ch,gsn_ambush));


    switch(dam_type)
    {
	case(DAM_PIERCE):victim_ac = GET_AC(victim,AC_PIERCE)/10;	break;
	case(DAM_BASH):	 victim_ac = GET_AC(victim,AC_BASH)/10;		break;
	case(DAM_SLASH): victim_ac = GET_AC(victim,AC_SLASH)/10;	break;
	default:	 victim_ac = GET_AC(victim,AC_EXOTIC)/10;	break;
    }; 
	
    if (victim_ac < -15)
	victim_ac = (victim_ac + 15) / 5 - 15;
     
    if ( !can_see( ch, victim ) )
	victim_ac -= 4;

    if ( victim->position < POS_FIGHTING)
	victim_ac += 4;
 
    if (victim->position < POS_RESTING)
	victim_ac += 6;

    /*
     * 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, dam_type, TRUE );
	tail_chain( );
	return;
    }

    /*
     * Hit.
     * Calc damage.
     */
    if ( IS_NPC(ch) && (!ch->pIndexData->new_format || wield == NULL))
	if (!ch->pIndexData->new_format)
	{
	    dam = number_range( ch->level / 2, ch->level * 3 / 2 );
	    if ( wield != NULL )
	    	dam += dam / 2;
	}
	else
	    dam = dice(ch->damage[DICE_NUMBER],ch->damage[DICE_TYPE]);
	
    else
    {
	if (sn != -1)
	    check_improve(ch,sn,TRUE,5);
	if ( wield != NULL )
	{
	    if (wield->clan)
	    {
		dam = dice(ch->level/3,3) * skill/100;
	    } else
	    {
		if (wield->pIndexData->new_format)
		    dam = dice(wield->value[1],wield->value[2]) * skill/100;
		else
	    	    dam = number_range( wield->value[1] * skill/100, 
				wield->value[2] * skill/100);
	    }

	    if (get_eq_char(ch,WEAR_SHIELD) == NULL)  /* no shield = more */
		dam = dam * 11/10;

	    /* sharpness! */
	    if (IS_WEAPON_STAT(wield,WEAPON_SHARP) || IS_WEAPON_STAT(wield,WEAPON_VORPAL))
	    {
		int percent;

		if ((percent = number_percent()) <= (skill / 8))
		    dam = /*2 **/ /*((dam*3)/2)*/ dam + (dam * 2 * percent / 100);
	    }
	}
	else
	    dam = number_range( 1 + 4 * skill/100, 2 * ch->level/3 * skill/100);
    }

    /*
     * Bonuses.
     */
    if ( get_skill(ch,gsn_enhanced_damage) > 0 )
    {
        diceroll = number_percent();
        if (diceroll <= get_skill(ch,gsn_enhanced_damage))
        {
            check_improve(ch,gsn_enhanced_damage,TRUE,6);
            dam += 2 * ( dam * diceroll/300);
        }
    }
    if ( !IS_AWAKE(victim) )
	dam *= 2;
     else if (victim->position < POS_FIGHTING)
	dam = dam * 3 / 2;

    if ( dt == gsn_backstab && wield != NULL) 
    	if ( wield->value[0] != 2 )
	    dam *=  (ch->level / 25); /* max * 4 */
	else 
	    dam *=  (ch->level / 20); /* max * 5 */

    if ( dt == gsn_circle && wield != NULL) 
    	if ( wield->value[0] != 2 )
	    dam *=  (ch->level / 33); /* max * 3 */
	else 
	    dam *=  (ch->level / 25); /* max * 4 */

    if ( dt == gsn_assassinate && wield != NULL)
       if ( wield->value[0] != 2 )
          dam *= (ch->level / 20); /* max * 5 */
       else
          dam *= (ch->level / 16); /* max * 6 */

    if( dt == gsn_charge && wield != NULL)
      dam*=2;
    if( dt == gsn_whirlwind && wield != NULL)
      dam*=3/2;

    if( dt == gsn_strike && wield != NULL)
      dam *= (ch->level / 33); /* max * 3 */

    if( dt == gsn_ambush && wield != NULL)
      dam *= 2 + (ch->level/50); /* max * 4 */

    dam += GET_DAMROLL(ch)/11 * UMIN(100,skill) /100;

    if ( dam <= 0 )
	dam = 1;

    result = damage( ch, victim, dam, dt, dam_type, TRUE );

    if(result && ((class_lookup("sensai")==ch->class)||
       (class_lookup("shaolin")==ch->class)) && !IS_NPC(ch) )
    {
     switch(ch->pcdata->stance)
     {
      case STANCE_NONE: break;
      case STANCE_FLAMING:
         if (ch->fighting == victim && !check_force(ch,victim))
         {
	    dam = number_range(1,ch->level / 4 + 1);
            xact_new("{BYou {rburn{B $N.{x",ch,NULL,victim,TO_CHAR,POS_RESTING, SUPPRESS_FLAGS);
            xact_new("{x$n {rburns{x $N.",ch,NULL,victim,TO_NOTVICT,POS_RESTING,SUPPRESS_FLAGS);
            xact_new("{c$n {rburns{c you.{x",ch,NULL,victim,TO_VICT,POS_RESTING,SUPPRESS_FLAGS);
	    fire_effect( (void *) victim,ch->level/2,dam,TARGET_CHAR);
	    damage(ch,victim,dam,0,DAM_FIRE,FALSE);
         }
         break;
       case STANCE_VAMPIRIC:
         if (ch->fighting == victim && !check_force(ch,victim))
	{
	    dam = number_range(1, ch->level / 5 + 1);
            xact_new("{BYou draw life from $N.{x",ch,NULL,victim,TO_CHAR,POS_RESTING, SUPPRESS_FLAGS);
            xact_new("{x$n draws life from $N.",ch,NULL,victim,TO_NOTVICT,POS_RESTING, SUPPRESS_FLAGS);
            xact_new("{cYou feel $n drawing your life away.{x",ch,NULL,victim,TO_VICT,POS_RESTING, SUPPRESS_FLAGS);
	    damage_old(ch,victim,dam,0,DAM_NEGATIVE,FALSE);
	    ch->alignment = UMAX(-1000,ch->alignment - 1);
	    if ( ch->pet != NULL )
		ch->pet->alignment = ch->alignment;
	    ch->hit += dam/2;
	}
        break;
       case STANCE_FROST:
           if (ch->fighting == victim && !check_force(ch,victim))
	{
	    dam = number_range(1,ch->level / 6 + 2);
            xact_new("{BYou {cfreeze{B $N.{x",ch,NULL,victim,TO_CHAR,POS_RESTING, SUPPRESS_FLAGS);
            xact_new("{x$n {cfreezes{x $N.",ch,NULL,victim,TO_NOTVICT,POS_RESTING, SUPPRESS_FLAGS);
            xact_new("{c$n {cfreezes{c you.{x",ch,NULL,victim,TO_VICT,POS_RESTING, SUPPRESS_FLAGS);
	    cold_effect(victim,ch->level/2,dam,TARGET_CHAR);
	    damage(ch,victim,dam,0,DAM_COLD,FALSE);
	}
        break;
       case STANCE_SHOCKING:
            if (ch->fighting == victim && !check_force(ch,victim))
	{
	    dam = number_range(1,ch->level/5 + 2);
            xact_new("{BYou {Yshock{B $N.{x",ch,NULL,victim,TO_CHAR,POS_RESTING, SUPPRESS_FLAGS);
            xact_new("{x$n {Yshocks{x $N.",ch,NULL,victim,TO_NOTVICT,POS_RESTING, SUPPRESS_FLAGS);
            xact_new("{c$n {Yshocks{c you.{x",ch,NULL,victim,TO_VICT,POS_RESTING, SUPPRESS_FLAGS);
	    shock_effect(victim,ch->level/2,dam,TARGET_CHAR);
	    damage(ch,victim,dam,0,DAM_LIGHTNING,FALSE);
	}
        break;
       case STANCE_POISON:
           if(ch->fighting == victim && !check_force(ch,victim))
           {
            poison_effect((void*)victim,ch->level/2,dam,TARGET_CHAR);
           }
            break;
       default: break;
      }/* switch ch->pcdata->stance */
     }

    /* but do we have a funky weapon? */
    if (result && wield != NULL)
    { 
	int dam=0;
        AFFECT_DATA *pAf,af;

        if (ch->fighting == victim && ((pAf=affect_find(wield->affected,
            gsn_blade_poison))!=NULL))
        {
         if(pAf->dealer==ch)
         {
          if(!is_affected(victim,gsn_blade_poison)
                && !saves_spell(pAf->level,victim,DAM_POISON))
          {
           af.where = TO_AFFECTS;
           af.type = gsn_blade_poison;
           af.level = pAf->level;
           af.location = APPLY_NONE;
           af.duration = 1001;
           af.modifier = 0;
           af.bitvector = 0;
           af.subtype = 0;
           switch(number_range(0,2))
           {
            case 0: af.duration=1004+pAf->level/33;
                    af.location = APPLY_HITROLL;
                    af.modifier = -pAf->level;
                    af.bitvector = AFF_BLIND;
                    act("{G$n{G is poisoned and stumbles around blindly.{x",
                      victim,NULL,NULL,TO_ROOM);
                    send_to_char("{GYou are poisoned and stumble around blindly.{x\n\r",victim);
                    break;
            case 1: af.duration=1010+pAf->level/20;
                    af.location = APPLY_DEX;
                    af.modifier = -4;
                    af.subtype = 1;
                    act("{G$n{G is poisoned and $s legs start to convulse.{x",
			victim,NULL,NULL,TO_ROOM);
                    send_to_char("{GYou are poisoned and your legs start to convulse.{x\n\r",
                        victim);
                    break;
            case 2: af.duration=1010;
                    victim->stunned=number_range(1,3);
                    act("{G$n{G is poisoned and slumps to the ground unconsciously.{x",
                       victim,NULL,NULL,TO_ROOM);
                    send_to_char("{GYou are poisoned and slump to the ground unconsciously.{x\n\r",victim);
                    break;
           }
           affect_to_char( victim, &af );
           if(number_range(0,1)==0)
           {
            affect_remove_obj(wield,pAf);
            act("The blade poison on $p vanishes.",ch,wield,NULL,TO_CHAR);
           }
          }
         }
        }
	if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_POISON)
           && !check_force(ch,victim))
	{
	    int level;
	    AFFECT_DATA *poison;

	    if ((poison = affect_find(wield->affected,gsn_poison)) == NULL)
		level = wield->level;
	    else
		level = poison->level;
	
	    /*if (!saves_spell(level / 2,victim,DAM_POISON))
	    {
		send_to_char("{cYou feel {ypoison{c coursing through your veins.\n\r{x",
		    victim);
		act("$n is {ypoisoned{x by the venom on $p.",
		    victim,wield,ch,TO_VICT);

    		af.where     = TO_AFFECTS;
    		af.type      = gsn_poison;
    		af.level     = level * 3/4;
    		af.duration  = level / 2;
    		af.location  = APPLY_STR;
    		af.modifier  = -1;
    		af.bitvector = AFF_POISON;
    		affect_join( victim, &af );
	    }*/

            poison_effect((void*)victim,level/2,dam,TARGET_CHAR);
	    /* weaken the poison if it's temporary */
	    if (poison != NULL)
	    {
	    	poison->level = UMAX(0,poison->level - 2);
	    	poison->duration = UMAX(0,poison->duration - 1);
	
	    	if (poison->level == 0 || poison->duration == 0)
		    act("The {ypoison{x on $p has worn off.",ch,wield,NULL,TO_CHAR);
	    }
 	}

        if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_ROTTING)
          && !check_force(ch,victim))
        {
          int level = wield->level;
          rotting_effect((void*)victim, level/2,dam,TARGET_CHAR);
        }

        if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_LIGHT)
          && !check_force(ch,victim))
        {
          int level = wield->level;
          light_effect((void*)victim, level/2, dam, TARGET_CHAR);
        }

        if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_DROWNING)
           && !check_force(ch,victim))
        {
          int level = wield->level;
          drowning_effect((void*)victim, level/2,dam,TARGET_CHAR);
        }

        if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_UNHOLY)
          && !check_force(ch,victim))
        {
          int level = wield->level;
          unholy_effect((void*)victim, level/2, dam, TARGET_CHAR);
        }

    	if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_VAMPIRIC)
          && !check_force(ch,victim))
	{
	    dam = number_range(1, wield->level / 5 + 1);
	    xact_new("{k$p draws life from $n.{x",victim,wield,ch,TO_VICT,POS_RESTING, SUPPRESS_FLAGS);
	    xact_new("{iYou feel $p drawing your life away.{x",
		victim,wield,NULL,TO_CHAR,POS_RESTING, SUPPRESS_FLAGS);
	    damage_old(ch,victim,dam,0,DAM_NEGATIVE,FALSE);
	    ch->alignment = UMAX(-1000,ch->alignment - 1);
	    if ( ch->pet != NULL )
		ch->pet->alignment = ch->alignment;
	    ch->hit += dam/2;
	}

	if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_FLAMING)
         && !check_force(ch,victim))
	{
	    dam = number_range(1,wield->level / 4 + 1);
	    xact_new("{k$n is {rburned{k by $p.{x",victim,wield,ch,TO_VICT,POS_RESTING, SUPPRESS_FLAGS);
	    xact_new("{i$p {rsears{i your flesh.{x",victim,wield,NULL,TO_CHAR,POS_RESTING, SUPPRESS_FLAGS);
	    fire_effect( (void *) victim,wield->level/2,dam,TARGET_CHAR);
	    damage(ch,victim,dam,0,DAM_FIRE,FALSE);
	}

	if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_FROST)
          && !check_force(ch,victim))
	{
	    dam = number_range(1,wield->level / 6 + 2);
	    xact_new("{k$p {cfreezes{k $n.{x",victim,wield,ch,TO_VICT,POS_RESTING, SUPPRESS_FLAGS);
	    xact_new("{iThe {Ccold{i touch of $p surrounds you with {Cice.{x",
		victim,wield,NULL,TO_CHAR,POS_RESTING, SUPPRESS_FLAGS);
	    cold_effect(victim,wield->level/2,dam,TARGET_CHAR);
	    damage(ch,victim,dam,0,DAM_COLD,FALSE);
	}

	if (ch->fighting == victim && IS_WEAPON_STAT(wield,WEAPON_SHOCKING)
           && !check_force(ch,victim))
	{
	    dam = number_range(1,wield->level/5 + 2);
	    xact_new("{k$n is struck by {Ylightning{k from $p.{x",victim,wield,ch,TO_VICT,POS_RESTING, SUPPRESS_FLAGS);
	    xact_new("{iYou are {Yshocked{i by $p.{x",victim,wield,NULL,TO_CHAR,POS_RESTING, SUPPRESS_FLAGS);
	    shock_effect(victim,wield->level/2,dam,TARGET_CHAR);
	    damage(ch,victim,dam,0,DAM_LIGHTNING,FALSE);
	}
    }

    tail_chain();
    return;
}

void process_shields(CHAR_DATA *ch, CHAR_DATA *victim)
{	
  int dam, dt;
  int count=0,total=0;

	    if (IS_SHIELDED(victim, SHD_ICE))
	    {
		if(ch->fighting!=victim)
                 return;
                if (!IS_SHIELDED(ch, SHD_ICE) && !check_force(victim,ch))
		{
		    dt = skill_lookup("iceshield");
		    dam = number_range(20, 40);
		    total+=xdamage(victim, ch, dam, dt, DAM_COLD, TRUE, SUPPRESS_SHIELD);
                    count++;
		}
	    }
	    if (IS_SHIELDED(victim, SHD_FIRE))
	    {
		if(ch->fighting!=victim)
                 return;
                if (!IS_SHIELDED(ch, SHD_FIRE) && !check_force(victim,ch))
		{
		    dt = skill_lookup("fireshield");
		    dam = number_range(20, 40);
		    total+=xdamage(victim, ch, dam, dt, DAM_FIRE, TRUE, SUPPRESS_SHIELD);
                    count++;
		}
	    }
	    if (IS_SHIELDED(victim, SHD_SHOCK))
	    {
                 if(ch->fighting!=victim)
                 return;
		if (!IS_SHIELDED(ch, SHD_SHOCK) && !check_force(victim,ch))
		{
		    dt = skill_lookup("shockshield");
		    dam = number_range(20, 40);
		    total+=xdamage(victim, ch, dam, dt, DAM_LIGHTNING, TRUE, SUPPRESS_SHIELD);
		    count++;	
		}
	    }
            if (IS_SHIELDED(victim, SHD_SHADOW))
	    {
                if(ch->fighting!=victim)
                 return;
		if (!IS_SHIELDED(ch, SHD_SHADOW) && !check_force(victim,ch))
		{
		    dt = skill_lookup("shadowshield");
		    dam = number_range(50, 100);
		    total+=xdamage(victim, ch, dam, dt, DAM_NEGATIVE, TRUE,SUPPRESS_SHIELD);
                    count++;
		}
	    }
            if (IS_SHIELDED(victim, SHD_BLADE))
	    {
                if(ch->fighting!=victim)
                 return;
		if (!IS_SHIELDED(ch, SHD_BLADE) && !check_force(victim,ch))
		{
		    dt = skill_lookup("bladebarrier");
		    dam = number_range(50, 100);
		    total+=xdamage(victim, ch, dam, dt, DAM_PIERCE, TRUE,SUPPRESS_SHIELD);
                    count++;
		}
	    }
            if (IS_SHIELDED(victim, SHD_PRISMATIC))
	    {
                if(ch->fighting!=victim)
                 return;
		if (!IS_SHIELDED(ch, SHD_PRISMATIC) && !check_force(victim,ch))
		{
		    dt = skill_lookup("prismaticshield");
		    dam = number_range(60, 120);
		    total+=xdamage(victim, ch, dam, dt, DAM_LIGHT, TRUE,SUPPRESS_SHIELD);
                    count++;
		}
	    }
            if (IS_SHIELDED(victim, SHD_ACID))
	    {
                if(ch->fighting!=victim)
                 return;
		if (!IS_SHIELDED(ch, SHD_ACID) && !check_force(victim,ch))
		{
		    dt = skill_lookup("acidshield");
		    dam = number_range(60, 120);
		    total+=xdamage(victim, ch, dam, dt, DAM_ACID, TRUE,SUPPRESS_SHIELD);
		    count++;	
		}
	    }
            if (IS_SHIELDED(victim, SHD_EARTH))
	    {
                if(ch->fighting!=victim)
                 return;
		if (!IS_SHIELDED(ch, SHD_EARTH) && !check_force(victim,ch))
		{
		    dt = skill_lookup("earthshield");
		    dam = number_range(40, 80);
		    total+=xdamage(victim, ch, dam, dt, DAM_EARTH, TRUE,SUPPRESS_SHIELD);
                    count++;
		}
	    }
       if(ch->fighting!=victim)
        return;
       if(count>1)
	dam_message(victim,ch,total,-1,FALSE,SUPPRESS_SHIELD_COMP,FALSE);
       else if (count==1)
        dam_message(victim,ch,total,-1,FALSE,SUPPRESS_SHIELD_COMP,TRUE);
       return;
}


/*
 * Inflict damage from a hit.
 */
int xdamage(CHAR_DATA *ch,CHAR_DATA *victim,int dam,int dt,int dam_type,
	    bool show,int suppress)
{

    OBJ_DATA *corpse;
    bool immune;
    int lootpoint=-1;
    AFFECT_DATA *pAf=NULL;

    if ( victim->position == POS_DEAD )
	return 0;

    if ( victim != ch )
    {
	/*
	 * Certain attacks are forbidden.
	 * Most other attacks are returned.
	 */
	if ( is_safe( ch, victim ) )
	    return 0;

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

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

	}

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

    /*
     * Inviso attacks ... not.
     */
    if ( IS_SHIELDED(ch, SHD_INVISIBLE) )
    {
	affect_strip( ch, gsn_invis );
	affect_strip( ch, gsn_mass_invis );
	REMOVE_BIT( ch->shielded_by, SHD_INVISIBLE );
	act( "$n fades into existence.", ch, NULL, NULL, TO_ROOM );
    }
    if ( IS_SHIELDED(ch, SHD_SWALK))
    {
	affect_strip( ch, gsn_shadow_walk); 
        REMOVE_BIT(ch->shielded_by, SHD_SWALK);
        send_to_char("You step from the shadows.\n\r",ch);
        act("$n steps from the shadows.",ch,NULL,NULL,TO_ROOM);
    }
    if ( is_affected(ch, gsn_ambush))
    {
	affect_strip( ch, gsn_ambush );
        send_to_char("You step from your hiding place.\n\r",ch);
        act("$n steps from $s hiding place.",ch,NULL,NULL,TO_ROOM);
    }
    /* strip sever if victim is attacked by someone else than
       the person who severed him/her */
    if( is_affected(victim,gsn_sever) &&
       (affect_find(victim->affected,gsn_sever)->dealer!=ch)
       && (dt!=gsn_poison) && (dt!=gsn_plague)
       && (!IS_NPC(ch)))
    {
	affect_strip(victim,gsn_sever);
        if(skill_table[gsn_sever].msg_off)
        {
	 send_to_char(skill_table[gsn_sever].msg_off,victim);
         send_to_char("\n\r",victim);
        }
        act("{G$n{G is no longer severed.{x",victim,NULL,NULL,TO_ROOM);
    }
         
    /*
     * Damage modifiers.
     */

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

    if ( dam > 1 && IS_SHIELDED(victim, SHD_SANCTUARY) )
	dam /= 2;

    if ( dam > 1 && ((IS_SHIELDED(victim, SHD_PROTECT_EVIL) && IS_EVIL(ch) )
    ||		     (IS_SHIELDED(victim, SHD_PROTECT_GOOD) && IS_GOOD(ch) )))
	dam -= dam / 4;

    if ( dam > 1 && is_affected(victim, gsn_assassinate)
       && (affect_find(victim->affected,gsn_assassinate)->dealer == ch))
      dam += dam / 6;

    if ( (dam > 1) && (dt>0) && (dt < TYPE_HIT) &&
       (skill_table[dt].spell_fun!=spell_null))
    {
     if(is_affected(victim,gsn_resistance)
      && (number_percent() < (50-(ch->level/5)+(victim->level/10))))
       dam= dam/5;
    }

    immune = FALSE;


    /*
     * Check for parry, and dodge.
     */
    if ( dt >= TYPE_HIT && ch != victim)
    {
        if ( check_parry( ch, victim ) )
	    return 0;
	if ( check_dodge( ch, victim ) )
	    return 0;
	if ( check_shield_block(ch,victim))
	    return 0;
        if ( check_phase(ch,victim))
            return 0;
        if ( check_armor(ch,victim,dam))
            return 0;
        if ( check_shield(ch, victim, dam))
            return 0;
        if ( check_stone_skin(ch, victim, dam))
            return 0;
    }
    
    if((dt >= TYPE_HIT) && show && dam>0)
    { 
     if(check_critical_hit(ch,victim))
     {
      dam += dam * ((number_percent()/2+get_skill(ch,gsn_critical_hit))/2) / 50;
     }
    }
    if((dt==gsn_circle||dt==gsn_backstab||dt==gsn_assassinate||dt==gsn_strike)
        && show && dam>0)
    {
      if(check_critical_hit(ch,victim))
      {
	/*dam += dam * number_range(0,get_skill(ch,gsn_critical_hit)/2)/100;*/
        dam += dam * ((number_percent()/2+get_skill(ch,gsn_critical_hit))/2) / 100;
      }
    }
    if((ch->class == class_lookup("sensai")) ||
      (ch->class == class_lookup("shaolin")) && ((dt>=(TYPE_HIT+40) ||
           (dt==(TYPE_HIT+17)))))
     dam = monk_style(ch,victim,dt,dam);   
    switch(check_immune(victim,dam_type,dt))
    {
	case(IS_IMMUNE):
	    immune = TRUE;
	    dam = 0;
	    break;
	case(IS_RESISTANT):	
	    dam -= dam/3;
	    break;
	case(IS_VULNERABLE):
	    dam += dam/2;
	    break;
    }
    /* damage reduction */
    if(dam>=1500)
     dam=(dam*5)/6;
    else if(dam>=1000)
     dam=(dam*6)/7;
    else if(dam>=750)
     dam=(dam*7)/8;
    else if(dam>=500)
     dam=(dam*8)/9;
    else if(dam<=100)
     dam=(dam*11)/9;
    
   if(((pAf=affect_find(victim->affected,skill_lookup("ward")))!=NULL) 
       && show && (dam>=pAf->subtype))
   {
    char buf[MAX_STRING_LENGTH];
    sprintf(buf,"{GYour ward absorbs the damage and vanishes in a bright flash! {D({WAbsorb{D:{W%d{D){x\n\r",dam);
    affect_strip(victim,skill_lookup("ward"));
    send_to_char(buf,victim);
    sprintf(buf,"{G$n{G's ward absorbs the damage and vanishes in a bright flash! {D({WAbsorb{D:{W%d{D){x",dam);
    act(buf, victim, NULL, NULL, TO_ROOM);
    return 0;
   }
   
    if(IS_SHIELDED(victim, SHD_MANA) && show && (dt>=TYPE_HIT) && (dam>0))
    {
     int chance=33-dam/10+(victim->level-ch->level);
     if(number_percent()<chance)
     {
      char buf[MAX_STRING_LENGTH];
      int absorb=(dam/10)*number_range(1,4);
      if((victim->mana-absorb>=0) && (absorb>0))
      {
       sprintf(buf,"Your mana shield absorbs some of the damage! {D({WAbsorb{D:{W%d{D){x\n\r",absorb);
       send_to_char(buf,victim);
       sprintf(buf,"$n's mana shield absorbs some of the damage! {D({WAbsorb{D:{W%d{D){x",absorb);
       act(buf,victim,NULL,NULL,TO_ROOM);
       dam-=absorb;
       victim->mana-=absorb;
      }
     }
    }

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

    if (dam == 0)
	return 0;

    /*
     * Hurt the victim.
     * Inform the victim of his new state.
     */
    victim->hit -= dam;
    if ( !IS_NPC(victim)
    &&   victim->level >= LEVEL_IMMORTAL
    &&   victim->hit < 1 )
	victim->hit = 1;
    update_pos( victim );
    if (dt == gsn_feed)
    {
	ch->hit = UMIN(ch->hit+((dam/3)*2), ch->max_hit);
	update_pos( ch );
    }

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

    case POS_INCAP:
	act( "{c$n is incapacitated and will slowly die, if not aided.{x",
	    victim, NULL, NULL, TO_ROOM );
	send_to_char(
	    "{cYou are incapacitated and will slowly {z{Rdie{x{c, if not aided.{x\n\r",
	    victim );
	break;

    case POS_STUNNED:
	act( "{c$n is stunned, but will probably recover.{x",
	    victim, NULL, NULL, TO_ROOM );
	send_to_char("{cYou are stunned, but will probably recover.{x\n\r",
	    victim );
	break;

    case POS_DEAD:
        if ((IS_NPC(victim)) && ( victim->die_descr[0] != '\0'))
	{
	    act( "{c$n $T{x", victim, 0, victim->die_descr, TO_ROOM );
	}
	else
	{
	    if (IS_SET(ch->in_room->room_flags,ROOM_ARENA)
            && IS_SET(victim->in_room->room_flags,ROOM_ARENA))
           {
              check_arena(ch,victim);
              return dam;
           }
           if (global_quest==QUEST_CLOSED && ch->on_quest &&
                victim->on_quest && IS_SET(quest_flags,QUEST_COMBAT))
           {
		check_quest(ch,victim);
                return dam;
           }
            act( "{c$n is {CDEAD!!{x", victim, 0, 0, TO_ROOM );
	}
	send_to_char( "{cYou have been {RKILLED!!{x\n\r\n\r", victim );
	break;

    default:
	if ( dam > victim->max_hit / 4 )
	    send_to_char( "{cThat really did {RHURT!{x\n\r", victim );
	if ( victim->hit < victim->max_hit / 4 )
	    send_to_char( "{cYou sure are {z{RBLEEDING!{x\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 )
    {
        int pkpgain=0,killers=0;
	group_gain( ch, victim );

	if ( !IS_NPC(victim))
	{
            DESCRIPTOR_DATA *d;
            BUFFER *output;
            char buf[MAX_STRING_LENGTH];
            CHAR_DATA *wch,*wch_next;
                
	    lootpoint=MAX_LOOT;
            output=new_buf();
            sprintf( log_buf, "%s killed by %s at %d",
		victim->name,
		(IS_NPC(ch) ? ch->short_descr : ch->name),
		ch->in_room->vnum );
	    log_string( log_buf );
            victim->pcdata->pkflag=0;
            /* award pkps */
            if(!IS_NPC(ch) && (victim!=ch))
            {
             OBJ_DATA *obj;
 
             if(ch->level>victim->level)
              pkpgain = victim->pcdata->pkp/5;
             else if(ch->level<victim->level)
              pkpgain = victim->pcdata->pkp/3;
             else if(ch->level==victim->level)
              pkpgain = victim->pcdata->pkp/4;

             ch->pcdata->pkp+=pkpgain;
             victim->pcdata->pkp-=pkpgain;
             ch->pcdata->kills[game_state]++;
             victim->pcdata->deaths[game_state]++;
             sprintf(buf,"{WYou have gained {R%d{x {RP{rK{W points!{x\n\r",pkpgain);
             send_to_char(buf,ch);
             obj = create_object(get_obj_index(20250),0);
             sprintf(buf,"A shrunken head of %s, harvested by %s",victim->name,ch->name);
             obj->short_descr=str_dup(buf);
             obj->description=str_dup(buf);
             sprintf(buf,"shrunken head %s",victim->name);
             obj->name=str_dup(buf);
             obj_to_char(obj,ch);
             if(victim->pcdata->bounty>0)
             {
              ch->platinum+=victim->pcdata->bounty;
              sprintf(buf,"{WYou receive {R%d{W platinum as a {Rb{rount{Ry{W!{x\n\r",victim->pcdata->bounty);
	      send_to_char(buf,ch); 
              victim->pcdata->bounty=0;
             } 
             affect_strip(ch,gsn_gouge); 
             ch->pcdata->pkflag=0;
            }
            sprintf( buf, "{D[{RD{reat{Rh{D]{W %s{W has just been killed by %s{W!{x\n\r",
              victim->name,(IS_NPC(ch) ? ch->short_descr : ch->name));
            add_buf(output,buf);
            killers++;
            if(!IS_NPC(ch))
              for(wch=char_list; wch!=NULL; wch=wch_next)
              {
               wch_next = wch->next;
               if(wch->fighting==victim && (!IS_NPC(wch)) && (wch!=ch))
               {
                sprintf(buf,"{D[{RD{reat{Rh{D]{W %s{W has just been killed by %s{W!{x\n\r", victim->name, wch->name);
                add_buf(output,buf);
                killers++;
                lootpoint--;
                wch->pcdata->pkflag=0;
               }
              }
            if(lootpoint<0)
             lootpoint=0;
            /* no looting during paradox */
            if(game_state == GS_PARADOX)
             lootpoint=0;
            for(d=descriptor_list; d; d=d->next)
            {
             if(d->connected==CON_PLAYING)
             {
              page_to_char(buf_string(output),d->character);
             }
            }
            free_buf(output); 
	    /*
	     * Dying penalty:
	     * 2/3 way back to previous level.
	     */
/*	    if ( victim->exp > exp_per_level(victim,victim->pcdata->points) 
			       * victim->level )
	gain_exp( victim, (5 * (exp_per_level(victim,victim->pcdata->points)
			         * victim->level - victim->exp)/6) + 50 );*/

	}
        sprintf( log_buf, "%s got toasted by %s at %s [room %d]",
            (IS_NPC(victim) ? victim->short_descr : victim->name),
            (IS_NPC(ch) ? ch->short_descr : ch->name),
            ch->in_room->name, ch->in_room->vnum);
 
        if (IS_NPC(victim))
            wiznet(log_buf,NULL,NULL,WIZ_MOBDEATHS,0,0);
        else
            wiznet(log_buf,NULL,NULL,WIZ_DEATHS,0,0);

     	/*
	 * Death trigger
	 */
	if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_DEATH) )
	{
	    victim->position = POS_STANDING;
	    mp_percent_trigger( victim, ch, NULL, NULL, TRIG_DEATH );
	}
        
        if(IS_NPC(victim) || IS_NPC(ch) 
          || (!IS_NPC(victim)&&!IS_NPC(ch)&&(victim==ch)))
	 raw_kill( victim, ch, -1 );
        else
        {
         raw_kill( victim, ch, lootpoint );
         register_pk(ch->name,victim->name,game_state,pkpgain,killers);
         if(!IS_IMMORTAL(victim))
          register_rank(victim->name,victim->pcdata->pkp,victim->race,victim->class,victim->clan);
         if(!IS_IMMORTAL(ch))
          register_rank(ch->name,ch->pcdata->pkp,ch->race,
			ch->class,ch->clan);
	 save_pkills();
        }
        /* dump the flags */
        if (ch != victim && !IS_NPC(ch) && (!is_same_clan(ch,victim)
	|| clan_table[victim->clan].independent))
        {
            if (IS_SET(victim->act,PLR_TWIT))
                REMOVE_BIT(victim->act,PLR_TWIT);
        }
        if(!IS_NPC(victim))
          set_killed_flag(victim); 

        /* RT new auto commands */

	if ( !IS_NPC(ch) && IS_NPC(victim) )
	{
	    OBJ_DATA *coins;

	    corpse = get_obj_list( ch, "corpse", ch->in_room->contents ); 

	    if ( IS_SET(ch->act, PLR_AUTOLOOT) &&
		 corpse && corpse->contains) /* exists and not empty */
		do_get( ch, "all corpse" );

 	    if (IS_SET(ch->act,PLR_AUTOGOLD) &&
	        corpse && corpse->contains  && /* exists and not empty */
		!IS_SET(ch->act,PLR_AUTOLOOT))
		if ((coins = get_obj_list(ch,"gcash",corpse->contains))
		     != NULL)
	      	    do_get(ch, "all.gcash corpse");
            
	    if ( IS_SET(ch->act, PLR_AUTOSAC) )
       	      if ( IS_SET(ch->act,PLR_AUTOLOOT) && corpse && corpse->contains)
		return dam;  /* leave if corpse has treasure */
	      else
		do_sacrifice( ch, "corpse" );
	}

	return dam;
    }

    if ( victim == ch )
	return dam;

    /*
     * Take care of link dead people.
     */
    if ( !IS_NPC(victim) && victim->desc == NULL )
    {
	if ( number_range( 0, victim->wait ) == 0 )
	{
	    do_recall( victim, "" );
	    return dam;
	}
    }

    /*
     * Wimp out?
     */
    if ( IS_NPC(victim) && dam > 0 && victim->wait < PULSE_VIOLENCE / 2)
    {
	if ( ( IS_SET(victim->act, ACT_WIMPY) && number_bits( 2 ) == 0
	&&   victim->hit < victim->max_hit / 5) 
	||   ( IS_AFFECTED(victim, AFF_CHARM) && victim->master != NULL
	&&     victim->master->in_room != victim->in_room ) )
	    do_flee( victim, "" );
    }

    if ( !IS_NPC(victim)
    &&   victim->hit > 0
    &&   victim->hit <= victim->wimpy
    &&   victim->wait < PULSE_VIOLENCE / 2 )
	do_flee( victim, "" );

    tail_chain( );
    return dam;
}

int monk_style(CHAR_DATA *ch, CHAR_DATA *victim, int dt, int dam)
{
 int newdam=dam;
 int through=0;

 if(!IS_SHIELDED(victim, SHD_SANCTUARY))
  newdam/=2;
 if(dt == (TYPE_HIT + 17))
   newdam+=(newdam*2)+number_range(0,newdam);
 else if(dt >= (TYPE_HIT + 40) && (dt <= (TYPE_HIT + 45)))
         
 {
  newdam+=(newdam*2)+number_range(0,newdam);
  if(dt == (TYPE_HIT + 44))
  {
   act("{xYou deliver a powerful palm strike to $N's chin.{x",ch,NULL,
      victim, TO_CHAR);
   act("{x$n delivers a powerful palm strike to your chin.{x",ch,NULL,
      victim, TO_VICT);
   act("{x$n delivers a powerful palm strike to $N's chin.{x",ch,NULL,
     victim, TO_NOTVICT);
  }
  if(number_percent()<=10)
   through=1;
 }
 else if((dt >= (TYPE_HIT + 46)) && (dt <= (TYPE_HIT + 50)))
 {
  newdam+=(newdam*3)+number_range(0,newdam);
  if(dt == (TYPE_HIT + 47))
  {
   act("{xYou unleash the power of a dragon!{x",ch,NULL,victim, TO_CHAR);
   act("{x$n unleashes the power of a dragon!{x",ch,NULL,victim, TO_ROOM);
  }
  if(number_percent()<=25)
   through=1;
 }
 else if((dt >= (TYPE_HIT + 51)) && (dt <= (TYPE_HIT + 55)))
 {
  newdam+=(newdam*3)+number_range(0,newdam);
  if(dt == (TYPE_HIT + 51))
  {
   act("{xYou spin around like a whirlwind.{x",ch,NULL,victim,TO_CHAR);
   act("{x$n spins around like a whirlwind.{x",ch,NULL,victim,TO_ROOM);
  }
  if(number_percent()<=40)
   through=1;
 }
 else if((dt >= (TYPE_HIT + 56)) && (dt <= (TYPE_HIT + 60)))
 {
  newdam+=(newdam*3)+number_range(0,newdam*2);
  switch(dt-TYPE_HIT)
  {
   case 56: act("{xYou reach out with your mental powers and strike $N.{x",
             ch,NULL,victim,TO_CHAR);
            act("{x$n reaches out with $s mental powers and strikes you.{x",
             ch,NULL,victim,TO_VICT);
            act("{x$n reaches out with $s mental powers and strikes $N.{x",
              ch,NULL,victim,TO_NOTVICT);
            break;
   case 58: act("{xYou hit $N with lightning speed!{x",ch,NULL,victim,TO_CHAR);
            act("{x$n hits you with lightning speed!{x",ch,NULL,victim,TO_VICT);
            act("{x$n hits $N with lightning speed!{x",ch,NULL,victim,TO_NOTVICT);
            break;
   case 60: act("{xFlames appear from nowhere and burn $N.{x",ch,NULL,victim,
             TO_CHAR);
            act("{xFlames appear from nowhere and burn you.{x",ch,NULL,victim,
             TO_VICT);
            act("{xFlames appear from nowhere and burn $N.{x",ch,NULL,victim,
             TO_NOTVICT);
            break;
  }
  if(number_percent()<=45)
   through=1;
 }
 if(through && IS_SHIELDED(victim, SHD_SANCTUARY))
 {
  newdam*=2;
  act("{xYou {Wpunch{x through $N's sanctuary!{x",ch,NULL,victim,TO_CHAR);
  act("{x$n {Wpunches{x through your sanctuary!{x",ch,NULL,victim,TO_VICT);
  act("{x$n {Wpunches{x through $N's sanctuary!{x",ch,NULL,victim,TO_NOTVICT);
 }
 if(!IS_SHIELDED(victim, SHD_SANCTUARY)) 
  newdam*=2;
 if(newdam<=50)
  newdam=(newdam*5)/3;
 else if(newdam<=100)
  newdam=(newdam*4)/3;
 else if(newdam>=750)
  newdam=(newdam*11)/16;
 else if(newdam>=500)
  newdam=(newdam*3)/4;
 else if(newdam>=300)
  newdam=(newdam*4)/5;
 else if(newdam>=200)
  newdam=(newdam*5)/6; 
 return newdam;       
}

int damage(CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, int dam_type,bool show)
{
 return xdamage(ch,victim,dam,dt,dam_type,show,SUPPRESS_STD);
}

int damage_old(CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, int dam_type,bool show)
{
  return xdamage(ch,victim,dam,dt,dam_type,show,SUPPRESS_STD);
}

bool in_range(CHAR_DATA *ch, CHAR_DATA *victim)
{
 if(ch==victim)
  return TRUE;
 
 if(IS_NPC(ch) || IS_NPC(victim))
  return TRUE;

 if((ch->level<=20) || (victim->level<=20))
  return FALSE;
 
 if((ch->level+10)<victim->level)
  return FALSE;
 
 if((ch->level-10)>victim->level)
  return FALSE;
 
 if(is_same_clan(ch,victim))
  return FALSE;
 
 
 return TRUE;
}

bool is_safe(CHAR_DATA *ch, CHAR_DATA *victim)
{
    if (victim->in_room == NULL || ch->in_room == NULL)
	return TRUE;

    if (victim->fighting == ch || victim == ch /*||
        ch->fighting==victim*/)

	return FALSE;

/*    if (!IS_NPC(ch) && IS_IMMORTAL(ch))
	return FALSE;*/
    
    /* killing mobiles */
    if (IS_NPC(victim))
    {

	/* safe room? */
	if (IS_SET(victim->in_room->room_flags,ROOM_SAFE))

	{
	    send_to_char("Not in this room.\n\r",ch);
	    return TRUE;
	}

	if (victim->pIndexData->pShop != NULL)
	{
	    send_to_char("The shopkeeper wouldn't like that.\n\r",ch);
	    return TRUE;
	}
        
        if (victim->spec_fun == spec_lookup("spec_questmaster"))
        {
            send_to_char("The questmaster wouldn't like that.\n\r",ch);
            return TRUE;
        }
	/* no killing healers, trainers, etc */
	if (IS_SET(victim->act,ACT_TRAIN)
	||  IS_SET(victim->act,ACT_PRACTICE)
	||  IS_SET(victim->act,ACT_IS_HEALER)
	||  IS_SET(victim->act,ACT_IS_CHANGER)
	||  IS_SET(victim->act,ACT_IS_SATAN)
	||  IS_SET(victim->act,ACT_IS_PRIEST))
	{
	    act("I don't think $G would approve.",ch,NULL,NULL,TO_CHAR);
	    return TRUE;
	}

	if (!IS_NPC(ch))
	{
	    /* no pets */
	    if (IS_SET(victim->act,ACT_PET))
	    {
		act("But $N looks so cute and cuddly...",
		    ch,NULL,victim,TO_CHAR);
		return TRUE;
	    }

	    /* no charmed creatures unless owner */
	    if (IS_AFFECTED(victim,AFF_CHARM) && ch != victim->master)
	    {
		send_to_char("You don't own that monster.\n\r",ch);
		return TRUE;
	    }
	}
    }
    /* killing players */
    else
    {
	/* NPC doing the killing */
	if (IS_NPC(ch))
	{
	    /* safe room check */
	    if (IS_SET(victim->in_room->room_flags,ROOM_SAFE))
	    {
		send_to_char("Not in this room.\n\r",ch);
		return TRUE;
	    }

	    /* charmed mobs and pets cannot attack players while owned */
	    if (IS_AFFECTED(ch,AFF_CHARM) && ch->master != NULL
	    &&  ch->master->fighting != victim)
	    {
		send_to_char("Players are your friends!\n\r",ch);
		return TRUE;
	    }

            if(has_killed_flag(victim))
            {
             send_to_char("But they have just been killed!\n\r",ch);
             return TRUE;
            }
/*            if(victim->level>101)
            {
             send_to_char("You can't kill immortals out of avatar mode.\n\r",ch);
             return TRUE;
            }*/
	}
	/* player doing the killing */
	else
	{
            DESCRIPTOR_DATA *d;
            int ccount=0,vcount=0;
	    if (IS_SET(victim->act,PLR_TWIT) )
		return FALSE;
            
            if(IS_SET(victim->in_room->room_flags,ROOM_ARENA))
             return FALSE;

            if(is_voodood(ch,victim))
		return FALSE;

            if(global_quest==QUEST_CLOSED && victim->on_quest &&
                ch->on_quest && IS_SET(quest_flags,QUEST_COMBAT)
               && victim->in_room->vnum!=516)
              return FALSE;

            if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)
              && (game_state!=GS_PARADOX))
            {
                send_to_char("Not in this room.\n\r",ch);
                return TRUE;
            }
	    if (ch->on_quest)
	    {
		send_to_char("Not while you are on a quest.\n\r",ch);
		return TRUE;
	    }
	    if (victim->on_quest)
	    {
		send_to_char("They are on a quest, leave them alone.\n\r",ch);
		return TRUE;
	    }

            if (is_same_clan(ch,victim) )
	    {
		send_to_char("You can't fight your own clan members.\n\r",ch);
		return TRUE;
	    }

            if(!in_range(ch,victim))
            {
              send_to_char("They are not in your range.\n\r",ch);
              return TRUE;
            }

/*            if (victim->fighting != NULL && !IS_NPC(victim->fighting))
            {
               send_to_char("Kill stealing is not permitted.\n\r",ch);
               return TRUE;
            }*/

            if(has_killed_flag(victim))
            {
              send_to_char("But they have just been killed!\n\r",ch);
              return TRUE;
            } 
/*            if(victim->level>101)
            {
              send_to_char("You can't kill immortals out of avatar mode.\n\r",ch);
	      return TRUE;
            }*/
            for(d=descriptor_list;d!=NULL;d=d->next)
            {
             if((d->connected==CON_PLAYING)
                && (d->character != ch)
                && (d->character->fighting!=NULL)
                && (d->character->fighting==victim)
                && (d->character->in_room==victim->in_room))
                   vcount++;

             if((d->connected==CON_PLAYING)
                && (d->character != victim)
                && (d->character->fighting!=NULL)
                && (d->character->fighting==ch)
                && (d->character->in_room==ch->in_room))
                   ccount++;
            }
            switch(game_state)
            {
             default:
             case GS_CHAOS:
             case GS_PARADOX: return FALSE;
             case GS_SOLO: if(vcount>=1)
                           {
                            send_to_char("They are already fighting another player.\n\r",ch);
                            return TRUE;
                           }
                           if(ccount>=1)
                           {
                            send_to_char("You are already fighting another player.\n\r",ch);
                            return TRUE;
                           }
                           return FALSE;
             case GS_1VS2: if(vcount>=2)
                           {
                            send_to_char("They are already fighting two other players.\n\r",ch);
                            return TRUE;
                           }
                           if(ccount>=2)
                           {
                            send_to_char("You are already fighting two other players.\n\r",ch);
                            return TRUE;
                           }
                           return FALSE;
            }


	}
    }
    return FALSE;
}


bool is_voodood(CHAR_DATA *ch, CHAR_DATA *victim)
{
    OBJ_DATA *object;
    bool found;

    if ( ch->level > HERO )
	return FALSE;

    found = FALSE;
    for ( object = victim->carrying; object != NULL; object = object->next_content )
    {
	if (object->pIndexData->vnum == OBJ_VNUM_VOODOO)
	{
	    char arg[MAX_INPUT_LENGTH];

	    one_argument(object->name, arg);
	    if (!str_cmp(arg, ch->name))
	    {
		return TRUE;
	    }
	}
    }
    return FALSE;
}

bool is_safe_spell(CHAR_DATA *ch, CHAR_DATA *victim, bool area )
{
    if (victim->in_room == NULL || ch->in_room == NULL)
        return TRUE;

    if (victim == ch && area)
	return TRUE;

    if (victim->fighting == ch || victim == ch)
	return FALSE;

/*    if (!IS_NPC(ch) && IS_IMMORTAL(ch))
	return FALSE;*/

    /* killing mobiles */
    if (IS_NPC(victim))
    {
	/* safe room? */
	if (IS_SET(victim->in_room->room_flags,ROOM_SAFE))
	    return TRUE;

	if (victim->pIndexData->pShop != NULL)
	    return TRUE;

        if (victim->spec_fun == spec_lookup("spec_questmaster"))
            return TRUE;

	/* no killing healers, trainers, etc */
	if (IS_SET(victim->act,ACT_TRAIN)
	||  IS_SET(victim->act,ACT_PRACTICE)
	||  IS_SET(victim->act,ACT_IS_HEALER)
	||  IS_SET(victim->act,ACT_IS_CHANGER)
	||  IS_SET(victim->act,ACT_IS_SATAN)
	||  IS_SET(victim->act,ACT_IS_PRIEST))
	    return TRUE;

	if (!IS_NPC(ch))
	{
	    /* no pets */
	    if (IS_SET(victim->act,ACT_PET))
	   	return TRUE;

	    /* no charmed creatures unless owner */
	    if (IS_AFFECTED(victim,AFF_CHARM) && (area || ch != victim->master))
		return TRUE;

	    /* legal kill? -- cannot hit mob fighting non-group member */
/*	    if (victim->fighting != NULL && !is_same_group(ch,victim->fighting))
		return TRUE;*/
	}
	else
	{
	    /* area effect spells do not hit other mobs */
	    if (area && !is_same_group(victim,ch->fighting))
		return TRUE;
	}
    }
    /* killing players */
    else
    {
	if (area && IS_IMMORTAL(victim) && victim->level >= LEVEL_IMMORTAL)
	    return TRUE;

	/* NPC doing the killing */
	if (IS_NPC(ch))
	{
	    /* charmed mobs and pets cannot attack players while owned */
	    if (((IS_AFFECTED(ch,AFF_CHARM)) & (ch->master != NULL))
	    &&  (ch->master->fighting != victim))
		return TRUE;
	
	    /* safe room? */
	    if (IS_SET(victim->in_room->room_flags,ROOM_SAFE))
		return TRUE;

	    /* legal kill? -- mobs only hit players grouped with opponent*/
	    if (ch->fighting != NULL && !is_same_group(ch->fighting,victim))
		return TRUE;

            if(has_killed_flag(victim))
                return TRUE;
/*            if(victim->level>101)
                return TRUE;*/

	}

	/* player doing the killing */
	else
	{
	    DESCRIPTOR_DATA *d;
	    int ccount=0,vcount=0;
            if (IS_SET(victim->act,PLR_TWIT) )
		return FALSE;
           
            if (IS_SET(victim->in_room->room_flags,ROOM_ARENA))
               return FALSE;

            if(is_voodood(ch,victim))
		return FALSE;

            if(global_quest==QUEST_CLOSED && victim->on_quest &&
              ch->on_quest && IS_SET(quest_flags,QUEST_COMBAT)
              && victim->in_room->vnum!=516)
              return FALSE;

            if(is_same_group(ch,victim)&&area)
               return TRUE;

            if (IS_SET(victim->in_room->room_flags,ROOM_SAFE)
                && (game_state!=GS_PARADOX))
                return TRUE;

	    if (ch->on_quest)
	    	return TRUE;
	
	    if (victim->on_quest)
	    	return TRUE;
	

	    if (is_same_clan(ch,victim))
		return TRUE;

            if (!in_range(ch,victim))
                return TRUE;

/*            if (victim->fighting != NULL && !IS_NPC(victim->fighting))
               return TRUE;*/

            if(has_killed_flag(victim))
             return TRUE;
/*            if(victim->level>101)
             return TRUE;*/
             for(d=descriptor_list;d!=NULL;d=d->next)
            {
             if((d->connected==CON_PLAYING)
                && (d->character != ch)
                && (d->character->fighting!=NULL)
                && (d->character->fighting==victim)
                && (d->character->in_room==victim->in_room))
                   vcount++;
	     if((d->connected==CON_PLAYING)
                && (d->character != victim)
                && (d->character->fighting!=NULL)
                && (d->character->fighting==ch)
                && (d->character->in_room==ch->in_room))
                   ccount++;
            }
            switch(game_state)
            {
             default:
             case GS_CHAOS:
             case GS_PARADOX: return FALSE;
             case GS_SOLO: if(vcount>=1)
                            return TRUE;
                           if(ccount>=1)
                            return TRUE;
                           return FALSE;
             case GS_1VS2: if(vcount>=2)
                            return TRUE;
                           if(ccount>=2)
                            return TRUE;
                           return FALSE;
            }

	}
    }
    return FALSE;
}

/*
 * Check for parry.
 */
bool check_parry( CHAR_DATA *ch, CHAR_DATA *victim )
{
    int chance;

    if ( !IS_AWAKE(victim) )
	return FALSE;

    chance = get_skill(victim,gsn_parry) / 4;

    if ( get_eq_char( victim, WEAR_WIELD ) == NULL )
    {
	if (IS_NPC(victim))
	    chance /= 2;
	else
	    return FALSE;
    }

    if (victim->stunned)
        return FALSE;

    if (!can_see(ch,victim))
	chance /= 2;

    if ( number_percent( ) >= chance + victim->level - ch->level )
	return FALSE;

    xact_new( "{iYou parry $n's attack.{x",  ch, NULL, victim, TO_VICT,POS_RESTING,SUPPRESS_DODGE);
    xact_new( "{h$N parries your attack.{x", ch, NULL, victim, TO_CHAR,POS_RESTING,SUPPRESS_DODGE);
    check_improve(victim,gsn_parry,TRUE,6);
    return TRUE;
}

/*
 * Check for shield block.
 */
bool check_shield_block( CHAR_DATA *ch, CHAR_DATA *victim )
{
    int chance;
    bool levitate;

    if ( !IS_AWAKE(victim) )
        return FALSE;

    levitate = (get_skill(victim,gsn_shield_levitation)!=0)
      && (skill_table[gsn_shield_levitation].skill_level[ch->class]<=ch->level)
      && (get_eq_char(victim,WEAR_SHIELD)!=NULL)
      && ((get_eq_char(victim,WEAR_SECONDARY)!=NULL)
         || ((get_eq_char(victim,WEAR_WIELD)!=NULL)
             && (get_eq_char(victim,WEAR_SECONDARY)==NULL)
             && IS_WEAPON_STAT(get_eq_char(victim,WEAR_WIELD),WEAPON_TWO_HANDS)));

    chance = get_skill(victim,gsn_shield_block) / 5 + 3;
    if(levitate)
      chance = (chance+(get_skill(victim,gsn_shield_levitation)/5+3))/2;

    if ( get_eq_char( victim, WEAR_SHIELD ) == NULL )
        return FALSE;

    if ( number_percent( ) >= chance + victim->level - ch->level )
        return FALSE;

    if (victim->stunned)
        return FALSE;

    xact_new( "{iYou block $n's attack with your shield.{x",  ch, NULL, victim,
TO_VICT,POS_RESTING,SUPPRESS_DODGE    );
    xact_new( "{h$N blocks your attack with a shield.{x", ch, NULL, victim,
TO_CHAR,POS_RESTING,SUPPRESS_DODGE    );
    check_improve(victim,gsn_shield_block,TRUE,6);
    if(levitate)
     check_improve(victim,gsn_shield_levitation,TRUE,6);
    return TRUE;
}


/*
 * Check for dodge.
 */
bool check_dodge( CHAR_DATA *ch, CHAR_DATA *victim )
{
    int chance;

    if ( !IS_AWAKE(victim) )
	return FALSE;

    chance = get_skill(victim,gsn_dodge) / 4;
   
    if(is_affected(victim,gsn_essence_of_mist))
      chance *= 2;

    if (!can_see(victim,ch))
	chance /= 2;

    if ( number_percent( ) >= chance + victim->level - ch->level )
        return FALSE;

    if (victim->stunned)
        return FALSE;

    xact_new( "{iYou dodge $n's attack.{x", ch, NULL, victim, TO_VICT,POS_RESTING,SUPPRESS_DODGE    );
    xact_new( "{h$N dodges your attack.{x", ch, NULL, victim, TO_CHAR,POS_RESTING,SUPPRESS_DODGE    );
    check_improve(victim,gsn_dodge,TRUE,6);
    return TRUE;
}

bool check_armor(CHAR_DATA *ch,CHAR_DATA *victim, int dam)
{
 AFFECT_DATA *pAf;

 if((pAf=affect_find(victim->affected,skill_lookup("immaterial armor")))!=NULL)
 {
  if((dam<(pAf->level/2)) && ((number_percent()<(pAf->level/2-dam))) && (number_percent()<40))
  {
   xact_new( "{iYour immaterial armor absorbs $n's attack.{x",ch,NULL,victim,TO_VICT,POS_RESTING,SUPPRESS_DODGE);
   xact_new( "{h$N's immaterial armor absorbs your attack.{x",ch,NULL,victim,TO_CHAR,POS_RESTING,SUPPRESS_DODGE);
   pAf->subtype-=dam;
   if(pAf->subtype<=0)
   {
    send_to_char("{xYour suit of immaterial armor overloads and vanishes!\n\r",victim);
    affect_strip(victim,skill_lookup("immaterial armor"));
   }
   return TRUE;
  }
 }
 return FALSE;
}

bool check_shield(CHAR_DATA *ch,CHAR_DATA *victim, int dam)
{
 AFFECT_DATA *pAf;
 static bool bFire=FALSE;
 
 if(ch->fighting!=victim)
  return FALSE;
 
 if((pAf=affect_find(victim->affected,skill_lookup("force shield")))!=NULL)
 {
  if((dam<(pAf->level)) && ((number_percent()<(pAf->level-dam))) && (number_percent()<40))
  {
   xact_new( "{iYour force shield deflects $n's attack.{x",ch,NULL,victim,TO_VICT,POS_RESTING,SUPPRESS_DODGE);
   xact_new( "{h$N's force shield deflects your attack.{x",ch,NULL,victim,TO_CHAR,POS_RESTING,SUPPRESS_DODGE);
   if(number_percent()<10)
   {
    if(!bFire)
    {
     bFire=TRUE;
     act("{iYour force shield backfires!{x",ch,NULL,victim,TO_VICT);
     act("{hN's force shield backfires!{x",ch,NULL,victim,TO_CHAR);
     damage(victim,ch,dam,gsn_shield,
	    DAM_OTHER,TRUE);
    } 
   }
   else
    bFire=FALSE;
   pAf->subtype--;
   if(pAf->subtype<=0)
   {
    send_to_char("{xYour force shield flashes brightly and vanishes!\n\r",victim);
    affect_strip(victim,skill_lookup("force shield"));
   }
   return TRUE;
  }
 }
 return FALSE;
}

bool check_stone_skin(CHAR_DATA *ch,CHAR_DATA *victim, int dam)
{
 AFFECT_DATA *pAf;

 if((pAf=affect_find(victim->affected,skill_lookup("stone skin")))!=NULL)
 {
  if((dam<(pAf->level*2)) && ((number_percent()<((pAf->level*2)-dam))) && (number_percent()<40))
  {
   xact_new( "{i$n's attack bounces off your stone skin.{x",ch,NULL,victim,TO_VICT,POS_RESTING,SUPPRESS_DODGE);
   xact_new( "{hYour attack bounces off $N's stone skin.{x",ch,NULL,victim,TO_CHAR,POS_RESTING,SUPPRESS_DODGE);
   pAf->subtype--;
   if(pAf->subtype<=0)
   {
    send_to_char("{xYour stone skin crumbles away.\n\r",victim);
    affect_strip(victim,skill_lookup("stone skin"));
   }
   return TRUE;
  }
 }
 return FALSE;
}

bool check_phase(CHAR_DATA *ch,CHAR_DATA *victim)
{
 int chance;

 if(IS_NPC(victim))
  return FALSE;
 
 if(!IS_AWAKE(victim))
  return FALSE;
 
 if(victim->level<skill_table[gsn_phase].skill_level[victim->class])
  return FALSE;

 chance = get_skill(victim,gsn_phase)/4;
 
 if(!can_see(victim,ch))
  chance/=2;
 
 if(number_percent() >= (chance + victim->level - ch->level))
  return FALSE;
 
 if(victim->stunned)
  return FALSE;

 xact_new("{iYou phase to avoid $n's attack.{x",ch,NULL,victim,TO_VICT,POS_RESTING,SUPPRESS_DODGE);
 xact_new("{h$N phases to avoid your attack.{x",ch,NULL,victim,TO_CHAR,POS_RESTING,SUPPRESS_DODGE);
 check_improve(victim,gsn_phase,TRUE,6);

 return TRUE;
}

bool check_force(CHAR_DATA *ch,	CHAR_DATA *victim)
{
 int chance;

 if(IS_NPC(victim))
  return FALSE;
 if(!is_affected(victim,gsn_protective_force))
  return FALSE;
 chance = 50 + victim->level - ch->level;
 if(number_percent() < chance)
 {
  send_to_char("You are protected by the force of nature.\n\r",victim);
  act("$n is protected by the force of nature.",victim,NULL,NULL,TO_ROOM);
  return TRUE;
 }
 return FALSE;
}

bool check_critical_hit(CHAR_DATA *ch, CHAR_DATA *victim)
{
 int chance;

 if(IS_NPC(ch))
  return FALSE;

 chance = get_skill(ch, gsn_critical_hit) / 6;
 if(!chance)
  return FALSE;
  
 if(!can_see(ch,victim))
   chance /= 2;

 if( number_percent() >= chance + ch->level - victim->level )
  return FALSE; 
 
 send_to_char("{BYou score a {R-{D={W* {RCRITICAL HIT {W*{D={R-{B!{x\n\r",ch);
 act( "{c$n scores a {R-{D={W* {RCRITICAL HIT {W*{D={R-{c!{x",
    ch,NULL,victim,TO_VICT);
 act( "{x$n scores a {R-{D={W* {RCRITICAL HIT {W*{D={R-{x!",
    ch,NULL,victim,TO_NOTVICT);
 check_improve(ch,gsn_critical_hit,TRUE,6); 
 return TRUE;    
}

/*
 * Set position of a victim.
 */
void update_pos( CHAR_DATA *victim )
{
    if ( victim->hit > 0 )
    {
    	if ( victim->position <= POS_STUNNED )
	    victim->position = POS_STANDING;
	return;
    }

    if ( IS_NPC(victim) && victim->hit < 1 )
    {
	victim->position = POS_DEAD;
	return;
    }

    if ( 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) )
    {
      if( is_affected(ch,gsn_sleep))
	affect_strip( ch, gsn_sleep );
      else if (is_affected(ch,gsn_blackjack))
        affect_strip(ch, gsn_blackjack );
    }

    ch->fighting = victim;
    ch->position = POS_FIGHTING;
    ch->stunned = 0;

    if(has_killed_flag(ch))
     remove_killed_flag(ch);

    if(!IS_NPC(ch)&&!IS_NPC(victim))
    {
     ch->pcdata->pkflag=10;
     victim->pcdata->pkflag=10;
    }

    return;
}



/*
 * Stop fights.
 */
void stop_fighting( CHAR_DATA *ch, bool fBoth )
{
    CHAR_DATA *fch;
    char buf[MAX_STRING_LENGTH];

    for ( fch = char_list; fch != NULL; fch = fch->next )
    {
	if ( fch == ch || ( fBoth && fch->fighting == ch ) )
	{
	    fch->fighting	= NULL;
	    fch->position	= IS_NPC(fch) ? fch->default_pos : POS_STANDING;
	    fch->stunned	= 0;
	    update_pos( fch );
	    if (IS_SET(fch->comm,COMM_STORE))
		if(fch->tells)
		{
		    sprintf( buf, "You have {R%d{x tells waiting.\n\r", fch->tells );
		    send_to_char( buf, fch );
		    send_to_char("Type 'replay' to see tells.\n\r",fch);
		}
	}
    }

    return;
}



/*
 * Make a corpse out of a character.
 */
void make_corpse( CHAR_DATA *ch, CHAR_DATA *killer, int lootpoint )
{
    char buf[MAX_STRING_LENGTH];
    OBJ_DATA *corpse;
    OBJ_DATA *obj;
    OBJ_DATA *obj_next;
    char *name;

    if ( IS_NPC(ch) )
    {
	if (IS_SET(ch->act, ACT_NO_BODY) )
	{
	    if (IS_SET(ch->act, ACT_NB_DROP) )
	    {
		for ( obj = ch->carrying; obj != NULL; obj = obj_next )
		{
		    obj_next = obj->next_content;
		    obj_from_char( obj );
		    if (obj->item_type == ITEM_POTION)
			obj->timer = number_range(500,1000);
		    if (obj->item_type == ITEM_SCROLL)
			obj->timer = number_range(1000,2500);
		    if (IS_SET(obj->extra_flags,ITEM_ROT_DEATH))
		    {
			obj->timer = number_range(5,10);
			REMOVE_BIT(obj->extra_flags,ITEM_ROT_DEATH);
		    }
		    REMOVE_BIT(obj->extra_flags,ITEM_VIS_DEATH);

		    if ( IS_SET( obj->extra_flags, ITEM_INVENTORY ) )
			extract_obj( obj );
		    act("$p falls to the floor.",ch,obj,NULL,TO_ROOM);
		    obj_to_room(obj,ch->in_room);
		}
	    }
	    return;
	}
	name		= ch->short_descr;
	corpse		= create_object(get_obj_index(OBJ_VNUM_CORPSE_NPC), 0);
	corpse->timer	= number_range( 3, 6 );
	if ( ch->gold > 0 || ch->platinum > 0 )
	{
	    obj_to_obj( create_money( ch->platinum, ch->gold, ch->silver ), corpse );
	    ch->platinum = 0;
	    ch->gold = 0;
	    ch->silver = 0;
	}
	corpse->cost = 0;
    }
    else
    {
	name		= ch->name;
	corpse		= create_object(get_obj_index(OBJ_VNUM_CORPSE_PC), 0);
	corpse->timer	= /*number_range( 25, 40 )*/30;
	REMOVE_BIT(ch->act,PLR_CANLOOT);
	/*if (!is_clan(ch))
	{
	    corpse->owner = str_dup(ch->name);
	    corpse->killer = NULL;
	}
	else
	{*/
	    corpse->owner = str_dup(ch->name);
	    corpse->killer = str_dup(killer->name);
	    if (ch->platinum > 1 || ch->gold > 1 || ch->silver > 1)
	    {
		obj_to_obj(create_money(ch->platinum/2, ch->gold / 2, ch->silver/2), corpse);
		ch->platinum -= ch->platinum/2;
		ch->gold -= ch->gold/2;
		ch->silver -= ch->silver/2;
	    }
/*	}*/
		
	corpse->cost = 0;
    }

    corpse->level = ch->level;

    sprintf( buf, corpse->short_descr, name );
    free_string( corpse->short_descr );
    corpse->short_descr = str_dup( buf );

    sprintf( buf, corpse->description, name );
    free_string( corpse->description );
    corpse->description = str_dup( buf );

    for ( obj = ch->carrying; obj != NULL; obj = obj_next )
    {
	bool floating = FALSE;

	obj_next = obj->next_content;
	if (obj->wear_loc == WEAR_FLOAT)
	    floating = TRUE;
	obj_from_char( obj );
	if (obj->item_type == ITEM_POTION)
	    obj->timer = number_range(500,1000);
	if (obj->item_type == ITEM_SCROLL)
	    obj->timer = number_range(1000,2500);
	if (IS_SET(obj->extra_flags,ITEM_ROT_DEATH) && !floating)
	{
	    obj->timer = number_range(5,10);
	    REMOVE_BIT(obj->extra_flags,ITEM_ROT_DEATH);
	}
	REMOVE_BIT(obj->extra_flags,ITEM_VIS_DEATH);

	if ( IS_SET( obj->extra_flags, ITEM_INVENTORY ) )
	    extract_obj( obj );
	else if (floating && !IS_OBJ_STAT(obj,ITEM_QUEST) && !IS_NPC(killer))
	{
	    if (IS_OBJ_STAT(obj,ITEM_ROT_DEATH)) /* get rid of it! */
	    { 
		if (obj->contains != NULL)
		{
		    OBJ_DATA *in, *in_next;

		    act("$p evaporates,scattering its contents.",
			ch,obj,NULL,TO_ROOM);
		    for (in = obj->contains; in != NULL; in = in_next)
		    {
			in_next = in->next_content;
			obj_from_obj(in);
			obj_to_room(in,ch->in_room);
		    }
		 }
		 else
		    act("$p evaporates.",
			ch,obj,NULL,TO_ROOM);
		 extract_obj(obj);
	    }
	    else
	    {
		act("$p falls to the floor.",ch,obj,NULL,TO_ROOM);
		obj_to_room(obj,ch->in_room);
	    }
	}
	else
	    obj_to_obj( obj, corpse );
    }
    corpse->lootpoint=lootpoint;
    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;
    msg = "You hear $n's death cry.";
    if (IS_NPC(ch))
    {
	if (!IS_SET(ch->act, ACT_NO_BODY) )
	{
	    switch ( number_bits(4))
	    {
	    case  0:
		msg  = "$n hits the ground ... DEAD.";
		vnum = OBJ_VNUM_BLOOD;
		break;
	    case  1:
		msg  = "$n splatters blood on your armor.";
		vnum = OBJ_VNUM_BLOOD;
		break;
	    case  2:
		if (IS_SET(ch->parts,PART_GUTS))
		{
		    msg = "$n spills $s guts all over the floor.";
		    vnum = OBJ_VNUM_GUTS;
		}
		break;
	    case  3: 
		if (IS_SET(ch->parts,PART_HEAD))
		{
		    msg  = "$n's severed head plops on the ground.";
		    vnum = OBJ_VNUM_SEVERED_HEAD;
		}
		break;
	    case  4:
		if (IS_SET(ch->parts,PART_HEART))
		{
		    msg  = "$n's heart is torn from $s chest.";
		    vnum = OBJ_VNUM_TORN_HEART;
		}
		break;
	    case  5:
		if (IS_SET(ch->parts,PART_ARMS))
		{
		    msg  = "$n's arm is sliced from $s dead body.";
		    vnum = OBJ_VNUM_SLICED_ARM;
		}
		break;
	    case  6:
		if (IS_SET(ch->parts,PART_LEGS))
		{
		    msg  = "$n's leg is sliced from $s dead body.";
		    vnum = OBJ_VNUM_SLICED_LEG;				
		}
		break;
	    case 7:
		if (IS_SET(ch->parts,PART_BRAINS))
		{
		    msg = "$n's head is shattered, and $s brains splash all over you.";
		    vnum = OBJ_VNUM_BRAINS;
		}
		break;
	    case  8:
		msg  = "$n hits the ground ... DEAD.";
		vnum = OBJ_VNUM_BLOOD;
		break;
	    case  9:
		msg  = "$n hits the ground ... DEAD.";
		vnum = OBJ_VNUM_BLOOD;
	    }
	}
    } else if (ch->level > 19)
    {
	switch ( number_bits(4))
	{
	    case  0:
		msg  = "$n hits the ground ... DEAD.";
		vnum = OBJ_VNUM_BLOOD;
		break;
	    case  1:
		msg  = "$n splatters blood on your armor.";
		vnum = OBJ_VNUM_BLOOD;
		break;
	    case  2:
		if (IS_SET(ch->parts,PART_GUTS))
		{
		    msg = "$n spills $s guts all over the floor.";
		    vnum = OBJ_VNUM_GUTS;
		}
		break;
	    case  3:
		if (IS_SET(ch->parts,PART_HEAD))
		{
		    msg  = "$n's severed head plops on the ground.";
		    vnum = OBJ_VNUM_SEVERED_HEAD;
		}
		break;
	    case  4:
		if (IS_SET(ch->parts,PART_HEART))
		{
		    msg  = "$n's heart is torn from $s chest.";
		    vnum = OBJ_VNUM_TORN_HEART;
		}
		break;
	    case  5:
		if (IS_SET(ch->parts,PART_ARMS))
		{
		    msg  = "$n's arm is sliced from $s dead body.";
		    vnum = OBJ_VNUM_SLICED_ARM;
		}
		break;
	    case  6:
		if (IS_SET(ch->parts,PART_LEGS))
		{
		    msg  = "$n's leg is sliced from $s dead body.";
		    vnum = OBJ_VNUM_SLICED_LEG;
		}
		break;
	    case 7:
		if (IS_SET(ch->parts,PART_BRAINS))
		{
		    msg = "$n's head is shattered, and $s brains splash all over you.";
		    vnum = OBJ_VNUM_BRAINS;
		}
		break;
	    case  8:
		msg  = "$n hits the ground ... DEAD.";
		vnum = OBJ_VNUM_BLOOD;
		break;
	    case  9:
		msg  = "$n hits the ground ... DEAD.";
		vnum = OBJ_VNUM_BLOOD;
		break;
	    case  10:
		if (IS_SET(ch->parts,PART_HEAD))
		{
		    msg  = "$n's severed head plops on the ground.";
		    vnum = OBJ_VNUM_SEVERED_HEAD;
		}
		break;
	    case  11:
		if (IS_SET(ch->parts,PART_HEART))
		{
		    msg  = "$n's heart is torn from $s chest.";
		    vnum = OBJ_VNUM_TORN_HEART;
		}
		break;
	    case  12:
		if (IS_SET(ch->parts,PART_ARMS))
		{
		    msg  = "$n's arm is sliced from $s dead body.";
		    vnum = OBJ_VNUM_SLICED_ARM;
		}
		break;
	    case  13:
		if (IS_SET(ch->parts,PART_LEGS))
		{
		    msg  = "$n's leg is sliced from $s dead body.";
		    vnum = OBJ_VNUM_SLICED_LEG;
		}
		break;
	    case 14:
		if (IS_SET(ch->parts,PART_BRAINS))
		{
		    msg = "$n's head is shattered, and $s brains splash all over you.";
		    vnum = OBJ_VNUM_BRAINS;
		}
	}
    }

    act( msg, ch, NULL, NULL, TO_ROOM );

    if (( vnum == 0 ) && !IS_SET(ch->act, ACT_NO_BODY) )
    {
	switch ( number_bits(4))
	{
	case  0:
		vnum = 0;
		break;
	case  1: 
		vnum = OBJ_VNUM_BLOOD;
		break;
	case  2: 							
		vnum = 0;
		break;
	case  3: 
		vnum = OBJ_VNUM_BLOOD;				
		break;
	case  4: 
		vnum = 0;				
		break;
	case  5: 
		vnum = OBJ_VNUM_BLOOD;				
		break;
	case  6: 
		vnum = 0;				
		break;
	case 7:
		vnum = OBJ_VNUM_BLOOD;
	}
    }

    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 );
	if (!IS_NPC(ch))
	{
	    obj->timer = number_range( 12, 18 );
	}
	if (vnum == OBJ_VNUM_BLOOD)
	{
	    obj->timer = number_range( 1, 4 );
	}

	sprintf( buf, obj->short_descr, name );
	free_string( obj->short_descr );
	obj->short_descr = str_dup( buf );

	sprintf( buf, obj->description, name );
	free_string( obj->description );
	obj->description = str_dup( buf );

        sprintf( buf, obj->name, name );
        free_string( obj->name );
        obj->name = str_dup( buf );

	if (obj->item_type == ITEM_FOOD)
	{
	    if (IS_SET(ch->form,FORM_POISON))
		obj->value[3] = 1;
	    else if (!IS_SET(ch->form,FORM_EDIBLE))
		obj->item_type = ITEM_TRASH;
	}

	if (IS_NPC(ch))
	{
	    obj->value[4] = 0;
	} else {
	    obj->value[4] = 1;
	}

	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->u1.to_room != NULL
	&&   pexit->u1.to_room != was_in_room )
	{
	    ch->in_room = pexit->u1.to_room;
	    act( msg, ch, NULL, NULL, TO_ROOM );
	}
    }
    ch->in_room = was_in_room;

    return;
}



void raw_kill( CHAR_DATA *victim, CHAR_DATA *killer, int lootpoint )
{
    int i;

    death_cry( victim );
    stop_fighting( victim, TRUE );
    make_corpse( victim, killer, lootpoint );

    if ( IS_NPC(victim) )
    {
	victim->pIndexData->killed++;
	kill_table[URANGE(0, victim->level, MAX_LEVEL-1)].killed++;
	extract_char( victim, TRUE );
	return;
    }

    extract_char( victim, FALSE );
    while ( victim->affected )
	affect_remove( victim, victim->affected );
    victim->affected_by	= race_table[victim->race].aff;
    victim->shielded_by	= race_table[victim->race].shd;
    for (i = 0; i < 4; i++)
    	victim->armor[i]= 100;
    victim->position	= POS_RESTING;
    victim->hit		= UMAX( 1, victim->hit  );
    victim->mana	= UMAX( 1, victim->mana );
    victim->move	= UMAX( 1, victim->move );
    WAIT_STATE(victim,24);
/*  save_char_obj( victim ); we're stable enough to not need this :) */
    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;
    int group_levels;

    /*
     * 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 ( victim == ch )
	return;
    
    members = 0;
    group_levels = 0;
    for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room )
    {
	if ( is_same_group( gch, ch ) )
        {
	    members++;
	    group_levels += IS_NPC(gch) ? gch->level / 2 : gch->level;
	}
    }

    if ( members == 0 )
    {
	bug( "Group_gain: members.", members );
	members = 1;
	group_levels = ch->level ;
    }

    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 ) || IS_NPC(gch))
	    continue;

/*	if ( gch->level - lch->level >= 5 )
	{
	    send_to_char( "You are too high for this group.\n\r", gch );
	    continue;
	}

	if ( gch->level - lch->level <= -5 )
	{
	    send_to_char( "You are too low for this group.\n\r", gch );
	    continue;
	}*/

	xp = xp_compute( gch, victim, group_levels,members );  
	sprintf( buf, "{BYou receive {W%d{B experience points.{x\n\r", xp );
	send_to_char( buf, gch );
	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( "{cYou are {Wzapped{c by $p.{x", ch, obj, NULL, TO_CHAR );
		act( "$n is {Wzapped{x by $p.",   ch, obj, NULL, TO_ROOM );
		obj_from_char( obj );
		obj_to_room( obj, ch->in_room );
	    }
	}
        if(is_affected(ch,gsn_divine_blessing)&&!IS_GOOD(ch))
        {
         affect_strip(ch,gsn_divine_blessing);
         send_to_char("You have angered the gods and your shimmering aura vanishes.\n\r",ch);
        }
        if(is_affected(ch,gsn_infernal_offering)&&!IS_EVIL(ch))
        {
         affect_strip(ch,gsn_infernal_offering);
         send_to_char("You have angered the gods and the infernal power leaves you.\n\r",ch);
        }
        if(IS_SET(ch->exbit1,PLR_QUESTOR) && IS_NPC(victim))
        {
         if(ch->questmob==victim->pIndexData->vnum)
         {
          send_to_char("You have almost completed your quest!\n\r",ch);
          send_to_char("Return to the questmaster before your time runs out!\n\r",ch);
         ch->questmob=-1;
        }
       }
    }

    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 total_levels, int members )
{
    int xp,base_exp;
    int align,level_range;
    int change;
    int time_per_level;

    level_range = victim->level - gch->level;
   /* if (!IS_NPC(gch))
    {
	if (gch->class >= MAX_CLASS/2)
	    level_range -= 5;
    }*/
 
    if (!IS_NPC(gch) && !IS_NPC(victim))
    {
	xp = 1;
	return xp;
    }
    /* compute the base exp */
    switch (level_range)
    {
 	default : 	base_exp =   0;		break;
	case -9 :	base_exp =   1;		break;
	case -8 :	base_exp =   2;		break;
	case -7 :	base_exp =   5;		break;
	case -6 : 	base_exp =   9;		break;
	case -5 :	base_exp =  11;		break;
	case -4 :	base_exp =  22;		break;
	case -3 :	base_exp =  33;		break;
	case -2 :	base_exp =  50;		break;
	case -1 :	base_exp =  66;		break;
	case  0 :	base_exp =  83;		break;
	case  1 :	base_exp =  99;		break;
	case  2 :	base_exp = 121;		break;
	case  3 :	base_exp = 143;		break;
	case  4 :	base_exp = 165;		break;
    } 
    
    if (level_range > 4)
	base_exp = 160 + 20 * (level_range - 4);

    /* do alignment computations */
   
    align = victim->alignment - gch->alignment;

    if (IS_SET(victim->act,ACT_NOALIGN))
    {
	/* no change */
    }

    else if (align > 500) /* monster is more good than slayer */
    {
	change = (align - 500) * base_exp / 500 * gch->level/total_levels; 
	change = UMAX(1,change);
        gch->alignment = UMAX(-1000,gch->alignment - change);
	if ( gch->pet != NULL )
	    gch->pet->alignment = gch->alignment;
    }

    else if (align < -500) /* monster is more evil than slayer */
    {
	change =  ( -1 * align - 500) * base_exp/500 * gch->level/total_levels;
	change = UMAX(1,change);
	gch->alignment = UMIN(1000,gch->alignment + change);
        if ( gch->pet != NULL )
            gch->pet->alignment = gch->alignment;
    }

    else /* improve this someday */
    {
	change =  gch->alignment * base_exp/500 * gch->level/total_levels;  
	gch->alignment -= change;
        if ( gch->pet != NULL )
            gch->pet->alignment = gch->alignment;
    }
    
    /* calculate exp multiplier */
    if (IS_SET(victim->act,ACT_NOALIGN))
	xp = base_exp;

    else if (gch->alignment > 500)  /* for goodie two shoes */
    {
	if (victim->alignment < -750)
	    xp = (base_exp *4)/3;
   
 	else if (victim->alignment < -500)
	    xp = (base_exp * 5)/4;

        else if (victim->alignment < -250)
	    xp = (base_exp * 3)/4; 

        else if (victim->alignment > 750)
	    xp = base_exp / 4;

   	else if (victim->alignment > 500)
	    xp = base_exp / 2;

	else
	    xp = base_exp;
    }

    else if (gch->alignment < -500) /* for baddies */
    {
	if (victim->alignment > 750)
	    xp = (base_exp * 5)/4;
	
  	else if (victim->alignment > 500)
	    xp = (base_exp * 11)/10; 

   	else if (victim->alignment < -750)
	    xp = base_exp/2;

	else if (victim->alignment < -500)
	    xp = (base_exp * 3)/4;

	else if (victim->alignment < -250)
	    xp = (base_exp * 9)/10;

	else
	    xp = base_exp;
    }

    else if (gch->alignment > 200)  /* a little good */
    {

	if (victim->alignment < -500)
	    xp = (base_exp * 6)/5;

 	else if (victim->alignment > 750)
	    xp = base_exp/2;

	else if (victim->alignment > 0)
	    xp = (base_exp * 3)/4; 
	
	else
	    xp = base_exp;
    }

    else if (gch->alignment < -200) /* a little bad */
    {
	if (victim->alignment > 500)
	    xp = (base_exp * 6)/5;
 
	else if (victim->alignment < -750)
	    xp = base_exp/2;

	else if (victim->alignment < 0)
	    xp = (base_exp * 3)/4;

	else
	    xp = base_exp;
    }

    else /* neutral */
    {

	if (victim->alignment > 500 || victim->alignment < -500)
	    xp = (base_exp * 4)/3;

	else if (victim->alignment < 200 && victim->alignment > -200)
	    xp = base_exp/2;

 	else
	    xp = base_exp;
    }

    /* more exp at the low levels */
    if (gch->level < 11)
    	xp = 15 * xp / (gch->level + 4);

    /* less at high */
/*    if (gch->level > 60 )
	xp =  15 * xp / (gch->level - 25 );*/

    /* reduce for playing time */

    
    {
	/* compute quarter-hours per level */
	time_per_level = 4 *
			 (gch->played + (int) (current_time - gch->logon))/3600
			 / gch->level;

	time_per_level = URANGE(2,time_per_level,12);
	if (gch->level < 25)  /* make it a curve */
	    time_per_level = UMAX(time_per_level,(25 - gch->level));
/*
 *	xp = xp * time_per_level / 12;
 */
    }
    xp = xp*.7;
   
    /* randomize the rewards */
    xp = number_range (xp * 3/4, xp * 5/4);

    /* adjust for grouping */
    /*xp*=members;
    xp = xp * gch->level/( UMAX(1,total_levels -1) );*/
    
    if(xp<=0)
     xp=1;
    if(gch->level<=62)
     xp*=2;
    return xp;
}

void dam_message( CHAR_DATA *ch, CHAR_DATA *victim,int dam,int dt,bool immune, int suppress, bool singular )
{
    char buf1[256], buf2[256], buf3[256];
    const char *vs;
    const char *vp;
    char *attack;
    char punct;

    if (ch == NULL || victim == NULL)
	return;

	 if ( dam ==   0 ) { vs = "miss";	vp = "misses";		}
    else if ( dam <=   10 ) { vs = "{x{gtickle{B";	vp = "{x{gtickles{B";	}
    else if ( dam <=   20 ) { vs = "{x{gscrape{B";	vp = "{x{gscrapes{B";		}
    else if ( dam <=  30 ) { vs = "{x{rscratch{B";	vp = "{x{rscratches{B";		}
    else if ( dam <=  40 ) { vs = "{x{bcut{B";	vp = "{x{bcuts{B";		}
    else if ( dam <=  50 ) { vs = "{x{cwound{B";	vp = "{x{cwounds{B";		}
    else if ( dam <=  60 ) { vs = "{x{Rm{yau{Rl{B";       vp = "{x{Rm{yaul{Rs{B";		}
    else if ( dam <=  70 ) { vs = "{x{bt{Boas{bt{B";	vp = "{x{bt{Boast{bs{B";	}
    else if ( dam <=  80 ) { vs = "{x{gp{Gumme{gl{B";	vp = "{x{gp{Gummel{gs{B";	}
    else if ( dam <=  100 ) { vs = "{x{mDemolish{B";	vp = "{x{mDemolishes{B";		}
    else if ( dam <=  120 ) { vs = "{x{RMUTILATE{B";	vp = "{x{RMUTILATES{B";	}
    else if ( dam <=  140 ) { vs = "{x{GWHACK{B";	vp = "{x{GWHACKS{B";	}
    else if ( dam <=  160 ) { vs = "{x{YDISMEMBER{B";	vp = "{x{YDISMEMBERS{B";	}
    else if ( dam <=  180 ) { vs = "{x{bSlice{x-N-{rDice{B";	vp = "{x{bSlices{x-N-{rDices{B";	}
    else if ( dam <=  200 ) { vs = "{x{yATOMIZE{B";	vp = "{x{yATOMIZES{B";		}
    else if ( dam <=  225 ) { vs = "{x{R<> {YLACERATE{R <>{B";
			     vp = "{x{R<> {YLACERATES{R <>{B";			}
    else if ( dam <=  250 ) { vs = "{x{r*{b-{r* {GGiNSu {r*{b-{r*{B";
			     vp = "{x{r*{b-{r* {GGiNSuS {r*{b-{r*{B";			}
    else if ( dam <= 275)  { vs = "{x{B<-> {YPULVERIZE {B<->{B";
			     vp = "{x{B<-> {YPULVERIZES {B<->{B";		}
    else if ( dam <= 300)  { vs = "{x{c*{b-{c* {BVoRPalIZE {c*{b-{c* {B";
			     vp = "{x{c*{b-{c* {BVoRPalIZEs {c*{b-{c* {B";		}
    else if ( dam <= 350)  { vs = "{x{M<{R-{M*{R-{M> {RDISINTEGRATE {M<{R-{M*{R-{M>{B";
			     vp = "{x{M<{R-{M*{R-{M> {RDISINTEGRATES {M<{R-{M*{R-{M>{B";			}
    else if ( dam <= 450)  { vs = "{x{B={D+{B= {rSLauGHter {B={D+{B={B";
                             vp = "{x{B={D+{B= {rSLauGHterS {B={D+{B={B"; }
    else if ( dam <= 500)  { vs = "{x{G<--> {YVAPORIZE {G<-->{B";
                             vp = "{x{G<--> {YVAPORIZES {G<-->{B"; }
    else if ( dam <= 550)  { vs = "{x{g>{R>{g> {WCASTRATE {g<{R<{g<{B";
                             vp = "{x{g>{R>{g> {WCASTRATES {g<{R<{g<{B"; }
    else if ( dam <= 600)  { vs = "{x{r<{R<{Y-{r*{Y-{R>{r> {RI{YN{RC{YI{RN{YE{RR{YA{RT{YE {r<{R<{Y-{r*{Y-{R>{r>{B";
                             vp = "{x{r<{R<{Y-{r*{Y-{R>{r> {RI{YN{RC{YI{RN{YE{RR{YA{RT{YE{RS {r<{R<{Y-{r*{Y-{R>{r>{B"; }  
                         
    else if ( dam <= 650) { vs = "{x{y>{x+{y> {RP{xileDrive {y<{x+{y<{B";
                             vp = "{x{y>{x+{y> {RP{xileDrives {y<{x+{y<{B"; }
    else if ( dam <= 700) { vs = "{x{m<<{R<{W+{R-{W*{G-{W+{R>{m>> {RP{WU{RN{WC{RT{WU{RR{WE {m<<{R<{W+{R-{W*{Y-{W+{R>{m>>{B";
                             vp = "{x{m<<{R<{W+{R-{W*{G-{W+{R>{m>> {RP{WU{RN{WC{RT{WU{RR{WE{RS {m<<{R<{W+{R-{W*{Y-{W+{R>{m>>{B"; }
    else if ( dam <= 750){ vs = "{x{Y<{B<{R<{W+-*{Y-{W+{R>{B>{Y> {gC{WR{gU{WC{gI{WF{gY {Y<{B<{R<{W+{B-{W*-+{R>{B>{Y>{B";
                             vp = "{x{Y<{B<{R<{W+-*{Y-{W+{R>{B>{Y> {gC{WR{gU{WC{gI{WF{gI{WE{gS {Y<{B<{R<{W+{B-{W*-+{R>{B>{Y>{B"; }
    else if ( dam <= 800){ vs = "{x{B<{x-=-{B><{m-=-{B> {BR{MU{BP{BT{BU{GR{BE {B<{M-=-{B><{Y-=-{B>{B";
                             vp = "{x{B<{x-=-{B><{m-=-{B> {BR{MU{BP{BT{BU{GR{BE{GS {B<{M-=-{B><{Y-=-{B>{B"; }
    else if ( dam <= 1000) { vs = "{x{m_{r\\{R|{r/{m__{r\\{R|{r/{m_ {mE{WX{mT{WE{mR{WM{mI{WN{mA{WT{mE {m_{r\\{R|{r/{m__{r\\{R|{r/{m_{B";
                             vp = "{x{m_{r\\{R|{r/{m__{r\\{R

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

Site Stats

Snippets: 1791
Codebases: 571