fgt.c

EmlenMud2003LOC/src/fgt.c · 190.2 KB

From the archive EmlenMud2003LOC.zip

Download the archive   « Back to the archive contents

/* Check that mobs yell when you cast a spell at them */
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "emlen.h"

void show_hitdam(int, char*, int, CHAR_DATA*, CHAR_DATA*);
#define CHECK_CHAR(ch)   if ( (ch)->data_type==50) return

bool hitop = FALSE;

int ghit_pos = 0;
char reasonfd[30];

bool
check_skill(CHAR_DATA *ch, int gsn)
{
  SPELL_DATA *spl;
  if (IS_MOB(ch))
    if(number_range(1,4) == 3)
      return FALSE;
    else return TRUE;
  if ((spl = skill_lookup(NULL, gsn)) != NULL)
    {
      if (spl->guilds & ~(ch->pcdata->guilds))
	{
	  return FALSE;
	}
      if (LEVEL(ch) < spl->spell_level)
	return FALSE;
    }
  if (ch->pcdata->learned[gsn] == -100 || number_range(1,103) > ch->pcdata->learned[gsn])
    return FALSE;

  return TRUE;
}



void
check_same_side_pk (CHAR_DATA *ch, CHAR_DATA *victim)
{
  char log_buf[200];
  int i;
  CHAR_DATA *guarder;
  if (IS_MOB(victim) || !ch->in_room)
    return;
  check_room_more(ch->in_room);
  if (IS_PLAYER(ch) && (ch != victim) && (!ch->fgt || ch->fgt->fighting != victim))
    {
      if ((!IS_SET(victim->act, PLR_SAME_SIDE_PK) && ch->in_room->vnum >= 1000 && !DIFF_ALIGN(ch, victim)) || LEVEL(victim) >= IMM_LEVEL)
	{
	  sprintf(log_buf, "ILLEGAL PKILL %s attacked %s at %d.\n\r", NAME(ch), NAME(victim), ch->in_room->vnum);
	  log_string(log_buf);
	  SET_BIT(ch->act, PLR_SAME_SIDE_PK);
          send_to_char("\x1b[1;31mYou attacked someone illegally!\n\r", ch);
          send_to_char("\x1b[1;31mYou attacked someone illegally!\n\r",ch);
          send_to_char("\x1b[1;31mYou attacked someone illegally!\n\r", ch);
	  send_to_char("You have been attacked by someone who was not allowed to.\n\r", victim);
	}
      else if (!DIFF_ALIGN(ch, victim) && ch->in_room->vnum >=1000)
	{
	  sprintf(log_buf, "OK PKILL %s attacked %s at %d.\n\r", NAME(ch), NAME(victim), ch->in_room->vnum);
	  log_string(log_buf);
	  SET_BIT(ch->act, PLR_SAME_SIDE_PK);
        }
    }
  if (IS_PLAYER(ch) && IS_PLAYER(victim) && FIGHTING(ch) == NULL && FIGHTING(victim) == NULL && number_range(1,5) == 3)
    {
       char buf[500];
       sprintf(buf, "Help, I am being attacked by %s at %s.\n\r",rNAME(ch, victim), ch->in_room->name);
       do_yell(victim, buf);
     }
  /*ARC: no timers against neutral align, unless battle ground */
  if (IS_PLAYER (ch) && ch->pcdata->no_quit_pk == 0 && IS_PLAYER(victim) && ALIGN(ch)!= 0 
	&& ALIGN(victim)!=0 && !IN_BATTLE(ch) && ch->fgt->challenge != 10)
    {
      ch->pcdata->no_quit_pk = 4;
    }
  if (IS_PLAYER (victim) && victim->pcdata->no_quit_pk == 0 && IS_PLAYER(ch) && ALIGN(ch)!= 0 
	&& ALIGN(victim)!=0 && !IN_BATTLE(ch) && ch->fgt->challenge != 10)
    {
      victim->pcdata->no_quit_pk = 4;
    }
  if(number_range(1,4) == 2)
    for (i = 0; i < 4; i ++)
      {
	if ((guarder = victim->pcdata->guarded_by[i]) != NULL &&
	    IS_PLAYER(guarder) &&
	    (guarder->pcdata->guarding == victim) &&
	    (guarder->in_room == victim->in_room))
	  {
	    if (number_range(1,70) == 3)
	      skill_gain(guarder, gsn_guard, TRUE);
	    if (check_skill(ch, gsn_guard))
	      {
		act("$n heroically steps in front of $N!", guarder, NULL, victim, TO_NOTVICT);
		act("You heroically step in front of $N", guarder, NULL, victim, TO_CHAR);
		act("$n heroically steps in front of you", guarder, NULL, victim, TO_VICT);
		check_fgt(ch);
		ch->fgt->fighting = guarder;
		return;
	      }
	  }
      }
  return;
}



void do_tackle (CHAR_DATA * ch, char *argy) {
  CHAR_DATA *victim;
  int chan;
  int xn;
  char buf[STD_LENGTH];
  DEFINE_COMMAND ("tackle", do_tackle, POSITION_FIGHTING, 0, LOG_NORMAL, "This command makes your character attempt to tackle his/her opponent.")
    check_fgt (ch);


  if (IS_PLAYER(ch))
    if (!IS_SET (ch->ced->fight_ops, F_GROUND)) {
      send_to_char("You cannot tackle someone while you are trying to avoid groundfighting.\n\r", ch);
      return;
    }


  if (ch->fgt->ears > 9) {
    send_to_char ("You can't tackle this soon after giving or recieving a bash.\n\r", ch);
    return;
  }
  chan = 0;
  if (ch->wait > 2) return;

  if (FIGHTING (ch) == NULL) {
    if (argy[0] == '\0' || argy == "")
      {
	send_to_char ("Tackle who?\n\r", ch);
        WAIT_STATE(ch, 3*PULSE_VIOLENCE); 
	return;
      }
    if ((victim = get_char_room (ch, argy)) == NULL)
      {
	send_to_char ("Tackle who?\n\r", ch);
        WAIT_STATE(ch, 3*PULSE_VIOLENCE); 
	return;
      }
    if (victim == ch)
      {
	send_to_char ("You really do look like an idiot!\n\r", ch);
	return;
      }
    /* ----------------------------------------- */
    /*		 Protecting Neutral align.	 */
    /* ----------------------------------------- */
    if (IS_PLAYER(ch) && IS_PLAYER(victim) && ALIGN(victim) == 0 && !IN_BATTLE(ch)
	&& ch->fgt->challenge != 10)
    {
	send_to_char ("A strange force prevents you from harming this person.\n\r", ch);
	return;
    }
    if ( IS_PLAYER(ch) && IS_PLAYER(victim) && ALIGN (ch) == 0 && !IN_BATTLE(ch)
	&& ch->fgt->challenge != 10)
    {
	send_to_char ("A strange force prevents you from attacking other players.\n\r", ch);
	return;
    }

    /* ----------------------------------------- */
    /*	      Protecting LinkDead-NoTimers 	 */
    /* ----------------------------------------- */
    if(IS_PLAYER(victim) && victim->desc == NULL) {
      if(!(victim->pcdata->no_quit_pk > 0)) {
	send_to_char ("You cannot attack someone who exists slightly outside reality.\n\r", ch);
	return;
      }
    }

  } else victim = FIGHTING (ch);

  if (FIGHTING(ch) == NULL && FIGHTING(victim) != NULL && !IS_IN_MELEE(ch, victim))
  {
    send_to_char("You cannot get close enough to tackle them!\n\r", ch);
    return;
  }

  if (RIDING (ch) != NULL)
  {
    send_to_char ("You can't tackle someone when you are riding!\n\r", ch);
    return;
  }

  if (is_safe (ch, victim)) return;

  if (!can_see (ch, victim))  {
    send_to_char ("How can you tackle someone you can't see!?\n\r", ch);
    return;
  }

  if (!can_groundfight (victim) && (IS_MOB(ch) ||
   (str_cmp(race_info[ch->pcdata->race].name, "minotaur") &&
   str_cmp(race_info[ch->pcdata->race].name, "gargoyle")))) {
    act ("You do not want to tackle that kind of creature!", ch, NULL, victim, TO_CHAR);
    return;
  }

  if (victim->position == POSITION_GROUNDFIGHTING)
  {
    act ("$N is already on the ground, tackled!", ch, NULL, victim, TO_CHAR);
    WAIT_STATE(ch, 2*PULSE_VIOLENCE);
    return;
  }

  if (victim->position == POSITION_BASHED)
  {
    act ("$N has been bashed, and you stumble past them!", ch, NULL,victim, TO_CHAR);
    WAIT_STATE(ch, 2*PULSE_VIOLENCE);
    return;
  }

  check_ced (ch);
  check_ced (victim);
  if (FIGHTING(victim) != NULL && !(IS_IN_MELEE (ch, victim)))
    {
      send_to_char ("You are not in the main melee!\n\r", ch);
      return;
    }

  if (!(IS_IN_MELEE (ch, victim)))
    {
      send_to_char ("You are not in the main melee!\n\r", ch);
      return;
    }

  if (!pow.tackle_with_weapon)
  {
    if ((ch->hold1 != NULL && (ch->hold1->pIndexData->item_type == ITEM_WEAPON)))
      {
	send_to_char ("You cannot tackle with a weapon in hand!\n\r", ch);
	return;
      }
  }

  if (!pow.tackle_person_with_weapon)
  {
      if ((victim->hold1 != NULL && (victim->hold1->pIndexData->item_type == ITEM_WEAPON || victim->hold1->pIndexData->item_type == ITEM_GEM)) || (victim->hold2 && (victim->hold2->pIndexData->item_type == ITEM_WEAPON
|| victim->hold2->pIndexData->item_type == ITEM_GEM)))
          {
            send_to_char ("Are you CRAZY!? Tackle someone with a weapon!??\n\r", ch);
            send_to_char ("You'd surely get whacked on your approach...\n\r", ch);
            return;
          }
  }
check_same_side_pk(ch, victim);

/* ---------------------------------------------------------------- */
/*                Calculate chance to tackle here                   */
/* ---------------------------------------------------------------- */
chan = 20;
xn   = 0;

/* ---------------------------------- */
/* --------- Victim's Dex ----------- */
/* ---------------------------------- */
chan = get_curr_dex(ch) + (LEVEL(ch)/2);
chan -= get_curr_dex(victim);


/* ------------------------------------- */
/* --------- Char's Grapple  ----------- */
/* ------------------------------------- */
if (IS_PLAYER(ch) && ch->pcdata->learned[gsn_grapple] > 0)
  chan += (ch->pcdata->learned[gsn_grapple]/4);


/* ------------------------------------ */
/* --------- Char's Tackle  ----------- */
/* ------------------------------------ */
if (IS_PLAYER(ch) && ch->pcdata->learned[gsn_tackle] > 0)
  chan += (ch->pcdata->learned[gsn_tackle]/4);


/* ---------------------------------- */
/* ----------- Augments ------------- */
/* ---------------------------------- */
if (IS_AUGMENTED(ch, AUG_HAND_SPD)) chan += 10;
if (IS_AUGMENTED(ch, AUG_HAND_POWER)) chan += 10;
if (IS_AUGMENTED(ch, AUG_FOOT_SPD)) chan += 10;
if (IS_AUGMENTED(ch, AUG_LEG_SPD)) chan += 10;
if (IS_AUGMENTED(victim, AUG_FOOT_SPD)) chan -= 10;
if (IS_AUGMENTED(victim, AUG_LEG_SPD)) chan -= 10;
if (IS_PLAYER(victim) && check_skill(victim, gsn_steadiness))
  {
    chan -= (victim->pcdata->learned[gsn_steadiness]/3);
    skill_gain (victim, gsn_steadiness, TRUE);
  }

/* ---------------------------- */
/* --------- Guilds ----------- */
/* ---------------------------- */
if(is_member(ch,GUILD_WARRIOR))      chan += 10;
if(is_member(ch,GUILD_BATTLEMASTER)) chan += 10;
if(is_member(victim,GUILD_THIEFG))   chan -= 5;
if(is_member(victim,GUILD_ROGUE)) chan -= 5;


/* ---------------------------------- */
/* --------- Ground Fight ----------- */
/* ---------------------------------- */
if (victim->ced && IS_SET (victim->ced->fight_ops, F_GROUND))
  xn = 125;
else
  xn = 175;


/* ---------------------------------- */
/* ------------ Height -------------- */
/* ---------------------------------- */
chan += ch->height / 5;
chan -= victim->height / 5;


/* ---------------------------------- */
/* ------ Race Consideration -------- */
/* ---------------------------------- */
if (IS_PLAYER(ch) && (!str_cmp(race_info[ch->pcdata->race].name, "minotaur")
		  || !str_cmp(race_info[ch->pcdata->race].name, "gargoyle")))
     chan = UMAX(chan, 75);


/* ----------------------- */
/* ----- Skill gain? ----- */
/* ----------------------- */
if (number_range(1,10) == 1)
  skill_gain(ch, gsn_tackle, TRUE);


/* ------------------------------------------ */
/* --------- Now, see if they hit ----------- */
/* ------------------------------------------ */
if ((number_range (0, xn) > chan && IS_AWAKE (victim)) || (number_range(1,70) > ch->pcdata->learned[gsn_tackle]))
  {
    send_to_char ("You miss the tackle and almost fall on the ground!\n\r", ch);
    act ("$n tries to tackle you, but almost falls over instead!", ch, NULL, victim, TO_VICT);
    act ("$n misses a tackle at $N and almost falls over!", ch, NULL, victim, TO_NOTVICT);
    WAIT_STATE (ch, 2 * PULSE_VIOLENCE);
    if (FIGHTING (victim) == NULL)
      set_fighting (victim, ch);
    set_fighting (ch, victim);
    return;
  }
check_ced (victim);
check_ced (ch);
victim->ced->ground_pos = 0;
ch->ced->ground_pos = 0;
NEW_POSITION(victim, POSITION_GROUNDFIGHTING);
NEW_POSITION(ch, POSITION_GROUNDFIGHTING);
if (RIDING (victim) != NULL)
  {
    sprintf (buf, "As you jump up and tackle $N, $S flies off of %s and lands hard on the ground!", PERS (RIDING (victim), ch));
      act (buf, ch, NULL, victim, TO_CHAR);
      sprintf (buf, "$n's flying tackle makes $N fall off of %s. $N lands on his back on the ground.", NAME (RIDING (victim)));
      act (buf, ch, NULL, victim, TO_NOTVICT);
      sprintf (buf, "You fall off of %s as $n tackles you!", PERS (RIDING (victim), victim));
      act (buf, ch, NULL, victim, TO_VICT);
      check_fgt (victim->fgt->riding);
      victim->fgt->riding->fgt->mounted_by = NULL;
      victim->fgt->riding = NULL;
  }
else if (RIDING (victim) == NULL)
  {
    act ("You tackle $N! The fight is taken to the ground!", ch, NULL, victim, TO_CHAR);
    act ("$n tackles $N and they both end up on the ground!", ch, NULL, victim, TO_NOTVICT);
    act ("$n tackles you! The fight is taken to the ground!", ch, NULL, victim, TO_VICT);
  }
set_fighting (ch, victim);
set_fighting (victim, ch);
victim->fgt->fighting = ch;
ch->fgt->fighting = victim;
victim->ced->ground_pos = 0;
ch->ced->ground_pos = 0;
NEW_POSITION(victim, POSITION_GROUNDFIGHTING);
NEW_POSITION(ch, POSITION_GROUNDFIGHTING);
WAIT_STATE (victim, 2 * PULSE_VIOLENCE);
WAIT_STATE (ch, (3 * PULSE_VIOLENCE));
return;
}

void
violence_update (void)
{
  CHAR_DATA *ch;
  CHAR_DATA *ch_next;
  CHAR_DATA *victim;
  CHAR_DATA *rch;
  CHAR_DATA *rch_next;
  int posorg;
for (ch = f_first; ch != NULL; ch = ch_next)
  {
    if (ch->data_type==50)
      {
	fprintf(stderr,"That was it!\n");
	remove_from_fighting_list(ch);
	return;
      }
    if (FIGHTING(ch) && FIGHTING(ch)->data_type==50)
      {
	fprintf(stderr,"That was it2!\n");
	ch->fgt->fighting=NULL;
        update_pos(ch);
	return;
      }
    ch_next = ch->next_fighting;
    check_fgt (ch);
    check_ced(ch);
    ch->fgt->ears--;
    if (ch->fgt->ears <= 10)
      {
	ch->fgt->ears = 2;
	if (ch->position == POSITION_BASHED)
	  do_stand (ch, "");
      }
    if ((victim = FIGHTING(ch)) == NULL)
      {
	if (ch->position == POSITION_FIGHTING)
	    NEW_POSITION(ch, POSITION_STANDING);
	if (IS_MOB(ch))
	  {
	    if (IS_SET (ch->pIndexData->act, ACT_FASTHUNT) &&
		ch->fgt->hunting != NULL &&
		ch->position == POSITION_STANDING &&
		number_range (1, 3) == 2)
	      hunt_victim (ch);

	    if (IS_AFFECTED (ch, AFF_CHARM) &&
		ch->fgt->master != NULL &&
		ch->fgt->master->in_room == ch->in_room &&
		ch->fgt->master->fgt != NULL &&
		ch->fgt->master->fgt->fighting != NULL)
	      multi_hit (ch, ch->fgt->master->fgt->fighting, TYPE_UNDEFINED);
	    else
	      continue;
	  }
	else
	  continue;
      }
    if (victim == ch)
      {
	ch->fgt->fighting = NULL;
	ch->position = POSITION_STANDING;
      }
    else if (FIGHTING (victim) == NULL)
      {
	if (victim == NULL) return;
	check_fgt(victim);
	victim->fgt->fighting = ch;
      }
    if (IS_AWAKE (ch) && ch->in_room == victim->in_room)
      {
	if (IS_MOB (ch) && IS_SET (ch->act, ACT_MOBSWITCH))
	  {
	    CHAR_DATA *cir;
	    for (cir = ch->in_room->more->people; cir != NULL; cir = cir->next_in_room)
	      {
		if (FIGHTING (cir) == ch && number_range(1,7) == 3 && FIGHTING (ch) != cir)
		  {
		    act ("$n turns and attacks $N!", ch, NULL, cir, TO_NOTVICT);
		    act ("$n turns towards you and attacks!", ch, NULL, cir, TO_CHAR);
		    set_fighting (ch, cir);
		    break;
		  }
	      }
	  }
	posorg = victim->position;
	if (ch->fgt->challenge == 10 && number_range (1, 7) == 2)
	  {
	    char bufr[500];
	    sprintf (bufr, "($B$1Arena$N$7) $B%s: $4%s $7%s: $4%s", NAME (ch), STRING_HITS (ch), NAME (victim), STRING_HITS (victim));
	    do_arenaecho (ch, bufr, TRUE);
	  }
	if (ch != victim && ch->position == POSITION_GROUNDFIGHTING && victim->position == POSITION_GROUNDFIGHTING)
	  {
	    ground_hit (ch, victim, TYPE_UNDEFINED);
	    if (IS_PLAYER(ch) &&
		IS_AUGMENTED(ch, AUG_FACE_SPIKE) &&
		victim != NULL &&
		victim->data_type != 50 &&
		victim->hit > 10
		&& check_skill(ch, gsn_grapple)  &&
		number_range(1,4) == 3)
	      ground_hit(ch, victim, TYPE_UNDEFINED);
            if (IS_MOB(ch) && number_range(1,10) == 3)
                 do_stand(ch, "");
	  }
	else if (ch->position != POSITION_CASTING)
	  {
              if (ch->fgt->challenge == 10 && number_range (1, 5) == 2)
                {
                  char buf[200];
		  switch (number_range(1,5))
		    {
		    case 1:
		      sprintf (buf, "($B$1Arena$N$7) $BBlood runs freely as %s and %s exchange blows.", NAME (ch), NAME (victim));
		      break;
		    case 2:
		      sprintf (buf, "($B$1Arena$N$7) $BThe two fighters circle, flailing at each other wildly.");
		      break;
		    case 3:
		      sprintf (buf, "($B$1Arena$N$7) $BPieces of flesh fly every where as blows are exchanged.");
		      break;
		    case 4:
		      sprintf (buf, "($B$1Arena$N$7) $B%s lets out a loud warcry before attacking!", NAME (ch));
		      break;
		    case 5:
		      sprintf (buf, "($B$1Arena$N$7) $BYou can almost hear the crunching of bones...");
		      break;
		    }
		  do_arenaecho (ch, buf, TRUE);
		}

	      if (IS_MOB (ch) && ch->pIndexData && ch->pIndexData->opt)
                {
                  if (number_range (1, 101) < ch->pIndexData->opt->warrior_percent)
                    {
		      if (number_range(1,3) ==2)
			do_bash (ch, "");
		      else if (number_range(1,2) == 2)
			do_kick (ch, "");
		      else if (number_range(1,3) == 3)
			do_tackle (ch, "");
		      else if (number_range(1,2) == 2)
			do_flurry (ch, "");
		      else if (number_range(1,2) ==2)
			do_tackle (ch, "");
		      else if (number_range(1,3) == 3)
			do_flail (ch, "");
		      else do_kick(ch, "");
                    }
                  else
                    {
                      if (number_range (1, 101) < ch->pIndexData->opt->cast_percent)
                        {
                          int iil;
                          for (iil = 0; iil < 10; iil++)
                            {
                              if (number_range (1, 2) == 1 && ch->pIndexData->opt->cast_spells[iil] != NULL)
                                {
                                  SPELL_DATA *spl;
                                  if ((spl = skill_lookup (ch->pIndexData->opt->cast_spells[iil], -1)) == NULL)
                                    continue;
                                  if (LEVEL (ch) < spl->spell_level/3)
                                    continue;
                                  if (spl->spell_type == TAR_CHAR_DEFENSIVE ||
                                      spl->spell_type == TAR_CHAR_SELF)
                                    {
                                      general_spell (spl, LEVEL (ch),ch,ch);
                                    }
                                  else
                                    general_spell (spl, LEVEL (ch), ch,victim);
                                  break;
                                }
                            }
                        }
                    }
                }
	      if(number_range(1,4) == 2 &&  victim && IS_PLAYER(victim) && IS_PLAYER(ch))
		{
		  int i;
		  for (i = 0; i < 4; i ++)
		    {
		      CHAR_DATA *guarder;
		      if ((guarder = victim->pcdata->guarded_by[i]) != NULL &&
			  IS_PLAYER(guarder) &&
			  (guarder->pcdata->guarding == victim) &&
			  (guarder->in_room == victim->in_room))
			{
			  if (number_range(1,70) == 3)
			    skill_gain(guarder, gsn_guard, TRUE);
			  if(number_percent() < ch->pcdata->learned[gsn_guard])
			    {
			      act("$n heroically steps in front of $N!", guarder, NULL, victim, TO_NOTVICT);
			      act("You heroically step in front of $N", guarder, NULL, victim, TO_CHAR);
			      act("$n heroically steps in front of you", guarder, NULL, victim, TO_VICT);
			      check_fgt(ch);
			      ch->fgt->fighting = guarder;
			      break;
			    }
			}
		    }
		}
	      if ((victim = FIGHTING(ch)) == NULL)
		{
		  continue;
		}
	      multi_hit (ch, victim, TYPE_UNDEFINED);
	      if (FIGHTING (ch) && FIGHTING (FIGHTING (ch)) != ch && number_range (1, 2) == 2)
		continue;


	  }
	if (posorg == POSITION_CASTING && victim->position != POSITION_CASTING)
	  {
	    send_to_char ("OUCH! You just lost your concentration!\n\r", victim);
	    if (IS_PLAYER (victim))
	      victim->pcdata->tickcounts = 0;
	  }
      }
    else
      {
      stop_fighting (ch, FALSE);
      }
    if ((victim = FIGHTING (ch)) == NULL)
      continue;
    for (rch = ch->in_room->more->people; rch != NULL; rch = rch_next)
      {
	rch_next = rch->next_in_room;
        if ((victim = FIGHTING(ch)) == NULL) break;
	if (FIGHTING(rch) != NULL || !IS_AWAKE(rch)) continue;
	if ((IS_PLAYER (rch) || IS_AFFECTED (rch, AFF_CHARM))
	    && is_same_group (ch, rch)
	    && IS_SET (rch->pcdata->act2, PLR_ASSIST)
	    && IS_MOB (victim)
            && victim->position > POSITION_DEAD
            && victim->data_type != 50
	    && rch->position == POSITION_STANDING)
	  {
	    act ("You join the fight!", rch, NULL, rch, TO_CHAR);
	    act ("$n joins the fight!", rch, NULL, rch, TO_ROOM);
	    multi_hit (rch, victim, TYPE_UNDEFINED);
            if ((victim = FIGHTING(rch)) != NULL)
  	    set_fighting(rch,victim);
	  }

	if (IS_MOB (rch) && !IS_AFFECTED (rch, AFF_CHARM) && (rch->pIndexData == ch->pIndexData) &&LEVEL (rch) > 9 &&  can_see (rch, victim))
	  {
	    check_fgt (rch);
	    rch->fgt->fighting = victim;
	    NEW_POSITION(rch, POSITION_FIGHTING);
	    act ("$n CHARGES into battle!", rch, NULL, NULL, TO_ROOM);
	    multi_hit (rch, victim, TYPE_UNDEFINED);

	  }
	continue;
      }
  }
return;
}

void
do_circle (CHAR_DATA * ch, char *argy)
{
  SINGLE_OBJECT *obj;
  int dt;
  SPELL_DATA *spl;
  DEFINE_COMMAND ("circle", do_circle, POSITION_FIGHTING, 0, LOG_NORMAL,
"This command allows you to circle behind an opponent (who isn't fighting you), and thrust a dagger in his/her/its back during combat.")
    check_fgt (ch);
  if ((spl = skill_lookup ("Circle", -1)) == NULL)
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (ch->fgt->ears > 9)
    {
      send_to_char ("You can't circle this soon after giving or recieving a bash.\n\r", ch);
      return;
    }
  if (IS_MOB (ch))
    return;
  if (ch->pcdata->tickcounts > 3)
    {
      send_to_char ("You are off-balance from your last maneuver; you can't circle at the moment.\n\r", ch);
      return;
    }
  if (ch->wait > 1)
    return;
  if (ch->position != POSITION_FIGHTING)
    return;
  if (FIGHTING (ch) == NULL)
    return;
  if (FIGHTING (FIGHTING (ch)) == NULL)
    return;
  check_same_side_pk(ch, FIGHTING(ch));
  if (FIGHTING (FIGHTING (ch)) == ch)
    {
      send_to_char ("You can't circle around behind the mob who is fighting you!\n\r", ch);
      return;
    }
    if (ch->pcdata->learned[!gsn_circle] < 3)
    {
      send_to_char ("You do not know how to circle an opponent!\n\r", ch);
      return;
    } 
  if ((obj = get_item_held (ch, ITEM_WEAPON)) == NULL)
    {
      send_to_char ("You need to wield a weapon.\n\r", ch);
      return;
    }
  dt = ((I_WEAPON *) obj->more)->attack_type;
  if (attack_table[dt].hit_type != TYPE_PIERCE || !IS_OBJ_STAT(obj, ITEM_PIERCE))
    {
      send_to_char ("You need to wield a piercing weapon.\n\r", ch);
      return;
    }
  if (FIGHTING (ch)->position == POSITION_GROUNDFIGHTING)
    {
      send_to_char ("That person is entangled in mortal combat on the ground!!\n\r", ch);
      return;
    }
  check_ced (ch);
  check_ced (FIGHTING (ch));
  if (!(IS_IN_MELEE (ch, FIGHTING (ch))))
    {
      send_to_char ("You aren't on the front lines of that battle!\n\r", ch);
      return;
    }
  send_to_char ("You start to circle around your victim...\n\r", ch);
  ch->pcdata->tickcounts = spl->mana;   /*13; */
  NEW_POSITION(ch, POSITION_CIRCLE);
  return;
}

void
do_actual_circle (CHAR_DATA * ch, char *argy, bool used_flash)
{
  SINGLE_OBJECT *obj;
  int dt;
  CHAR_DATA *c;
  DESCRIPTOR_DATA *d;
  SPELL_DATA *spl;
  if (IS_MOB (ch))
    return;
  if (ch->wait > 1)
    return;
  if (FIGHTING (ch) == NULL)
    return;
  if (FIGHTING (FIGHTING (ch)) == NULL)
    return;
  if (ch->position != POSITION_CIRCLE && !used_flash)
    return;
  NEW_POSITION(ch, POSITION_STANDING);
  if (IS_PLAYER (ch) && number_range(1,8) == 3)
   {
     skill_gain (ch, gsn_circle, TRUE);
     skill_gain (ch, gsn_backstab, TRUE);
   }
  if ((spl = skill_lookup ("Circle", -1)) == NULL)
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (FIGHTING (FIGHTING (ch)) == ch && !used_flash)
    {
      send_to_char ("You can't circle around behind the mob who is fighting you!\n\r", ch);
      return;
    }
   if (ch->pcdata->learned[gsn_circle] < 2)
    {
      send_to_char ("You do not know how to circle an opponent!\n\r", ch);
      return;
    }
  if ((obj = get_item_held (ch, ITEM_WEAPON)) == NULL)
    {
      send_to_char ("You need to wield a weapon.\n\r", ch);
      return;
    }
  dt = ((I_WEAPON *) obj->more)->attack_type;
  if (attack_table[dt].hit_type != TYPE_PIERCE || !IS_OBJ_STAT(obj, ITEM_PIERCE))
    {
      send_to_char ("You need to wield a piercing weapon.\n\r", ch);
      return;
    }
  if (FIGHTING (ch)->position == POSITION_GROUNDFIGHTING)
    {
      send_to_char ("That person is entangled in mortal combat on the ground!!\n\r", ch);
      return;
    }
  for (d = descriptor_list; d != NULL; d = d->next)
    {
      if (!d->character || d->connected != CON_PLAYING)
        continue;
      c = d->character;
      if (FIGHTING (c) == FIGHTING (ch) && c->position == POSITION_CIRCLE && !used_flash)
        {
          act ("$B$4You bump into $N, who is also trying to circle at the same time!", ch, NULL, c, TO_CHAR);
          act ("$B$4$n bumps into $N, who are both trying to circle at the same time!  What fools!", ch, NULL, c, TO_NOTVICT);
          act ("$B$4$n bumps into you as you both crowd behind the same mob, trying to circle!", ch, NULL, c, TO_VICT);
          NEW_POSITION(c, POSITION_FIGHTING);
          free_temp (c);
          SUBHIT(c,4);
          SUBHIT(ch,5);
          return;
        }
    }
  if (IS_PLAYER(FIGHTING(ch)) && number_range(1,12) == 3 &&
       number_percent() < FIGHTING(ch)->pcdata->learned[gsn_awareness])
    {
      act("$n just tried to circle you!", ch, NULL, FIGHTING(ch), TO_VICT);
      act("You try to circle $N, but $E notices.", ch, NULL, FIGHTING(ch), TO_CHAR);
      skill_gain(FIGHTING(ch), gsn_awareness, TRUE);
      return;
    }
  if (number_range (0, 104) < ch->pcdata->learned[gsn_circle])
    {
      set_fighting (FIGHTING (ch), ch);
      set_fighting (ch, FIGHTING (ch));
      if (IS_PLAYER (ch))
        ch->pcdata->tickcounts = spl->casting_time;
      one_hit(ch, FIGHTING(ch), gsn_circle, obj);
      if (is_member(ch, GUILD_THIEFG) &&
	  is_member(ch, GUILD_ROGUE) &&
          FIGHTING(ch) != NULL
	  && FIGHTING(ch)->data_type != 50 &&
	  number_percent () < ((get_curr_dex(ch)-34)*2 + (IS_AUGMENTED(ch,AUG_HAND_SPD) ? 2 : 0)))
	one_hit (ch, FIGHTING(ch), gsn_circle, obj);
      return;
    }
  else
    send_to_char ("You failed to circle your opponent.\n\r", ch);
  return;
}

void
check_pkill (CHAR_DATA * ch, CHAR_DATA * victim)
{
  if (CHALLENGE (ch) == 10 || (IN_BATTLE (ch)))
    return;
  return;
}

void
multi_hit (CHAR_DATA * ch, CHAR_DATA * victim, int dt)
{
  int chance;
  int gmembers;
  bool second;
  CHAR_DATA *vch;
  SINGLE_OBJECT *wield1;
  SINGLE_OBJECT *wield2;
  second = FALSE;
  CHECK_CHAR (ch);
  CHECK_CHAR (victim);
  check_fgt (ch);
  check_fgt (victim);
/* Not in same room */
  if (ch->in_room != victim->in_room)
    {
      ch->fgt->fighting=NULL;
      victim->fgt->fighting=NULL;
      ch->position=POSITION_STANDING;
      victim->position=POSITION_STANDING;
      return;
    }
  check_ced (ch);
  check_ced (victim);
  add_to_fighting_list (ch);
  add_to_fighting_list (victim);
  if (is_safe (ch, victim))
    {
      return;
    }
  if (IS_MOB (ch) && (ch->pIndexData->mobtype == MOB_DUMMY))
    {
      return;

  }


  check_same_side_pk(ch, victim);
  if (ch->position == POSITION_SLEEPING)
    {
    return;
    }
  if (victim == NULL || victim->data_type == 50)
    {
    return;
    }
  if (ch->position <= POSITION_STUNNED && ch->position >= 0)
    return;
  if (victim->position == POSITION_DEAD)
    {
      stop_fighting (ch, TRUE);
      ch->wait = 0;
      stop_fighting (victim, TRUE);
    }
  if (IS_MOB (victim) && IS_SET (victim->act, ACT_UNTOUCHABLE))
    {
      send_to_char ("Your physical attacks don't seem to hurt this creature!\n\r", ch);
      return;
    }
  wield1 = ((ch->hold1 != NULL && ch->hold1->pIndexData->item_type ==
	     ITEM_WEAPON) ? ch->hold1 : NULL);
  wield2 = ((ch->hold2 != NULL && ch->hold2->pIndexData->item_type ==
	     ITEM_WEAPON) ? ch->hold2 : NULL);
  if (wield2 && !wield1)
    {
      wield1 = wield2;
      wield2 = NULL;
    }

  if (IS_MOB (victim) && (victim->pIndexData->mobtype == MOB_GHOST))
    {
      bool can_hit_it;
      can_hit_it = FALSE;
      if (wield1 && (IS_OBJ_STAT (wield1, ITEM_GLOW) || IS_OBJ_STAT (wield1, ITEM_HUM)))
	can_hit_it = TRUE;
      else if (wield2 && (IS_OBJ_STAT (wield2, ITEM_GLOW) || IS_OBJ_STAT (wield2, ITEM_HUM)))
	can_hit_it = TRUE;
      if (is_member(ch, GUILD_MONK))
        can_hit_it = TRUE;
      if (!can_hit_it)
	{
	  send_to_char ("Your attack goes right through your victim as if it was not there!\n\r", ch);
	  return;
	}
    }


  /* Kill self capabilities here */
  if (pow.can_fight_self)
    {
      if (IS_PLAYER (ch) && ch->desc != NULL && FIGHTING (ch) == NULL)
	{
	  write_to_descriptor2 (ch->desc, "\n\r", 2);
	  ch->fgt->fighting = victim;
	}
      else
	{
	  check_fgt (ch);
	  ch->fgt->fighting = victim;
	}
    }
  if (FIGHTING (victim) == NULL)
    {
      ch->ced->attackers[0] = victim;
      victim->ced->attackers[0] = ch;
      victim->fgt->fighting = ch;
    }
  if (ch == FIGHTING (victim) && !(IS_IN_MELEE (ch, victim)))
    {
      /*victim is being hit, but not in melee?? */
      victim->ced->attackers[0] = ch;       /*Set him in position 1 attacking */
    }
  for (vch = victim->in_room->more->people; vch != NULL; vch = vch->next_in_room)
    {
      if (FIGHTING (vch) == victim)
	{
	  check_ced (vch);
	  if (!IS_IN_MELEE (vch, victim))
	    {
	      for (gmembers = 0; gmembers < 4; gmembers++)
		{
		  if (victim->ced->attackers[gmembers] == NULL ||
		      victim->ced->attackers[gmembers]->in_room != victim->in_room)
		    {
		      victim->ced->attackers[gmembers] = vch;
		      break;
		    }
		}
	    }
	}
    }

  if (!IS_IN_MELEE (ch, victim) && wield1 != NULL && !IS_OBJ_STAT(wield1, ITEM_POLEARM))
    {
      send_to_char ("\x1B[1;35m<-> (\x1B[32mYou are not within melee range\x1B[35m) <->\x1B[0;37m\n\r", ch);
      return;
    }
  if (ch->fgt->combat_delay_count <= -5)
    {
      ch->fgt->combat_delay_count--;
      if (ch->fgt->combat_delay_count < -8)
	ch->fgt->combat_delay_count = -1;
    }
  if (ch->fgt->combat_delay_count > 0)
    {
      ch->fgt->combat_delay_count--;
      return;
    }
  if (ch->position != POSITION_BASHED && ch->fgt->combat_delay_count == 0)
    {
      ch->fgt->combat_delay_count = -1;
      ch->fgt->ears = 2;
      send_to_char ("You scramble to your feet!\n\r", ch);
      act ("$n stands up quickly, trying not to get whacked again!", ch, NULL, NULL, TO_ROOM);
      NEW_POSITION(ch, POSITION_FIGHTING);
    }
  if (IS_MOB (ch) && ch->position == POSITION_BASHED && ch->fgt->combat_delay_count < 1)
    {
      ch->fgt->combat_delay_count = -5;
      ch->fgt->ears = 2;
      send_to_char ("You scramble to your feet!\n\r", ch);
      act ("$n stands up, trying not to get bashed down again!", ch, NULL, NULL, TO_ROOM);
      NEW_POSITION(ch, POSITION_FIGHTING);
    }
  if (ch->position == POSITION_BASHED)
    {
      update_pos (ch);
      return;
    }
  if (ch->fgt->combat_delay_count < 1 && ch->position == POSITION_STANDING)
    {
      NEW_POSITION(ch, POSITION_FIGHTING);
    }
  if (number_range (1, 40) == 3 && RIDING (ch) == NULL &&
      can_groundfight (ch) && can_groundfight (victim)
      && ch->hit < ch->max_hit/2)
    {
      if (number_range (1, 2) == 1 ||
	  FIGHTING (victim) != ch ||
	  !IS_SET (ch->ced->fight_ops, F_GROUND) ||
	  !IS_SET (victim->ced->fight_ops, F_GROUND) ||
	  LEVEL (ch) < 10 || LEVEL (victim) < 10 ||
	  victim->position == POSITION_GROUNDFIGHTING ||
	  ch->position == POSITION_GROUNDFIGHTING)
	{
	  act ("You slip on a pool of blood that has formed on the ground here!\n\rYou hit your head hard as your face meets the ground!", ch, NULL, victim, TO_CHAR);
	  act ("$n slips on a pool of blood and falls on $s face!", ch, NULL, victim, TO_ROOM);
	  SUBHIT(ch,(7 + (UMIN (10, LEVEL (ch) / 7))));
	  WAIT_STATE (ch, PULSE_VIOLENCE);
	  return;
	}
      else
	{
	  act ("You slip on some blood and $N falls on top of you!", ch, NULL, victim, TO_CHAR);
	  act ("$n slips on some blood and drags $N down too!", ch, NULL, victim, TO_NOTVICT);
	  act ("$n slips on a pool of blood on the ground, but as $n\n\rgoes down, $n grabs you, taking you down too!", ch, NULL, victim, TO_VICT);
	  act ("The fight is taken to the ground!", ch, NULL, victim, TO_ROOM);
	  act ("The fight is taken to the ground!", ch, NULL, victim, TO_CHAR);
	  NEW_POSITION(ch, POSITION_GROUNDFIGHTING);
	  NEW_POSITION(victim, POSITION_GROUNDFIGHTING);
	  WAIT_STATE (ch, PULSE_VIOLENCE);
	  WAIT_STATE (victim, PULSE_VIOLENCE);
	  return;
	}
    }
  one_hit (ch, victim, dt, wield1);
  if (IS_AFFECTED_EXTRA (ch, AFF_SPEED) && number_range(1,2) == 2)
      one_hit (ch, victim, dt, wield1);
  if (is_member(ch, GUILD_MONK))
  {
    if (number_range(1,4) == 2 && ch->pcdata->learned[gsn_unarmed] > 85)
      one_hit (ch, victim, dt, wield1);
    if (number_range(1,4) == 2 && ch->pcdata->stance != 2)
      one_hit (ch, victim, dt, wield1);
    if (number_range(1,4) == 2 && 
       (ch->pcdata->stance == 1 || ch->pcdata->stance == 4 || 
        ch->pcdata->stance == 7) )
      one_hit (ch, victim, dt, wield1);
    if (number_range(1,4) == 2 && ch->pcdata->stance == 4)
      one_hit (ch, victim, dt, wield1);
    if (number_range(1,4) == 2 && ch->pcdata->stance == 4)
      one_hit (ch, victim, dt, wield1);
  }    
  if (is_member(ch, GUILD_MONK) && number_range(1,40) == 2 && 
      IS_SET(ch->pcdata->elemental_alignment, ELEMENTAL_ALIGN_FIRE) &&
      victim->hit > 10 )
  {
      act ("$B$0Your fist unleashes a ball of $B$4fire $B$0at $N!", ch, NULL, victim, TO_CHAR);
      act ("$B$0A loose $B$4fireball $B$0leaps from $n's fist!", ch, NULL, victim, TO_VICT);
      act ("$B$0$n's fist explodes in $B$4fire $B$0at $N!", ch, NULL, victim, TO_NOTVICT);
      show_hitdam(gsn_shoot, "shot", 60, ch, victim);
      damage(ch, victim, 40, gsn_shoot);
  }
  if (is_member(ch, GUILD_MONK) && number_range(1,40) == 2 && 
      IS_SET(ch->pcdata->elemental_alignment, ELEMENTAL_ALIGN_EARTH) &&
      victim->hit > 10 )
  {
      act ("$B$0Your foot launches a $R$2huge rock $B$0at $N!", ch, NULL, victim, TO_CHAR);
      act ("$B$0A $R$2huge rock $B$0surges from $n's foot!", ch, NULL, victim, TO_VICT);
      act ("$B$0$n's foot kicks up a $R$2huge rock $B$0at $N!", ch, NULL, victim, TO_NOTVICT);
      show_hitdam(gsn_shoot, "shot", 60, ch, victim);
      damage(ch, victim, 40, gsn_shoot);
  }
  if (is_member(ch, GUILD_MONK) && number_range(1,40) == 2 && 
      IS_SET(ch->pcdata->elemental_alignment, ELEMENTAL_ALIGN_AIR) &&
      victim->hit > 10 )
  {
      act ("$B$0Your fist sends a tornado of $B$3air $B$0at $N!", ch, NULL, victim, TO_CHAR);
      act ("$B$0A tornado of $B$3air $B$0leaps from $n's fist!", ch, NULL, victim, TO_VICT);
      act ("$B$0$n's fist creates a tornado of $B$3air $B$0at $N!", ch, NULL, victim, TO_NOTVICT);
      show_hitdam(gsn_shoot, "shot", 60, ch, victim);
      damage(ch, victim, 40, gsn_shoot);
  }
  if (is_member(ch, GUILD_MONK) && number_range(1,40) == 2 && 
      IS_SET(ch->pcdata->elemental_alignment, ELEMENTAL_ALIGN_WATER) &&
      victim->hit > 10 )
  {
      act ("$B$0Your elbow strike summons a bolt of $B$1lightning$B$0!", ch, NULL, victim, TO_CHAR);
      act ("$B$0A bolt of $B$1lightning $B$0arcs from $n's elbow strike!", ch, NULL, victim, TO_VICT);
      act ("$B$0$n's elbow strike explodes in $B$1lightning$B$0!", ch, NULL, victim, TO_NOTVICT);
      show_hitdam(gsn_shoot, "shot", 60, ch, victim);
      damage(ch, victim, 40, gsn_shoot);
  }
  if (FIGHTING(ch) != victim)
    return;
  if (wield2 && IS_PLAYER(ch) &&
      number_percent() < ch->pcdata->learned[571]*3/5)
    {
      one_hit (ch, victim, dt, wield2);
      if (FIGHTING(ch) != victim)
        return;
      skill_gain(ch, 571, TRUE);
      if (is_member(ch, GUILD_WARRIOR) && is_member(ch,GUILD_BATTLEMASTER) && number_range(1,7) == 2)
	{
	  one_hit (ch, victim, dt, wield2);
	   if (FIGHTING(ch) != victim)
	     return;
	  skill_gain(ch, 571, TRUE);
	}
    }

  chance = IS_MOB (ch) ? LEVEL (ch) / 4 :
    ((ch->pcdata->learned[gsn_second_attack]*3/5)); /* JRAJRA were 4 */
  if (number_percent () < chance)
    {
      one_hit (ch, victim, dt, wield1);
      if (FIGHTING(ch) != victim)
       return;
      if (IS_PLAYER (ch))
	skill_gain (ch, gsn_second_attack, TRUE);
    }
  chance = (IS_MOB (ch) ? LEVEL (ch) / 5 :
    ch->pcdata->learned[gsn_third_attack]/2); /* JRAJRA was 4 */
  if (number_percent () < chance)
    {
      one_hit (ch, victim, dt, wield1);
      if (FIGHTING(ch) != victim)
        return;
      if (IS_PLAYER (ch))
	skill_gain (ch, gsn_third_attack, TRUE);
    }

  if (victim->position == POSITION_RESTING || victim->position == POSITION_SLEEPING || victim->position == POSITION_STANDING)
    {
      set_fighting (victim, ch);
    }
  return;
}


/* This is the new check parry/dodge/shieldblock code which comes in BEFORE
   all the damage and crap are calculated. */

bool
check_defense (CHAR_DATA * ch, CHAR_DATA * victim)
{
  int chance;
  CHAR_DATA *fch;
  int number = 0;
  check_ced(victim);
  if (victim->move <= 6)
    return FALSE;
  if (!IS_AWAKE (victim) || victim->position <= POSITION_STUNNED)
    return FALSE;
  if ((IS_AFFECTED (ch, AFF_INVISIBLE) &&
       !IS_AFFECTED (victim, AFF_DETECT_INVIS)) || IS_AFFECTED(victim, AFF_BLIND))
    {
      if(number_range(1,10) == 3)
	act ("You try to defend yourself, but you can't see your opponent!", victim, NULL, ch, TO_CHAR);
      return FALSE;
    }
  for (fch = ch->in_room->more->people; fch != NULL; fch = fch->next_in_room)
    {
      if (FIGHTING(fch) == victim)
	number++;
    }
  if (number < 1)
    number = 1;
  if ((victim->hold1 != NULL && victim->hold1->pIndexData->item_type == ITEM_WEAPON) ||
      (victim->hold2 != NULL && victim->hold2->pIndexData->item_type == ITEM_WEAPON))
    {
      if (IS_MOB (victim))
	chance = (LEVEL (victim)*3/2)/number;
      else
	{
	  chance = (victim->pcdata->learned[gsn_parry]+
		    (is_member (victim, GUILD_WARRIOR) ? 30 : 0)+
		    (is_member (victim, GUILD_BATTLEMASTER) ? 30 : 0)+
		    (IS_AUGMENTED(victim, AUG_BODY_POWER) ? 12 : 0)+
		    (IS_AUGMENTED(victim, AUG_ARM_POWER) ? 12 : 0)+
		    (IS_AUGMENTED(victim, AUG_HAND_SPD) ? 100 : 0)+
		    (IS_AUGMENTED(victim, AUG_HAND_POWER) ? 12 : 0))/number;
	}
      if (number_range (1, 900) < UMIN(170, chance))
	{
	  if (number_range (1, 2) == 2)
	    {
	    }
	  else
	    {
	      act ("You forcefully deflect $n's blade, parrying the attack.", ch, NULL, victim, TO_VICT);
	      act ("$N forcefully deflects your blade, parrying the attack.", ch, NULL, victim, TO_CHAR);
	      act ("$N deflects $n's attack with his weapon.", ch, NULL, victim, TO_NOTVICT);
	    }

	  if (number_range (1, 3) == 2)
	    skill_gain (victim, 566, TRUE);
	  SUBMOVE(victim,1);
	  return TRUE;
	}
    }
  /* Failed Parry, now check dodge. */

  if (IS_MOB (victim))
    chance = (LEVEL (victim) * 3/2) / (number);
  else
    {
      chance = ((victim->pcdata->learned[gsn_dodge]) +
		(is_member (victim, GUILD_THIEFG) ? 44 : 0) +
		(IS_AUGMENTED(victim, AUG_LEG_SPD) ? 30 : 0) +
		(IS_AUGMENTED(victim, AUG_FOOT_SPD) ? 30 : 0))/number;
      chance -= ((victim->pcdata->carry_weight/get_curr_str(victim)));
      if (is_member(ch, GUILD_MONK))
        {
          if (ch->pcdata->stance == 1)
            chance -= 40;
          else if (ch->pcdata->stance == 4)
            chance -= 20;
          else if (ch->pcdata->stance == 5)
            chance += 20;
          else if (ch->pcdata->stance == 8)
            chance += 40;
        }
/* This takes into account the *10 from the new weight code and the
  desire to subtract 10 points for each multi of str carried...*/
    }

  if (number_range (0, 400) < UMIN(180, chance))
    {
      if (victim->position != POSITION_BASHED)
        {
          if (number_range (1, 2) == 2)
            {
              act ("You step aside, dodging $n's attack.", ch, NULL, victim, TO_VICT);
              act ("$N quickly steps aside, dodging your attack.", ch, NULL, victim, TO_CHAR);
              act ("$N steps aside, dodging $n's attack.", ch, NULL, victim, TO_NOTVICT);
            }
          else
            {
              if (number_range (1, 2) == 2)
                {
                  act ("You duck right, dodging $n's attack.", ch, NULL, victim, TO_VICT);
                  act ("$N ducks right, dodging your attack.", ch, NULL, victim, TO_CHAR);
                  act ("$N ducks right, dodging $n's attack.", ch, NULL, victim, TO_NOTVICT);
                }
              else
                {
                  act ("You duck left, dodging $n's attack.", ch, NULL, victim, TO_VICT);
                  act ("$N ducks left, dodging your attack.", ch, NULL, victim, TO_CHAR);
                  act ("$N ducks left, dodging $n's attack.", ch, NULL, victim, TO_NOTVICT);
                }
            }
        }
      else
        {
          act ("You roll out of the way of $n's attack.", ch, NULL, victim, TO_VICT);
          act ("$N rolls out of the way of your attack.", ch, NULL, victim, TO_CHAR);
          act ("$N rolls out of the way of $n's attack.", ch, NULL, victim, TO_NOTVICT);
        }
      if (number_range (1, 4) == 2)
        skill_gain (victim, 555, TRUE);
      SUBMOVE(victim,1);
      return TRUE;
    }

  /* Failed dodge, now check evade. */

if (IS_PLAYER(victim) && is_member(victim, GUILD_MONK))
{
  if (IS_MOB (victim))
    chance = (LEVEL (victim) * 3/2) / (number);
  else
    {
      chance = ((victim->pcdata->learned[gsn_evade] - 68) +
		(IS_AUGMENTED(victim, AUG_LEG_SPD) ? 5 : 0) +
		(IS_AUGMENTED(victim, AUG_FOOT_SPD) ? 5 : 0) +
                3*((get_curr_str(victim) + get_curr_dex(victim) + get_curr_wis(victim))/3 - 20));
      if (ch->pcdata->stance == 1)
        chance -= 15;
      else if (ch->pcdata->stance == 4)
        chance -= 10;
      else if (ch->pcdata->stance == 5)
        chance += 10;
      else if (ch->pcdata->stance == 8)
        chance += 15;
    }

  if (number_range (0, 100) < chance)
    {
      if (victim->position != POSITION_BASHED)
        {
          if (number_range (1, 2) == 2)
            {
              act ("You bend backward, evading $n's attack.", ch, NULL, victim, TO_VICT);
              act ("$N quickly bends backward, evading your attack.", ch, NULL, victim, TO_CHAR);
              act ("$N bends backward, evading $n's attack.", ch, NULL, victim, TO_NOTVICT);
            }
          else
            {
              if (number_range (1, 2) == 2)
                {
                  act ("You leap high, evading $n's attack.", ch, NULL, victim, TO_VICT);
                  act ("$N leaps high, evading your attack.", ch, NULL, victim, TO_CHAR);
                  act ("$N leaps high, evading $n's attack.", ch, NULL, victim, TO_NOTVICT);
                }
              else
                {
                  act ("You duck low, evading $n's attack.", ch, NULL, victim, TO_VICT);
                  act ("$N duck low, evading your attack.", ch, NULL, victim, TO_CHAR);
                  act ("$N duck low, evading $n's attack.", ch, NULL, victim, TO_NOTVICT);
                }
            }
        }
      else
        {
          act ("Even bashed, you manage to evade $n's attack.", ch, NULL, victim, TO_VICT);
          act ("$N evades your attack even while bashed.", ch, NULL, victim, TO_CHAR);
          act ("$N evades $n's attack, even while bashed.", ch, NULL, victim, TO_NOTVICT);
        }
      if (number_range (1, 4) == 2)
        skill_gain (victim, 560, TRUE);
      SUBMOVE(victim,1);
      return TRUE;
    }
} /* END EVADE CHECK */

  /* Failed dodge, now check shield block */

  if (IS_PLAYER(victim)  && IS_SET(victim->act, PLR_HAS_SHIELD))
    {
      chance = (victim->pcdata->learned[gsn_shield_block] +
		(IS_AUGMENTED(victim, AUG_ARM_POWER) ? 20 : 0)+
		(is_member(victim, GUILD_RANGER) ? 50 : 0)+
		(IS_AUGMENTED(victim, AUG_BODY_POWER) ? 20 : 0))/number;

      if (number_range (1, 950) < chance)
	{
	  act ("You block $n's attack with your shield.", ch, NULL, victim, TO_VICT);
	  act ("$N blocks your attack with $S shield.", ch, NULL, victim, TO_CHAR);
	  act ("$N blocks $n's attack with $S shield.", ch, NULL, victim, TO_NOTVICT);
	  skill_gain (victim, gsn_shield_block, TRUE);
	  if (number_range (1, 15) == 2)
	    {
	      int dam;
	      act ("You slam into $n with your shield.", ch, NULL, victim, TO_VICT);
	      act ("$N slams into you with $s shield.", ch, NULL, victim, TO_CHAR);
	      act ("$N slams $S shield into $n's body.", ch, NULL, victim, TO_NOTVICT);
	      dam = ((get_curr_str (ch)) / (number_range (2, 5)));
	      SUBHIT(victim,dam);
	      if (victim->hit < 1)
		victim->hit = 1;
	    }
	  return TRUE;
	}
    }
  if ((IS_MOB(victim) && LEVEL(victim) > IMM_LEVEL) || (IS_PLAYER(victim)))
    {
      int chance = 0;
      if (IS_PLAYER(victim))
	{
	  if(!IS_SET(victim->pcdata->act2, PLR_AUTOBLINK) || victim->pcdata->n_mana < 5)
	    return FALSE;

	  chance = UMAX(0, (get_curr_int(victim)+get_curr_wis(victim) - 42));
	  if (is_member(victim, GUILD_WIZARD)) chance += 3;
	  if (is_member(victim, GUILD_HEALER)) chance += 3;
	  if (is_member(victim, GUILD_CONJURER)) chance += 3;
	  if (is_member(victim, GUILD_MYSTIC)) chance += 3;
	  chance *=  UMAX(0, victim->pcdata->learned[gsn_blink]/8);
	}
      else
	{
	  if (victim->pIndexData->opt != NULL)
	    chance = LEVEL(victim)/2;
	}
      if (number_range(1,900) < UMIN(320, chance))
	{
	  act ("$B$3You blink out of the way of $n's attack.$R$7", ch, NULL, victim, TO_VICT);
	  act ("$B$3$N blinks out of the way of your attack.$R$7", ch, NULL, victim, TO_CHAR);
	  act ("$B$3$N blinks out of the way of $n's attack.$R$7", ch, NULL, victim, TO_NOTVICT);
	  if (IS_PLAYER(victim))
	    {
	      victim->pcdata->n_mana--;
	      if (number_range(1,37) == 3)
		skill_gain (victim, gsn_blink, TRUE);
	    }
	  return TRUE;
	}
    }
  return FALSE;
}




int
addoffense (CHAR_DATA * ch, SINGLE_OBJECT * obj)
{
  if (IS_MOB (ch))
    return 0;
  if (obj == NULL || obj->pIndexData->item_type != ITEM_WEAPON) return 0;
  if (IS_SET (obj->extra_flags, ITEM_POLEARM))
    {
      skill_gain(ch, gsn_polearm, TRUE);
      return (ch->pcdata->learned[gsn_polearm] == -100 ? -30 : (-20+ch->pcdata->learned[gsn_polearm] / 7));
    }
  else if (IS_SET (obj->extra_flags, ITEM_PIERCE))
    {
      skill_gain (ch, gsn_pierce, TRUE);
      return (ch->pcdata->learned[gsn_pierce] == -100 ? 0 : ch->pcdata->learned[gsn_pierce] / 4);
    }
  else if (IS_SET (obj->extra_flags, ITEM_CONCUSSION))
    {
      skill_gain (ch, gsn_concussion, TRUE);
      return (ch->pcdata->learned[gsn_concussion] == -100 ? 0 : ch->pcdata->learned[gsn_concussion] / 5);
    }
  else if (IS_SET (obj->extra_flags, ITEM_WHIP))
    {
      skill_gain (ch, gsn_whip, TRUE);
      return (ch->pcdata->learned[gsn_whip] == -100 ? 0 : ch->pcdata->learned[gsn_whip] / 4);
    }
  else if (ch->pcdata->learned[gsn_slashing] == -100)
    return 0;
  else if (IS_SET (obj->extra_flags, ITEM_HEAVY_SLASH))
    {
      skill_gain (ch, gsn_slashing, TRUE);
      if (get_curr_str (ch) < 11)
        return -3;
      if (get_curr_str (ch) < 16)
        return 0;
      if (get_curr_str (ch) < 18)
        return (ch->pcdata->learned[gsn_slashing] / 7);
      if (get_curr_str (ch) < 21)
        return (ch->pcdata->learned[gsn_slashing] / 6);
      if (get_curr_str (ch) < 24)
        return (ch->pcdata->learned[gsn_slashing] / 5);
      else
        return (ch->pcdata->learned[gsn_slashing] / 4);
    }
  else if (IS_SET (obj->extra_flags, ITEM_LIGHT_SLASH))
    {
      skill_gain (ch, gsn_slashing, TRUE);
      return ((ch->pcdata->learned[gsn_slashing] / 4) + ((get_curr_str (ch) - 5) / 2));
    }
  else if (IS_SET (obj->extra_flags, ITEM_SLASHING))
    {
      skill_gain (ch, gsn_slashing, TRUE);
      return (ch->pcdata->learned[gsn_slashing] / 5);
    }
  return 0;
}
int
addoffense2 (CHAR_DATA * ch, SINGLE_OBJECT * obj)
{
  if (IS_MOB (ch))
    return 0;
  if (obj == NULL || obj->pIndexData->item_type != ITEM_WEAPON) return 0;
  if (IS_SET (obj->extra_flags, ITEM_POLEARM))
    return (ch->pcdata->learned[gsn_polearm] == -100 ? -30 : (-20+ch->pcdata->learned[gsn_polearm] / 7));
  else if (IS_SET (obj->extra_flags, ITEM_PIERCE))
    return (ch->pcdata->learned[gsn_pierce] == -100 ? 0 : ch->pcdata->learned[gsn_pierce] / 4);
  else if (IS_SET (obj->extra_flags, ITEM_CONCUSSION))
    return (ch->pcdata->learned[gsn_concussion] == -100 ? 0 : ch->pcdata->learned[gsn_concussion] / 5);
  else if (IS_SET (obj->extra_flags, ITEM_WHIP))
    return (ch->pcdata->learned[gsn_whip] == -100 ? 0 : ch->pcdata->learned[gsn_whip] / 4);
  else if (ch->pcdata->learned[gsn_slashing] == -100)
    return 0;
  else if (IS_SET (obj->extra_flags, ITEM_HEAVY_SLASH))
    {
      if (get_curr_str (ch) < 11)
        return -3;
      if (get_curr_str (ch) < 16)
        return 0;
      if (get_curr_str (ch) < 18)
        return (ch->pcdata->learned[gsn_slashing] / 7);
      if (get_curr_str (ch) < 21)
        return (ch->pcdata->learned[gsn_slashing] / 6);
      if (get_curr_str (ch) < 24)
        return (ch->pcdata->learned[gsn_slashing] / 5);
      else
        return (ch->pcdata->learned[gsn_slashing] / 4);
    }
  else if (IS_SET (obj->extra_flags, ITEM_LIGHT_SLASH))

    return ((ch->pcdata->learned[gsn_slashing] / 4) + ((get_curr_str (ch) - 5) / 2));
  else if (IS_SET (obj->extra_flags, ITEM_SLASHING))

    return (ch->pcdata->learned[gsn_slashing] / 5);
  return 0;
}

void
one_hit (CHAR_DATA * ch, CHAR_DATA * victim, int dt, SINGLE_OBJECT * wield)
{
  SINGLE_OBJECT *armor;
  int to_hit;
  int bonushit;
  int dam = 0;
  int damm = 0;
  int iWear;
  int hit_pos;
  int minShieldDamage = 1;
  int maxShieldDamage = 1;
  bonushit = 0;
  CHECK_CHAR (ch);
  CHECK_CHAR (victim);

  check_ced (ch);
  check_ced (victim);
  check_fgt (ch);
  check_fgt (victim);

  /* dont hit if you are a dummy mob */
  if (IS_MOB (ch) && (ch->pIndexData->mobtype == MOB_DUMMY)) {
    return;
  }
/*
  if(IS_MOB (ch)) send_to_char("Its a mob\n\r",victim);
  if(ch->pIndexData->mobtype == MOB_DUMMY) send_to_char("Its a dummy\n\r",victim);
*/
  if (ch->in_room != victim->in_room || victim->position == POSITION_DEAD)
    {
      ch->fgt->fighting=NULL;
      victim->fgt->fighting=NULL;
      ch->position=POSITION_STANDING;
      victim->position=POSITION_STANDING;
      return;
    }
  if(IS_AFFECTED_EXTRA(ch,AFF_PARALYZE))
    {
      send_to_char("YOU...CAN'T...MOVE...\n\r", ch);
      return;
    }
  hit_pos = number_range (1, 4);
  if (ch && victim && IS_MOB (ch) && IS_PLAYER (victim) &&
      (!HUNTING (ch) || (HUNTING (ch) && !is_number (HUNTING (ch)))))

    {
      if (strlen (NAME (victim)) < 16)
	{
	  if (HUNTING (ch) != NULL)
	    {
	      free_string (ch->fgt->hunting);
	      ch->fgt->hunting = NULL;
	    }
	  ch->fgt->hunting = str_dup (NAME (victim));
	}
    }
  if (MOUNTED_BY (victim) == ch)
    {
      ch->fgt->riding = NULL;
      victim->fgt->mounted_by = NULL;
    }
  /*
   * Figure out the type of damage message.
   */
  if (victim->position == POSITION_GROUNDFIGHTING && number_range(1,3) == 1)
    {
      act ("$N is groundfighting and you can't find a line of attack.", ch, NULL, victim, TO_CHAR_SPAM);
      return;
    }

  if (dt != gsn_backstab && dt != gsn_circle && dt != gsn_impale && dt != gsn_charge)
    {
      /* ------------------------------------------- */
      /*       Do magical shield damage here         */
      /* ------------------------------------------- */
      if (IS_AFFECTED_EXTRA(victim, AFF_FIRESHIELD) && number_range(1,10) == 1)
	{
          minShieldDamage = 1;
	  maxShieldDamage = (LEVEL(ch) * 2)/2;
          if(minShieldDamage >= maxShieldDamage)
	    minShieldDamage = maxShieldDamage;
          damm = number_range(minShieldDamage,maxShieldDamage);

	  /* cap damage here */
	  if(damm >= 50)
          {
	    if(IS_MOB(ch))
	      damm = 25;
            else
	      damm = 50;
	  }

          if (IS_AFFECTED_EXTRA(ch, AFF_PROT_FIRE))
            damm = damm/2;
	  if (IS_AFFECTED_EXTRA(ch, AFF_MINDSHIELD))
	    damm = damm/4;
	  if (IS_AUGMENTED(ch, AUG_MENTAL_ARMOR))
	    damm = damm/5;
          if (damm < 1) damm = 1;
          if (ch-> hit > dam)
            {
              SUBHIT(ch, damm);
              update_pos (ch);
	      dam_message (victim,ch, damm, gsn_fireshield, 0);
            }
	}
      if(number_range(1,2) == 2)
	if (check_defense(ch, victim)) return;
    }
  if (dt == TYPE_UNDEFINED)
    {
      dt = TYPE_HIT;
      if (wield != NULL && wield->pIndexData->item_type == ITEM_WEAPON)
        {
	  dt += ((I_WEAPON *)wield->more)->attack_type;
	}
    }

  if (wield && wield->pIndexData->item_type != ITEM_WEAPON)
    wield = NULL;
  else
    {
      if (IS_PLAYER (ch))
	bonushit = addoffense (ch, wield);
    }
  to_hit = GET_HITROLL(ch) + (bonushit*4/3) +
    (IS_MOB(ch) ? ch->pIndexData->hitroll : (ch->pcdata->learned[gsn_accuracy] > 0 ? ch->pcdata->learned[gsn_accuracy]/8 : 0));
  to_hit -= LEVEL(victim)/4 - get_curr_dex(victim);
  if (IS_PLAYER(victim))
    {
      to_hit -= ((!IS_SET (victim->ced->fight_ops, F_AGGRESSIVE) ? 8 : 0) +
		 (!IS_SET (victim->ced->fight_ops, F_POWER) ? 8 : 0) +
		 (IS_AUGMENTED(victim, AUG_LEG_SPD) ? 6 : 0) +
		 (IS_AUGMENTED(victim, AUG_FOOT_SPD) ? 6 : 0));
    }
  if (to_hit > 80) to_hit -= (to_hit-80)/2;
  if (number_percent() >= to_hit && number_range (0, 9) >= 3 &&
      dt != gsn_backstab && dt != gsn_circle && IS_AWAKE (victim)
      && dt != gsn_impale && dt != gsn_charge) {
      /* Shit! Missed! */
      ghit_pos = hit_pos;
      damage (ch, victim, 0, dt);
      ghit_pos = 0;
      return;
    }

  if (IS_MOB (ch))
    {
      if (wield != NULL && wield->pIndexData->item_type == ITEM_WEAPON)
	dam = (dice (FIRSTDICE (wield), SECONDDICE (wield)));
      dam += number_range (LEVEL (ch) / 10, (LEVEL (ch)/5));
      dam += ch->pIndexData->damroll/2;
      if (dam <= 0)
	dam = 1;
      if (dam >= LEVEL(ch))
	dam -= number_range (0, (dam - LEVEL(ch)));
      /*Prevent LOW level mobs from doing caps damage to newbies here*/
      if (LEVEL(ch) < 50 && dam >= LEVEL(ch))
	dam = number_range (LEVEL(ch)/4, LEVEL(ch)/2);
    }
  else
    {
      if (wield == NULL && is_member(ch, GUILD_MONK))
        dam = dice (4,4);
      if (wield != NULL && wield->pIndexData->item_type == ITEM_WEAPON)
	{
          if (is_member(ch, GUILD_MONK))
            return;
	  dam = dice (FIRSTDICE (wield), SECONDDICE (wield));
	  if (is_member(ch, GUILD_TINKER) && IS_OBJ_STAT(wield, ITEM_CONCUSSION))
	    dam += number_range(0,1);
	  if (is_member(ch, GUILD_RANGER) && (IS_OBJ_STAT(wield, ITEM_SLASHING) || IS_OBJ_STAT(wield, ITEM_HEAVY_SLASH) || IS_OBJ_STAT(wield, ITEM_LIGHT_SLASH)))

	    dam += number_range(0,1);
	  if (is_member(ch, GUILD_THIEFG) && IS_OBJ_STAT(wield, ITEM_PIERCE))
	    dam += number_range(0,2);
	  if (is_member(ch, GUILD_ROGUE) && IS_OBJ_STAT(wield, ITEM_PIERCE))
	    dam += number_range(0,2);
	}
      else
	{
	  dam = number_range(0, (1+LEVEL(ch)/15));

	}
    }
   if (GET_DAMROLL(ch) > 0)
       {
          dam += number_range(0, GET_DAMROLL(ch)/5);
	}
  if (dt != gsn_circle && dt != gsn_backstab)
    {
      int b4 = dam;
      int aftr;
      int dif;
      int absorbed = 0;
      bool tinker = is_member(ch, GUILD_TINKER);
      bool conc = FALSE;
      bool power = FALSE;
      if (is_member(ch, GUILD_MONK) && ch->pcdata->stance == 7
          && number_range(1,3) == 3)
        power = TRUE;
      if (IS_AUGMENTED(ch, AUG_BODY_POWER)) dam += number_range(0,1);
      if (IS_AUGMENTED(ch, AUG_ARM_POWER)) dam += number_range(0,1);
      if (IS_AUGMENTED(ch, AUG_HAND_POWER)) dam += number_range(0,1);
      if (is_member(ch, GUILD_WARRIOR)) dam += number_range(0,1);
      if (is_member(ch, GUILD_BATTLEMASTER)) dam += number_range(0,1);
      if (is_member(ch, GUILD_MONK))
      {
        int monkbonus = ch->pcdata->learned[gsn_unarmed] - 68;
        if (monkbonus < 0)
          monkbonus = 0;
        monkbonus /= 8;
        dam += number_range(0,monkbonus);
        if (number_range(1,5) == 1)
          skill_gain(ch, gsn_unarmed, TRUE);
        if (ch->pcdata->stance == 3)
          dam += number_range(1, 3);
        else if (ch->pcdata->stance == 6)
          dam += number_range(3, 5);
        else if (ch->pcdata->stance == 7)
          dam += number_range(4, 8);
        else if (ch->pcdata->stance == 2)
          dam -= number_range(3, 6);
        else if (ch->pcdata->stance == 5)
          dam -= number_range(1, 3);
      }

  if (is_member(ch, GUILD_MONK) && IS_SET(ch->act, PLR_HAS_SHIELD))
    dam = 0;

  if (IS_PLAYER(ch) && is_member(ch, GUILD_MONK))
  {
  int opp_align = 0;
  int same_align = 0;
  CHAR_DATA *fch;
  for (fch = ch->in_room->more->people; fch != NULL; fch = fch->next_in_room)
    {
      if (IS_PLAYER(fch))
      {
        if (ch->pcdata->alignment == fch->pcdata->alignment)
          same_align += 1;
        else if (fch->pcdata->alignment > 0)
          opp_align += 1;
      }
    }
    dif = opp_align - same_align;
    if (opp_align < 2)
      dif = 0;
    if (dif == 2) 
      dam+= 8;
    else if (dif == 3)
      dam+= 15;
    else if (dif == 4)
      dam+= 20;
    else if (dif > 5)
      dam+= 29;
  } /* END OF MONK OUTNUMBERED STUFF */

      if (ch->pcdata->learned[gsn_enhanced_damage] > 0)
	{
	  int roll = 0;
	  roll = number_range(0, ch->pcdata->learned[gsn_enhanced_damage]);
	  if (roll <= 2) roll = 2;
	  dam += (dam *  roll)/ 390;
	  if (number_range (1, 15) == 10)
	    {
	      skill_gain (ch, gsn_enhanced_damage, TRUE);
	      skill_gain (ch, gsn_accuracy, TRUE);
	    }
	}

      if (wield && wield->pIndexData->item_type == ITEM_WEAPON)
	{
	  if (IS_OBJ_STAT(wield, ITEM_POWER))
	    power = TRUE;
	  if (IS_OBJ_STAT(wield, ITEM_CONCUSSION))
	    conc = TRUE;
        }
      aftr = new_damage (victim, dam, hit_pos, dt);
      dif = b4 - aftr;
      dam -= dif;
      if ((tinker && conc) || power)
	dam += dif/4;
      if (IS_PLAYER (ch) && dif > 4 && number_range (1, 100) < ch->pcdata->learned[gsn_penetration])
	{
	  if (number_range (1, 5) == 2)
	    skill_gain (ch, gsn_penetration, TRUE);
	  dam += dif/4;
	}
	  if (IS_PLAYER(victim) && !strcmp(race_info[victim->pcdata->race].name, "gargoyle"))
	    absorbed += number_range(0, 48);
	  if (IS_AUGMENTED(victim, AUG_LEG_PLATING))
	    absorbed+=number_range(0,8);
	  if (IS_AUGMENTED(victim, AUG_FOOT_PLATING))
	    absorbed+=number_range(0,8);
	  if (IS_AUGMENTED(victim, AUG_ARM_PLATING))
	    absorbed+=number_range(0,8);
	  if (IS_AUGMENTED(victim,AUG_HEAD_PLATING))
	    absorbed+=number_range(0,8);
	  if (IS_AUGMENTED(victim, AUG_BODY_PLATING))
	    absorbed+=number_range(0,8);
          if (is_member(victim, GUILD_MONK))
            {
              if (victim->pcdata->stance == 1)
                absorbed -=number_range(6,12);
              else if (victim->pcdata->stance == 2)
                absorbed +=number_range(6,12);
              else if (victim->pcdata->stance == 3)
                absorbed -=number_range(6,12);
              else if (victim->pcdata->stance == 4)
                absorbed -=number_range(12,18);
              else if (victim->pcdata->stance == 5)
                absorbed +=number_range(6,12);
              else if (victim->pcdata->stance == 6)
                absorbed -=number_range(12,18);
              else if (victim->pcdata->stance == 8)
                absorbed +=number_range(18,24);
            }
	  if (IS_PLAYER(victim) && victim->pcdata->learned[gsn_resilience] > 7 && !is_member(victim, GUILD_WIZARD)
             && (victim->pcdata->stance == 1 || victim->pcdata->stance == 
                 5 || victim->pcdata->stance == 8))
	    {
	      absorbed +=(victim->pcdata->learned[gsn_resilience]*3/4);
	      if (IS_MOB(ch))
	        absorbed -= number_range((victim->pcdata->learned[gsn_resilience]*1/4), (victim->pcdata->learned[gsn_resilience]*1/2));

	      if (number_range(1,10) == 3)
		skill_gain(victim, gsn_resilience, TRUE);
	    }
	  if (DIFF_ALIGN(ch, victim) && IS_AFFECTED(victim, AFF_PROT_ALIGN))
	      absorbed+= number_range(12,25);
	  if (IS_AFFECTED (victim, AFF_SANCTUARY))
	  {
	    absorbed += number_range (20, 25);
	    if (is_member(ch, GUILD_WARRIOR) || is_member (ch,GUILD_BATTLEMASTER))
	    	absorbed -= number_range (1, 3);
	  }
	  if (IS_AFFECTED (victim, AFF_PROTECT))
	  {
	    absorbed += number_range(10,20);
	    if (is_member(ch, GUILD_WARRIOR) && is_member (ch,GUILD_BATTLEMASTER))
		absorbed -= number_range (3, 7);
	  }
	  if (conc) absorbed = (absorbed * 4)/5;
	  if (power) absorbed = (absorbed * 2)/5;
	  if (absorbed > 80)
	    absorbed = 80;
 	  dam = ((100-absorbed)*dam)/100;

    }
  if (dam < 0)
    dam = 0;
  if (ch->in_room->sector_type == SECT_ASTRAL)
    dam/=2;

  /* ------------------------------------------------------------------ */
  /*                        Critical Hit ?                              */
  /* ------------------------------------------------------------------ */
  if (number_range(1,75) == 7 && dt != gsn_backstab && dt != gsn_circle)
    if (wield && wield->pIndexData->item_type == ITEM_WEAPON)
      {
	if (IS_PLAYER(ch) && IS_OBJ_STAT(wield, ITEM_PIERCE)
	    && IS_AUGMENTED(ch, AUG_HAND_SPD) && get_stat(ch, DEX) > 27
	    && check_skill(ch, gsn_critical))
	  {
	    dam += number_range(2,5);
	    dam*=8;
           dam = dam * (race_info[ch->pcdata->race].backstab_percent +
              align_info[ch->pcdata->alignment].backstab_percent)/100;
	    act ("\x1b[1;33mCritical \x1b[1;31mHit!!!!", ch, NULL,
		 NULL, TO_ROOM);
	    act ("\x1b[1;33mCritical \x1b[1;31mHit!!!!", ch, NULL,
		 NULL, TO_CHAR);
	    if (number_range(1,20) == 2)
	      skill_gain(ch, gsn_critical, TRUE);
	  }
      }





  if (number_range(1,38) == 2 && ch->position != POSITION_BASHED && victim->position != POSITION_BASHED)
    {
      if (IS_AFFECTED(ch, AFF_FLYING) && !IS_AFFECTED(victim, AFF_FLYING))
	{
	  act ("$n swoops down and attacks $N!", ch, NULL, victim, TO_NOTVICT);
	  act ("$n swoops down from the air and attacks you!", ch, NULL, victim, TO_VICT);
	  act ("You swoop down from the air and attack $N!", ch, NULL, victim, TO_CHAR);
	  dam += 2;
	  if (number_range (1, 12) == 5)
	    {
	      if (number_range (1, 2) == 1)
		{
		  act ("$N catches $n with an elbow while $e is approaching!", ch, NULL, victim, TO_NOTVICT);
		  act ("You catch $n with an elbow as $e approaches!", ch, NULL, victim, TO_VICT);
		  act ("$N smashes $S elbow into your face as you swoop down!", ch, NULL, victim, TO_CHAR);
		}
	      else
		{
		  act ("$N jumps out of the way and $n smashes into the ground!", ch, NULL, victim, TO_NOTVICT);
		  act ("You jump out of the way and $n smashes into the ground!", ch, NULL, victim, TO_VICT);
		  act ("$N steps out of the way and you smash into the ground!", ch, NULL, victim, TO_CHAR);
		}
	      if (ch->hit > 7)
		SUBHIT(ch,7);

	      return;
	    }
	}
      else if (!IS_AFFECTED(ch, AFF_FLYING) && IS_AFFECTED(victim, AFF_FLYING))
	{
	  /*hitter not flying, victim flying */
	  act ("$N quickly flies out of the way, dodging your attack!", ch, NULL, victim, TO_CHAR);
	  act ("$N flies out of $n's attack path.", ch, NULL, victim, TO_NOTVICT);
	  act ("You fly out of the path of $n's attack.", ch, NULL, victim, TO_VICT);
	  return;
	}
      else if (IS_AFFECTED(ch,AFF_FLYING) && IS_AFFECTED(victim, AFF_FLYING))
	{
	  /*both hitter and victim flying */
	  act ("$N and $n get tangled and smash into the ground!", ch, NULL, victim, TO_NOTVICT);
	  act ("You smash into the ground as you struggle with $n!", ch, NULL, victim, TO_VICT);
	  act ("You smash into the ground as you struggle with $N!", ch, NULL, victim, TO_CHAR);
	  if (ch->hit > 10)
	    {
	      SUBHIT(ch,9);
	      SUBHIT(victim,9);
	    }
	  return;
	}
    }
  if (!IS_AWAKE (victim))  dam *= 3;
  if (victim->position == POSITION_RESTING) dam = (dam * 3) / 2;

  if (wield != NULL  && wield->pIndexData->extra_flags >= ITEM_ELEMENTAL)
    {
      if(IS_OBJ_STAT(wield, ITEM_ELEMENTAL) && number_range(1,25) == 2)
	{
	  switch (number_range(1,5))
	    {
	    case 1:
	      spell_fire_breath (LEVEL(ch), ch, victim);
	      break;
	    case 2:
	      spell_acid_breath (LEVEL(ch), ch, victim);
	      break;
	    case 3:
	      spell_ice_breath (LEVEL(ch), ch, victim);
	      break;
	    case 4:
	      spell_shock_breath (LEVEL(ch), ch, victim);
	      break;
	    case 5:
	      spell_wind_breath (LEVEL(ch), ch, victim);
	      break;
	    }
	}

      if ( IS_OBJ_STAT(wield, ITEM_WOUND) && number_range(1,100) == 93)
	{
	  AFFECT_DATA paf;
	  bzero (&paf, sizeof (paf));
	  paf.type = gsn_wound;
	  paf.duration = 3;
	  paf.location = 0;
	  paf.modifier = 0;
	  paf.bitvector = 0;
	  paf.bitvector2 = AFF_WOUND;
	  renew_affect (victim, &paf);
	   act ("You open up a huge gash in $N's side.", ch, wield, victim, TO_CHAR);
	   act ("$n lifts the $p high and rips open a huge gash in $N's side.", ch, wield, victim, TO_NOTVICT);
	   act ("$n lifts up $s $p and brings it down, opening a huge gash in your side.", ch, wield, victim, TO_VICT);

	}
      if (IS_OBJ_STAT(wield, ITEM_BLIND) && number_range(1,200) == 46 && FALSE)
	{
	  if (!IS_AFFECTED_EXTRA(victim, AFF_PROT_BLIND))
	    {
	      AFFECT_DATA paf;
	      bzero (&paf, sizeof (paf));
	      paf.type = gsn_blindness;
	      paf.duration = 3;
	      paf.location = 0;
	      paf.modifier = 0;
	      paf.bitvector = 0;
	      paf.bitvector2 = AFF_BLIND;
	      renew_affect (victim, &paf);
	      act ("$p slices across $N's eyes.", ch, wield, victim, TO_CHAR);
	      act ("$n slices $p across $N's eyes.", ch, wield, victim, TO_NOTVICT);
	      act ("$n slices $s $p across your eyes. You can't see!", ch, wield, victim, TO_VICT);
	      
	    }
	}
      
      if (IS_OBJ_STAT(wield, ITEM_POISON) &&
	  number_range(1,10)== 2 &&
	  !IS_AFFECTED_EXTRA(victim, AFF_PROT_POISON))
	{
	  AFFECT_DATA paf;
	  bzero (&paf, sizeof (paf));
	  paf.type = gsn_poison;
	  paf.duration = 3;
	  paf.location = 0;
	  paf.modifier = 0;
	  paf.bitvector = 0;
	  paf.bitvector2 = AFF_POISON;
	  renew_affect (victim, &paf);
	}
      /* SPECIAL ITEM EFFECTS - FLATLINE */ 
      if (IS_OBJ_STAT(wield, ITEM_KNOCKDOWN) && number_range(1,80) == 2)
        {
	      act ("$p sends $N sprawling to the ground!", ch, wield, victim, TO_CHAR);
	      act ("$n's $p sends $N sprawling to the ground!", ch, wield, victim, TO_NOTVICT);
	      act ("$n's $p sends you sprawling to the ground!", ch, wield, victim, TO_VICT);
	      if (RIDING (victim) != NULL) {
		      check_fgt (victim->fgt->riding);
		      victim->fgt->riding->fgt->mounted_by = NULL;
		      victim->fgt->riding = NULL;
	      }
	      if (victim->position != POSITION_FIGHTING)
		      victim->fgt->fighting = ch;
	      victim->position = POSITION_BASHED;
	      set_fighting(ch, victim);
	      victim->fgt->ears = 10;
	}

      
      if (IS_OBJ_STAT(wield, ITEM_MANARESTORE) && number_range(1,50) == 4)
        {
	      act ("$p sends a crackle of energy up your arm as it strikes $N!", ch, wield, victim, TO_CHAR);
	}
      if (IS_OBJ_STAT(wield, ITEM_CRUSADER) && number_range(1,90) == 6)
        {
	      act ("$p engulfs you in a brilliant glow as it strikes $N!", ch, wield, victim, TO_CHAR);
	      act ("$n is engulfed in a brilliant glow as $n's $p strikes $N!", ch, wield, victim, TO_NOTVICT);
	      act ("$n is engulfed in a brilliant glow as $s $p strikes you!", ch, wield, victim, TO_VICT);
	      dam *= number_range(5, 10);
	}
      if (IS_OBJ_STAT(wield, ITEM_MANABURN) && number_range(1,100) == 6)
        {
	      act ("$p engulfs $N in burning arcane energies!", ch, wield, victim, TO_CHAR);
	      act ("$n's $p engulfs $N in burning arcane energies!", ch, wield, victim, TO_NOTVICT);
	      act ("$n's $p engulfs you in burning arcane energies!", ch, wield, victim, TO_VICT);
	}
      if (IS_OBJ_STAT(wield, ITEM_OVERPOWER) && number_range(1,150) == 6)
      
        {
	      act ("$p strikes $N causing $S to scream in pain!", ch, wield, victim, TO_CHAR);
	      act ("$N screams in pain as $n's $p strikes $S!", ch, wield, victim, TO_NOTVICT);
	      act ("You scream in pain as $n's $p strikes you!", ch, wield, victim, TO_VICT);
	      dam *= number_range(5, 10);
	}
      if (IS_OBJ_STAT(wield, ITEM_WEAKEN) && number_range(1,100) == 6)
        {
	      act ("$p saps $N's strength!", ch, wield, victim, TO_CHAR);
	      act ("$n's $p strikes you!  You feel weaker.", ch, wield, victim, TO_VICT);
	      SUBMOVE(victim, (1+dam)*number_range(3,5));
	}
      if (IS_OBJ_STAT(wield, ITEM_VAMPIRIC) && number_range(1,100) == 6)
        {
	      act ("$p seems to greedily lap up the $N's blood!  You feel healthy.", ch, wield, victim, TO_CHAR);
	      act ("$n's $p seems to greedily lap up $N's blood!", ch, wield, victim, TO_NOTVICT);
	      act ("$n's $p seems to greedily lap up your blood!", ch, wield, victim, TO_VICT);
	      ch->hit += (1+dam)*(1+number_range(1,3));
	      if (ch->hit > ch->max_hit)
		      ch->hit = ch->max_hit;
	}
      
    }
  /* bscalc Backstab damage here bsdam*/
  if (dt == gsn_circle || dt == gsn_backstab)
    {
  int muu = (LEVEL (ch) * 3 / 16);
  if (muu > 15) muu = 15;
      if (is_member(ch, GUILD_ROGUE))
        {
          muu += 4;
        }
      if (is_member(ch, GUILD_THIEFG))
        {
          muu += 3;
        }
	if ( is_member(ch, GUILD_WIZARD) &&
	   !is_member(ch, GUILD_THIEFG) &&
	     !is_member(ch, GUILD_ROGUE))
	 {
   	  muu -= 3;
	 }

	if (IS_AUGMENTED(ch, AUG_HAND_SPD)) muu += 2;
	if (IS_AUGMENTED(ch, AUG_HAND_POWER)) muu += 2;

  dam = muu*dam;

  /*  Damage reductions based on certain classifications and guilds */

	/* Guild Reductions  If in wizards and NOT assassins AND thiefs
	 * Reduction by 1/4 to get rid of mage stabbers that havent
	 * thief/assassin guilded
	*/

	if ( is_member(ch, GUILD_WIZARD) &&
	    !is_member(ch, GUILD_THIEFG) &&
	    !is_member(ch, GUILD_ROGUE))
 		dam=dam/5;

        if ( is_member(ch, GUILD_HEALER) &&
	    !is_member(ch, GUILD_THIEFG) &&
	    !is_member(ch, GUILD_ROGUE))
		dam-dam/5;

	/* Reductions based on crappy dex
         * Primary damage reduction here, increase the divider
	 * to lower backstab damage overall. Basic formula
         * is just (dam) * (char_dex) / (divisor)
	*/
	dam = (dam*(get_curr_dex(ch))/23);

	/* Here we modify the damage even more for lower end of the
	 * DEX scale  THESE ARE ADDITIVE (or subtractive as the case may
	 * be) to the above reductions.
	*/
	if (get_curr_dex(ch) < 32)
	   dam = dam*7/6;
	if (get_curr_dex(ch) < 29)
	   dam = dam*3/4;
        if (get_curr_dex(ch) < 27)
           dam = dam*4/7;
        if (get_curr_dex(ch) < 23)
           dam = dam*3/7;
        if (get_curr_dex(ch) < 21)
           dam = dam*2/7;
        if (get_curr_dex(ch) < 18)
           dam = dam/4;

     if(IS_PLAYER(ch))
        dam = (dam*(race_info[ch->pcdata->race].backstab_percent +
	  align_info[ch->pcdata->alignment].backstab_percent))/100;

      if(dt == gsn_backstab)
        {
          if (dam > 450) dam = 450 +number_range(1,90);
         }

      if(dt == gsn_circle)
        {
          if (dam > 280) dam = 250 +number_range(1,100);
         }
  }




  if (dt == gsn_impale) {
      int muu;
      if (dam < 5) dam = 5;
      muu = 5 + (get_curr_str (ch)/ 3);
      SUBMOVE(ch, 20);
      if (is_member (ch, GUILD_WARRIOR)) {
          muu += 3;
          dam += 2;
      }

      if (is_member (ch, GUILD_BATTLEMASTER)) {
          muu += 3;
          dam += 2;
      }

      dam *= muu;
      dam /= 3;
    }

  if (dt == gsn_charge) {
      int muu;
      if (dam < 10) dam = 10;
      muu = 5 + (get_curr_str (ch)/ 2);
      SUBMOVE(ch, 40);
      if (is_member (ch, GUILD_WARRIOR)) {
          muu += 3;
          dam += 4;
      }

      if (is_member (ch, GUILD_BATTLEMASTER)) {
          muu += 3;
          dam += 4;
      }

      dam *= muu;
      dam /= 2;
    }


  if (dam <= 0)
    dam = 1;
  if (number_range (1, 5) == 1 && ch->move > 0) {
      SUBMOVE(ch,0);
  }
  ghit_pos = hit_pos;

  if (wield) {
      dam = dam * (UMIN(100,( 30+(((I_WEAPON*)wield->more)->damage_p))))/100;
      damage(ch, victim, dam, dt);
  }
  else {
      hitop=TRUE;
      damage (ch, victim, dam, dt);
  }

  if (victim->data_type==50 || FIGHTING (ch) == NULL)  {
    return;
  }

  {
    bool broken = FALSE;
    if (wield !=NULL && (((I_WEAPON *) wield->more)->strength != 0) &&
	(dam >= ((I_WEAPON *) wield->more)->strength))
      if (number_range (1, 12) == 5)
	{
	  --((I_WEAPON *) wield->more)->damage_p;
	  if (((I_WEAPON *) wield->more)->damage_p == 1)
	    {
	      send_to_char ("--->ACK! Your weapon just broke!\n\r", ch);
	      unequip_char (ch, wield);
	      obj_from(wield);
	      obj_to(wield,get_room_index(8));
	      broken = TRUE;
	    }
	  else if (number_range (1, 4) == 3)  /*only display occasionally */
	    send_to_char ("Your weapon is damaged slightly by your attack!\n\r", ch);
	}
  }
  ghit_pos = 0;

  if (dam >= 4 && number_range (1, 5) == 2
      && (armor = get_eq_char (victim,(iWear = number_range (WEAR_NONE + 1, (MAX_WEAR-1))))) != NULL
      && armor->pIndexData->item_type == ITEM_ARMOR
      && armor->wear_loc != -1
      && ((I_ARMOR *) armor->more)->max_condition)

    {
      int localle;
      char blah[500];
      char *tmp;
      if ((hit_pos == STRIKE_BODY && (armor->wear_loc > WEAR_FACE && armor->wear_loc < WEAR_ARMS)) ||
	  (hit_pos == STRIKE_HEAD && armor->wear_loc < WEAR_BODY) ||
	  (hit_pos == STRIKE_ARMS && (armor->wear_loc > WEAR_BACK && armor->wear_loc < WEAR_HOLD_1)) ||
	  (hit_pos == STRIKE_LEGS && armor->wear_loc > WEAR_BELT_5))
	{
	  if (armor->pIndexData->short_descr[0] != '\0')
	    {
	      for (tmp = armor->pIndexData->short_descr; *tmp != '\0';
		   tmp++)
		{
		};
	      if (*(tmp - 1) == 's')
		sprintf (blah, "$p are damaged.");
	      else
		sprintf (blah, "$p is damaged.");
	      act (blah, victim, armor, NULL, TO_CHAR);
	      localle = armor->wear_loc;
	      unequip_char (victim, armor);
	      --((I_ARMOR *) armor->more)->condition_now;
	      equip_char (victim, armor, localle);
	      if (((I_ARMOR *) armor->more)->condition_now <= 0)
		{
		  if (*tmp == 's')
		    sprintf (blah, "The damage was so powerful, $p fall apart!");
		  else
		    sprintf (blah, "The damage was so powerful, $p falls apart!");
		  act (blah, victim, armor, NULL, TO_CHAR);
		  unequip_char (victim, armor);
		  free_it (armor);
		  return;
		}
	    }
	}
    }
  return;
}







bool
can_trip (CHAR_DATA * ch)
{
  if (number_range (1, 4) != 1)
    return FALSE;
  if (IS_PLAYER (ch))
    return TRUE;
  if (ch->pIndexData->mobtype == MOB_HUMAN
      || ch->pIndexData->mobtype == MOB_DWARF
      || ch->pIndexData->mobtype == MOB_ELF
      || ch->pIndexData->mobtype == MOB_GIANT
      || ch->pIndexData->mobtype == MOB_DRAGON)
    return TRUE;
  return FALSE;
}
bool
bashable (CHAR_DATA * ch)
{
  if (IS_PLAYER (ch))
    return TRUE;
  if (ch->pIndexData->mobtype == MOB_GHOST)
    return FALSE;
  if (ch->pIndexData->mobtype == MOB_DRAGON)
    return FALSE;
  return TRUE;
}
int
kickable (CHAR_DATA * ch)
{
  if (IS_PLAYER (ch))
    return 1;
  if (ch->pIndexData->mobtype == MOB_GHOST)
    return 0;
  if (IS_AFFECTED (ch, AFF_FLYING))
    return 2;
  return 1;
}

bool
pkill (CHAR_DATA * ch, CHAR_DATA * victim)
{
  return TRUE;
}


/*
   * Inflict damage from a hit.
 */
void
damage (CHAR_DATA * ch, CHAR_DATA * victim, int dam, int dt)
{
  char buf[500];
  AFFECT_DATA *paf;
  SPELL_DATA *spell;

  if (!ch || !victim)
    {
    return;
    }

  CHECK_CHAR (ch);
  CHECK_CHAR (victim);
  check_fgt (ch);
  check_fgt (victim);

  if (ch->in_room != victim->in_room) /* Not a spell or ranged */
    {
      if (dt > 300 && dt != gsn_shoot && dt != gsn_throw)
	{
	  ch->fgt->fighting=NULL;
	  victim->fgt->fighting=NULL;
	  ch->position=POSITION_STANDING;
	  victim->position=POSITION_STANDING;
	  return;
	}
      else
	{
	  if (IS_MOB(victim) && IS_SET(victim->act, ACT_SENTINEL))
            {
	      dam = 0;
              return;
            }
	}
    }
  if (IS_PLAYER(ch) && LEVEL(ch) >= IMM_LEVEL && LEVEL(ch) < MAX_LEVEL && (!ch->in_room->area || ch->in_room->area->open == 1))
    {
      ch->fgt->fighting = NULL;
      victim->fgt->fighting = NULL;
      return;
    }

  if (victim->position == POSITION_DEAD || victim->data_type == 50)
    {
      ch->wait = 0;
      stop_fighting(ch,TRUE);
      return;
    }

  if (ch->in_room == victim->in_room)
    {
      add_to_fighting_list (ch);
      add_to_fighting_list (victim);
      if (!FIGHTING(ch)) set_fighting(ch,victim);
      if (!FIGHTING(victim)) set_fighting(victim,ch);

      if (FIGHTING (victim) == ch && FIGHTING (ch) != victim && !(victim->position == POSITION_GROUNDFIGHTING &&   ch->position == POSITION_GROUNDFIGHTING) && dt != gsn_kick &&  victim->position != POSITION_CASTING && victim->position != POSITION_BASHED
	  && ch->position != POSITION_CASTING  && ch->position != POSITION_BASHED)
	{
	  NEW_POSITION(ch, POSITION_FIGHTING);
	  NEW_POSITION(victim, POSITION_FIGHTING);

	  if (ch!=victim || pow.can_fight_self)
	    {
	      ch->fgt->fighting = victim;
	    }
	}

      if (ch->position == POSITION_GROUNDFIGHTING && victim->position != POSITION_GROUNDFIGHTING)
	{
	  NEW_POSITION(ch, POSITION_FIGHTING);
	}
      update_pos (victim);
    }
  if (victim != ch)
    {
      if (is_safe (ch, victim))
	{

	  if (IS_MOB (ch))
	    return;
	  act ("\x1B[1;37mYou hear a loud clash of thunder in the sky, sent forth by", ch, NULL, NULL, TO_CHAR);
	  act ("the gods, and you decide not to attack.\x1B[0m", ch, NULL, NULL, TO_CHAR);
	  act ("You hear massive clashes of thunder in the heavens above.",
	       ch, NULL, NULL, TO_NOTVICT);
	  return;
	}
      if(IS_PLAYER(ch))
	{
	  if (IS_MOB(victim) || !DIFF_ALIGN(ch, victim))
	    {
	      if(ch->pcdata->no_quit_pk < MOB_QUIT_TIMER)
		ch->pcdata->no_quit_pk = MOB_QUIT_TIMER;
	    }
	  /*ARC: no timers associated with neuts */
	  else if(IS_PLAYER(victim) && ALIGN(ch)!= 0 && ALIGN(victim)!=0)
	    {
	      ch->pcdata->no_quit_pk = PK_QUIT_TIMER;
	      victim->pcdata->no_quit_pk = PK_QUIT_TIMER;
	    }
	}
      else
	{
	  if (IS_PLAYER(victim) && victim->pcdata->no_quit_pk < MOB_QUIT_TIMER)
	    victim->pcdata->no_quit_pk = MOB_QUIT_TIMER;
	}
    }

  if (can_yell (victim) && victim->hit < 8 && victim->max_hit > 100 && ch->hit > 60 && dt > 300)
    {
      do_fatal (victim, ch, dt);
    }
  if (IS_PLAYER (ch) && dam > 2 && ch && victim && ch != victim)
    {
      int gn;
      gn = (dam * 3) + (LEVEL (victim) * 3) + ((LEVEL (ch) * LEVEL (ch)) / 8) + number_range (1, (LEVEL (victim) + LEVEL (ch)));
      gn/=7;
        if (IS_PLAYER(victim) && !DIFF_ALIGN(ch, victim))
          gn = 0;
        gain_exp (ch, gn);
	ch->pcdata->voting_on += gn;
      }
    /*
     * More charm stuff.
     */
  if (MASTER (victim) == ch)
    stop_follower (victim);

  if (IS_AFFECTED (ch, AFF_HIDE))
    {
      affect_strip (ch, gsn_hide);
      REMOVE_BIT (ch->affected_by, AFF_HIDE);
      act ("$n is revealed.", ch, NULL, NULL, TO_ROOM);
    }
  if (IS_AFFECTED_EXTRA (ch, AFF_CHAMELEON))
    {
      affect_strip (ch, gsn_chameleon);
      REMOVE_BIT (ch->more_affected_by, AFF_CHAMELEON);
      act ("$n comes back from the \x1b[1;32me\x1b[1;33mn\x1b[1;32mv\x1b[1;33mi\x1b[1;32mr\x1b[1;33mo\x1b[1;32mn\x1b[1;33mm\x1b[1;32me\x1b[1;33mn\x1b[1;32mt.", ch, NULL, NULL, TO_ROOM);
    }
  if (dt >= TYPE_HIT)
    {
      if ((IS_MOB (ch) && number_percent () < 20) && ch->move > 10)
	{
	  if (can_trip (ch) &&
	      victim->position != POSITION_GROUNDFIGHTING && victim->position != POSITION_CASTING)
	    {
	      disarm (ch, victim);
	    }
	}
      if ((IS_MOB (ch) && number_percent () < 8) &&
	  victim->position != POSITION_GROUNDFIGHTING && can_trip (ch) &&
	  victim->position != POSITION_CASTING && can_trip (victim)
	  && victim->fgt->combat_delay_count < 0
	  && ch->move > 10)
	{
	  if (number_range (0, 7) == 1)
	    trip (ch, victim);
	  else
	    {
	      act ("$n tries to trip you, but you quickly jump out of the way!", ch, NULL, victim, TO_VICT_SPAM);
	      act ("You try to trip $N, but $N swiftly jumps out of the way!", ch, NULL, victim, TO_CHAR);
	      act ("$n tries to trip $N, but $N swiftly jumps out of the way!", ch, NULL, victim, TO_NOTVICT_SPAM);
	    }
	}
      if (dt > 999 && dt != gsn_circle && dt != gsn_backstab)
	{
	  if (IS_AFFECTED (victim, AFF_INVISIBLE) &&
	      !IS_AFFECTED (ch, AFF_DETECT_INVIS) && number_range (1, 14) == 3)
	    {
	      act ("You flail wildly around, trying to hit your invisible opponent...", ch, NULL, victim, TO_CHAR_SPAM);
	      return;
	    }
	}
    }

  if (dt == gsn_backstab || dt == gsn_circle || (dt != gsn_shoot && dt != gsn_throw && dt != gsn_kick && (!(dt > 0 && dt < 300))))
  {

    /* ------------------------- */
    /*       Mana Shield         */
    /* ------------------------- */
    if(IS_AFFECTED_EXTRA(victim, AFF_MANASHIELD) && dt != gsn_backstab && dt != gsn_circle)
    {
      if(victim->pcdata->mana_shield_strength >= dam)
      {
        victim->pcdata->mana_shield_strength -= dam;
        dam = 0;
        if(!IS_MOB(ch))
        {
          sprintf(buf,"Your victim's \x1b[1;37mMana Shield\x1b[0;37m \x1b[1;36mCRACKLES\x1b[0;37m as your hit is absorbed!\n\r",NAME(victim));
          send_to_char(buf,ch);
        }
        sprintf(buf,"Your \x1b[1;37mMana Shield\x1b[0;37m \x1b[1;36mCRACKLES\x1b[0;37m as protects you from %s's attack!\n\r",NAME(ch));
        send_to_char(buf,victim);
      }
      else
      {
        dam = dam - victim->pcdata->mana_shield_strength;
        victim->pcdata->mana_shield_strength = 0;
	/* find any and all manashield's and remove them */
	for(paf = victim->affected ; paf != NULL ; paf = paf->next)
        {
	   spell = skill_lookup(NULL, (int) paf->type);
	   if(spell == NULL)
	     continue;
	   if(spell->bitvector2 == AFF_MANASHIELD)
	     affect_remove (victim, paf);
        }
        sprintf(buf,"%s's \x1b[1;32mmana shield\x1b[0;37m absorbs your hit then winks out of existance.\n\r",NAME(victim));
        send_to_char(buf,ch);
        sprintf(buf,"Your \x1b[1;37mMana Shield\x1b[0;37m \x1b[1;31mcollapses!\x1b[0;37m\n\r",NAME(ch));
        send_to_char(buf,victim);

        /* Shield is gone, hit the person with the rest of damage */
        dam_message (ch, victim, dam, dt, ghit_pos);
      }
    }
    else  /* they got no shield, so whack em! */
      dam_message (ch, victim, dam, dt, ghit_pos);
  } /* end if dt == gsn_back */

  /* ------------------------- */
  /*       Actual damage       */
  /* ------------------------- */

       SUBHIT(victim,dam);

  /* ------------------------- */
  /*        Post damage        */
  /* ------------------------- */
  if (IS_PLAYER(victim) && victim->position == POSITION_CASTING)
    {
      if (!IS_AUGMENTED((victim), AUG_FOCUS))
	{
	  if (dam > 4)
	    {
	      NEW_POSITION(victim, POSITION_FIGHTING);
	      send_to_char ("OW! You can't cast getting hit like this!\n\r", victim);
	      victim->pcdata->tickcounts = 0;
	    }
	}
      else
	{
	  if (dt < 300)
	    {
	      if (dam > (4+LEVEL(victim)/4 + victim->pcdata->remort_times))
		{
		  NEW_POSITION(victim, POSITION_FIGHTING);
		  send_to_char ("OUCH! You just lost your concentration!\n\r", victim);
		  victim->pcdata->tickcounts = 0;
		}
	    }
	  else
	    {
	      if (dam > 5+LEVEL(victim)/12 + victim->pcdata->remort_times)
		{
		  NEW_POSITION(victim, POSITION_FIGHTING);
		  send_to_char ("OUCH! You just lost your concentration!\n\r", victim);
		  victim->pcdata->tickcounts = 0;
		}
	    }
	}
    }
  if (!IS_AWAKE (victim))
    {
      stop_fighting (victim, FALSE);

    }
  if(ch->in_room == victim->in_room)
    {
      if (victim->position != POSITION_CASTING && victim->position != POSITION_BASHED && victim->position != POSITION_GROUNDFIGHTING && victim->position != POSITION_FIGHTING &&  victim->position != POSITION_CIRCLE && victim->position > POSITION_FIGHTING)
	{
	  victim->position = POSITION_FIGHTING;
	  if (FIGHTING(victim) == NULL)
	    {
	      check_fgt(victim);
	      victim->fgt->fighting = ch;
	    }
	}
    }

  if (IS_PLAYER (victim)
      && LEVEL (victim) >= LEVEL_IMMORTAL
      && victim->hit < 1)
    victim->hit = 1;
  update_pos (victim);
isdedman:
  switch (victim->position)
    {
    case POSITION_MORTAL:
      act ("$n is mortally wounded, and will die soon if not aided.",
	   victim, NULL, NULL, TO_ROOM);
      send_to_char (
		    "You are mortally wounded, and will die soon if not aided.\n\r",
		    victim);
      victim->wait = 10;
      break;
    case POSITION_INCAP:
      act ("$n is incapacitated and will suffer a slow, painful death if not aided.",
	   victim, NULL, NULL, TO_ROOM);
      send_to_char (
		    "You are incapacitated and will suffer a slow, painful death if not aided.\n\r",
		    victim);
      victim->wait = 10;
      break;
    case POSITION_STUNNED:
      act ("$n is stunned, but will probably recover.",
	   victim, NULL, NULL, TO_ROOM);
      send_to_char ("You are stunned, but will probably recover.\n\r",
		    victim);
      victim->wait = 10;
      break;
    case POSITION_DEAD:
      if (IS_PLAYER (ch) && LEVEL (ch) < 8)
	{
	  ch->copper++;
	  send_to_char ("You just got a copper coin from the gods for the kill!\n\r", ch);
	}
      act ("$n has been killed!", victim, 0, 0, TO_ROOM);
      send_to_char ("You have been killed!\n\r\n\r", victim);
      ch->wait = 0;
      victim->wait = 10;
      break;
    default:
      if (dam > victim->max_hit / 5)
	send_to_char ("Ouch, that was *not* pleasant!\n\r", victim);
      if (victim->hit < victim->max_hit / 8)
	send_to_char ("You sure are BLEEDING!\n\r", victim);
      break;
    }

  if (!ch || !victim)
    return;
  if (victim->position == POSITION_DEAD)
    {
      if (IS_PLAYER (victim) && IN_BATTLE (victim) == TRUE)
	{
	  stop_fighting (victim, TRUE);
	  NEW_POSITION(victim, POSITION_STANDING);
	  NEW_POSITION(ch, POSITION_STANDING);
	  MAXHIT(victim);
	  victim->pcdata->no_quit_pk = 0;
	  victim->pcdata->no_quit = 0;
	  char_from_room (victim);
          char_to_room (victim, get_room_index (victim->fgt->wasroomtwo));
	  do_look (victim, "");
	  return;
	}
      if (IS_PLAYER (victim) && CHALLENGE (victim) != 0)
	{
	  stop_fighting (victim, TRUE);
	  NEW_POSITION(victim, POSITION_STANDING);
	  NEW_POSITION(ch, POSITION_STANDING);
	  ch->fgt->fighting = NULL;
	  victim->fgt->fighting = NULL;
	  MAXHIT(ch);
	  MAXHIT(victim);
	  victim->pcdata->no_quit_pk = 0;
	  victim->pcdata->no_quit = 0;
	  end_arena (ch, victim);
	  return;
	}
      group_gain (ch, victim);
      ch->wait = 0;
      if (IS_PLAYER (victim))
	{
	int ii;
	char buf[STD_LENGTH];
        CHAR_DATA *gch;
        bool pk_fight = FALSE;
        if(victim->pcdata->no_quit_pk >= 5 && IS_MOB(ch) && !victim->in_room->area->homeland && !IS_SET(ch->act, ACT_AGGRESSIVE)
           && !IS_SET(ch->pIndexData->act4, ACT4_KILL_OPP) )
           {
                    victim->pcdata->total_wps -= 200;
                    victim->pcdata->warpoints -= 200;
                    if (victim->pcdata->warpoints < 0)
                      victim->pcdata->warpoints = 0;
                    if (victim->pcdata->total_wps < 0)
                      victim->pcdata->total_wps = 0;
            }
/*
             check_room_more(victim->in_room);
             for (gch = victim->in_room->more->people; gch != NULL; gch=gch->next_in_room)
                {
                  if(IS_PLAYER(gch) && DIFF_ALIGN(gch, victim))
                    {
                       pk_fight = TRUE;
                       break;
                    }
                 }
              if (!pk_fight)
                {
*/
/*                } */
	victim->pcdata->deaths++;
	victim->pcdata->no_quit_pk = 0;
	reasonfd[0] = '\0';
	if (strlen (NAME (ch)) < 30)
	  strcpy (reasonfd, NAME (ch));
	sprintf (log_buf, "%s killed by %s at %d",
		 NAME (victim),
		 NAME (ch),
		 victim->in_room->vnum);
	log_string (log_buf);
	sprintf (log_buf, "%s just got killed by %s!", NAME (victim), NAME (ch));
/*WORLD ECHO ADDED BY KILITH 05
  THIS ONLY SHOWS ECHO WHEN PLAYER KILLED BY PLAYER
  THIS WILL ALSO SHOW SAME SIDE PKILL SO WILL SHOW OTHER
  SIDE WHO IS THE ASSHOLE ON THE OTHER SIDE!! LOL
  NOT DRUNK WHILE CODING THIS SP WILL WORK JUST FINE!!
*/
if (IS_PLAYER (victim) && IS_PLAYER (ch))
{
sprintf (buf, "\x1b[1;31m%s \x1B[0;37mwas just \x1b[1;31mk\x1b[0;31mille\x1b[1;31md  \x1B[0;37mby \x1b[1;31m%s\x1B[0;37m!!",  NAME (victim), NAME (ch));
    do_echo (ch, buf);
}
	ii = clan_number (victim);
	if (ii > 0)
	  clan_notify (log_buf, ii);
	if (LEADER (victim) != NULL)
	  group_notify (log_buf, victim);
	if (IS_PLAYER (ch))
	  {
	    sprintf (log_buf, "%s just killed %s!", NAME (ch), NAME (victim));
	    ii = clan_number (ch);
	    if (ii > 0)
	      clan_notify (log_buf, ii);
	  }
	sprintf (buf, "Ntfy> %s", log_buf);
	NOTIFY (buf, LEVEL_IMMORTAL, WIZ_NOTIFY_DEATH);
	if (IS_PLAYER (ch) && IS_PLAYER(victim) && DIFF_ALIGN(ch, victim))
	  {
	    if (victim->pcdata->warpoints > (1+LEVEL(victim)/10))
	      victim->pcdata->warpoints -= (1 + (LEVEL (victim) / 10));
	    if (victim->pcdata->warpoints < 0)
	      victim->pcdata->warpoints = 0;
	  }
	if (IS_MOB (ch) && IS_PLAYER (victim))
	  {
	    pc_death_penalty (ch, victim);

	  }
	else
	  gain_exp (victim, -(LEVEL (victim) * 1423));
      }

    raw_kill (victim, (dt == 1003));

    if (IS_PLAYER (ch) && IS_MOB (victim))
/*    if (IS_MOB (victim)) */
      {
	int old_gold = 0;
	char buf[STD_LENGTH];
	old_gold = tally_coins (ch);
	if (IS_SET (ch->pcdata->act2, PLR_AUTOLOOT))
	  do_get (ch, "all from corpse");
	else if (IS_SET (ch->pcdata->act2, PLR_AUTOGOLD))
	  do_get (ch, "all.coins from corpse");
	if (IS_SET (ch->pcdata->act2, PLR_AUTOSAC))
	  do_sacrifice (ch, "corpse");
	if (IS_SET (ch->pcdata->act2, PLR_AUTOSPLIT)
	    && tally_coins (ch) - old_gold > 1)
	  {
	    sprintf (buf, "%d", tally_coins (ch) - old_gold);
	    do_split (ch, buf);
	  }
      }
    ch->wait = 0;
    return;
  }

if (victim == ch)
  return;
/*
 * Take care of link dead people.
 */
if (IS_PLAYER (victim) && victim->desc == NULL)
  {
    if (number_range (0, victim->wait) < 2)
      {
	do_flee (victim, "");
	return;
      }
  }

/*
 * Wimp out?
 */
if (IS_MOB (victim) &&
    dam > 0 &&
    IS_SET (victim->act, ACT_WIMPY) &&
    number_bits (1) == 0
    && victim->hit < victim->max_hit / 6
    && victim->hit > 2)
  {
    do_flee (victim, "");
    return;
  }
if (IS_PLAYER (victim) &&
    dam > 0 &&
    victim->ced &&
    victim->hit < victim->ced->wimpy &&
    victim->position != POSITION_BASHED &&
    victim->position >= POSITION_SLEEPING &&

    victim->hit > 0)
  {
    if (IS_AFFECTED_EXTRA(victim, AFF_PARALYZE))
      {
	send_to_char("You are DYING, but you CAN'T MOVE!!!\n\r", ch);
	return;
      }
    else
      do_flee (victim, "");
    return;
  }
return;
}


bool
is_safe (CHAR_DATA * ch, CHAR_DATA * victim)
{
  CHAR_DATA *tch;
if (!victim->in_room) return TRUE;
if (ch->in_room && ((ch->in_room->vnum < 111 && ch->in_room->vnum > 95)||
   ch->in_room->vnum == 112))
  return TRUE;

for (tch = victim->in_room->more->people; tch != NULL; tch = tch->next_in_room)
  if (IS_PLAYER(tch) && LEVEL(tch) > IMM_LEVEL  && IS_SET (tch->act, PLR_HOLYPEACE))
    {
      if (FIGHTING (victim) != NULL)
	{
	  victim->fgt->fighting = NULL;
	  NEW_POSITION(victim, POSITION_STANDING);
	}
      if (FIGHTING (ch) != NULL)
	{
	  ch->fgt->fighting = NULL;
	  NEW_POSITION(ch, POSITION_STANDING);
	}
      send_to_char ("No fighting in the presence of Gods!\n\r", ch);
      return TRUE;
    }
return FALSE;
}



void
update_pos (CHAR_DATA * victim)
{
  if (victim == NULL)
    return;
  if (victim->hit > 0)
    {
      if (victim->position <= POSITION_STUNNED && victim->position >= 0)
        {
          if (FIGHTING (victim) == NULL)
            NEW_POSITION(victim, POSITION_STANDING);
        }
      return;
    }

  if (IS_MOB (victim) || victim->hit <= -5)
    {
      NEW_POSITION(victim, POSITION_DEAD);
      return;
    }

  if (victim->hit <= -3)
    NEW_POSITION(victim, POSITION_MORTAL);
  else if (victim->hit <= -1)
    NEW_POSITION(victim, POSITION_INCAP);
  else
    NEW_POSITION(victim, POSITION_STUNNED);
  return;
}
/*
   * Start fights.
 */
void
set_fighting (CHAR_DATA * ch, CHAR_DATA * victim)
{

  check_ced (ch);
  check_ced (victim);
  check_fgt (ch);
  check_fgt (victim);

  if (ch == NULL || victim == NULL)
    {

    return;
    }
  if (ch==victim && !pow.can_fight_self) return;
  ch->fgt->fighting = victim;

  if (ch->position != POSITION_GROUNDFIGHTING && ch->position != POSITION_BASHED)
    NEW_POSITION(ch, POSITION_FIGHTING);

  add_to_fighting_list (ch);

  add_to_fighting_list (victim);

  if (IS_MOB (victim) && FIGHTING (victim) == NULL &&
    IS_PLAYER(ch) && IS_SET(victim->act, ACT_SOLOYELL) &&
      victim->pIndexData->yeller_number > 0 &&
      number_range(1,victim->pIndexData->yeller_number) == 1 &&
      can_yell (victim))
    {
      char buffr[500];

      if (number_range (1, 2) == 1)
	sprintf (buffr, "Help! %s is attacking me!", NAME(ch));
      else
	sprintf (buffr, "%s is trying to kill me! Send help!", NAME(ch));
      do_yell (victim, buffr);
    }
  if (FIGHTING(victim) == NULL)
    {
    victim->fgt->fighting = ch;

    }
  return;
}

/*
 * Stop fights.
 */
void
stop_fighting (CHAR_DATA * ch, bool fBoth)
{
  CHAR_DATA *fch;
  CHAR_DATA *fch_next;

  if (FIGHTING(ch)==FIGHTING(FIGHTING(ch)))
    fBoth=TRUE;
  if (fBoth && FIGHTING (ch))
    {
      NEW_POSITION(ch->fgt->fighting,POSITION_STANDING);
      if (FIGHTING (FIGHTING (ch)))
	{
	  ch->fgt->fighting->fgt->fighting = NULL;
	}
      update_pos (FIGHTING (ch));
    }
  for (fch = f_first; fch != NULL; fch = fch_next)
    {
      fch_next = fch->next_fighting;
      if (fch == ch || (fBoth && FIGHTING (fch) != NULL && FIGHTING (fch) == ch))
        {
          fch->fgt->fighting = NULL;
          if (fch->position == POSITION_BASHED) continue;
          NEW_POSITION(fch, POSITION_STANDING);
          fch->fgt->combat_delay_count = -1;
          update_pos (fch);
        }
    }

  if (ch->fgt)
    {
      ch->fgt->fighting = NULL;
    }
  NEW_POSITION(ch, POSITION_STANDING);
  update_pos (ch);
  return;
}

bool
IS_CORPSE_MOB (CHAR_DATA * ch)
{
  if (IS_PLAYER (ch))
    return TRUE;

  if (ch->is_undead)
	  return FALSE;
  
  switch (ch->pIndexData->mobtype)
    {
    case MOB_GHOST:
      return FALSE;
      break;
    case MOB_STATUE:
      return FALSE;
      break;
    case MOB_PLANT:
      return FALSE;
      break;
    case MOB_FISH:
      return FALSE;
      break;
    }
  return TRUE;
}

void
disarm (CHAR_DATA * ch, CHAR_DATA * victim)
{
  int num = get_curr_str (ch) - get_curr_str (victim) + 8;
  SINGLE_OBJECT *obj;
  SINGLE_OBJECT *objc;
  if ((objc = get_item_held (ch, ITEM_WEAPON)) == NULL)
    return;
    if (((obj = get_item_held (victim, ITEM_WEAPON)) == NULL))
       if (((obj = get_item_held (victim, ITEM_GEM)) == NULL))
        return;
  if (ch->in_room && ch->in_room->vnum < 1000) return;
  if (IS_AUGMENTED(victim, AUG_HAND_POWER))
    num -= 5;
  if (IS_AUGMENTED(ch, AUG_HAND_POWER))
    num += 4;
  if (number_range(1,40) > num || number_range(1,6) != 3)
    {
      act ("$n tries to disarm you, but fails!", ch, NULL, victim,TO_VICT_SPAM + 1000);
      act ("You try to disarm $N, but fail!", ch, NULL, victim, TO_CHAR +1000);
      act ("$n tries to disarm $N, but fails!", ch, NULL, victim,TO_NOTVICT_SPAM + 1000);
      return;
    }

  if (IS_SET (obj->extra_flags, ITEM_NOREMOVE))
    {
      act ("$B$n tries to disarm you, but fails!$R",ch, obj, victim, TO_VICT);
      act ("You try to disarm $N, but fail!",ch, obj, victim, TO_CHAR);
      return;
    }

  act ("$B$4$n disarms you and sends your $p flying!$R$7", ch,obj,victim,TO_VICT);
  act ("$B$4You have managed to disarm $N!$R$7", ch, NULL, victim, TO_CHAR);
  act ("$B$4$n disarms $N!$R$7", ch, NULL, victim, TO_NOTVICT);
  unequip_char (victim, obj);
  obj_from (obj);
  if (!can_drop_obj(victim, obj))
  obj_to (obj, victim);
  else
  obj_to (obj, victim);
  return;
}

void
do_bash (CHAR_DATA * ch, char *argy)
{
  CHAR_DATA *victim;
  int chan = 0;
  bool notft = FALSE;
  int tmpi;
  char buf[STD_LENGTH];
  DEFINE_COMMAND ("bash", do_bash, POSITION_FIGHTING, 0, LOG_NEVER, "This command allows you to bash an opponent to the ground.")
    check_fgt (ch);
  if (ch->wait > 2)
    return;
  ch->wait+= 5;
if (ch->pcdata->learned[gsn_bash] < 10)
  {
    send_to_char("You don't know how to bash!\n\r", ch);
    WAIT_STATE(ch, 1*PULSE_VIOLENCE);
    return;
  }
  if (ch->fgt->ears > 9)
    {
      send_to_char ("You can't bash this soon again after giving or recieving a bash.\n\r", ch);
      WAIT_STATE(ch, 1*PULSE_VIOLENCE);
      return;
    }
  if (ch->in_room->sector_type == SECT_UNDERWATER)
    {
      send_to_char ("Bash someone underwater? I don't think so...\n\r", ch);
      return;
    }
  if ((FIGHTING (ch) == NULL || ch->position != POSITION_FIGHTING) && (argy == "" || argy[0] == '\0'))
    {
      send_to_char ("Bash whom?\n\r", ch);
      return;
    }
  if (FIGHTING (ch) == NULL)
    {
      notft = TRUE;
      if ((victim = get_char_room (ch, argy)) == NULL)
        {
          if (argy[0] == '\0')
            {
              send_to_char ("Bash who?\n\r", ch);
              return;
            }
          send_to_char ("They aren't here.\n\r", ch);
          return;
        }
      if (victim == ch)
        {
          send_to_char ("You really do look like an idiot!\n\r", ch);
          return;
        }
	/* ----------------------------------------- */
	/*	    Protecting Neutral align.	     */
	/* ----------------------------------------- */
	if (IS_PLAYER(ch) && IS_PLAYER(victim) && ALIGN(victim) == 0 && !IN_BATTLE(ch)
		&& ch->fgt->challenge != 10)
	{
		send_to_char ("A strange force prevents you from harming this person.\n\r", ch);
		return;
	}
	if ( IS_PLAYER(ch) && IS_PLAYER(victim) && ALIGN (ch) == 0 && !IN_BATTLE(ch)
		&& ch->fgt->challenge != 10)
	{
		send_to_char ("A strange force prevents you from attacking other players.\n\r", ch);
		return;
	}

      /* ----------------------------------------- */
      /*      Protecting LinkDead-NoTimers 	   */
      /* ----------------------------------------- */
      if(IS_PLAYER(victim) && victim->desc == NULL) {
        if(!(victim->pcdata->no_quit_pk > 0)) {
	  send_to_char ("You cannot attack someone who exists slightly outside reality.\n\r", ch);
  	  return;
        }
      }

    }
  else
    victim = ch->fgt->fighting;

  if (RIDING (ch) != NULL)
    {
      send_to_char ("You can't bash someone when you are riding!\n\r", ch);
      return;
    }

  if (is_safe (ch, victim))
    {
      return;
    }

  check_ced (ch);
  check_ced (victim);
  if (!(IS_IN_MELEE (ch, victim)))
    {
      send_to_char ("You aren

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

Site Stats

Snippets: 1791
Codebases: 571