fight.c

area/fight.c · 270.0 KB

From the archive cotn-2.5.tar.gz

Download the archive   « Back to the archive contents

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

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

#define MAX_SLAY_TYPES 3
// #define MONK_AUTODROP 12  stock one
// #define MONK_AUTODROP 17    // +5 low4

#define MONK_AUTODROP ch->pcdata->autostance

/*
 * Local functions.
 */

int can_pk	args((CHAR_DATA *ch, CHAR_DATA *victim));
void  autodrop        args((CHAR_DATA *ch));
void  dropinvis       args((CHAR_DATA *ch));
bool  check_dodge     args((CHAR_DATA *ch, CHAR_DATA *victim, int dt));
bool  check_parry     args((CHAR_DATA *ch, CHAR_DATA *victim, int dt));
void  dam_message     args((CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, int hit_loc));
void  death_cry       args((CHAR_DATA *ch));
void  group_gain      args((CHAR_DATA *ch, CHAR_DATA *victim));
int   xp_compute      args((CHAR_DATA *gch, CHAR_DATA *victim));
void  set_fighting    args((CHAR_DATA *ch, CHAR_DATA *victim));
bool  can_counter     args((CHAR_DATA *ch));
bool  can_bypass      args((CHAR_DATA *ch, CHAR_DATA *victim));
int   number_attacks  args((CHAR_DATA *ch, CHAR_DATA *victim));
int   dambonus        args((CHAR_DATA *ch, CHAR_DATA *victim, int dam, int stance));
void  update_damcap   args((CHAR_DATA *ch, CHAR_DATA *victim));
void  decap_message   args((CHAR_DATA *ch, CHAR_DATA *victim));
void  angel_eye       args((CHAR_DATA *ch, CHAR_DATA *victim, int dam));
void  elemental_enflame       args((CHAR_DATA *ch, CHAR_DATA *victim, int dam));
void  vamp_bite       args((CHAR_DATA *ch, CHAR_DATA *victim));
void  ragnarokdecap   args((CHAR_DATA *ch, CHAR_DATA *victim));
bool  can_decapitate  args((CHAR_DATA *ch, CHAR_DATA *victim));

/*
 * Control the fights going on.
 * Called periodically by update_handler.
 */
// void do_weaponpractice (CHAR_DATA *ch, char *argument)

void violence_update( void )
{
  CHAR_DATA *ch;
  CHAR_DATA *ch_next;
  CHAR_DATA *emb;
  CHAR_DATA *victim;
  CHAR_DATA *rch;
  CHAR_DATA *fch;
  CHAR_DATA *rch_next;
  CHAR_DATA *mount;
//	char buf[MSL];
  int chance;
	int r;

  chance = number_percent();

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

    if (victim != NULL) {

    if (IS_SET(ch->flag3, AFF3_BLINK_1ST_RD))
    {
      REMOVE_BIT(ch->flag3, AFF3_BLINK_1ST_RD);
      SET_BIT(ch->flag3, AFF3_BLINK_2ND_RD);
    }
    else if (IS_SET(ch->flag3, AFF3_BLINK_2ND_RD))
    {
      REMOVE_BIT(ch->flag3, AFF3_BLINK_2ND_RD);
      REMOVE_BIT(ch->flag3, AFF3_BLINK_1ST_RD);
      /* Has the victim left? */
      if (victim->in_room != ch->in_room)
      {
        SET_BIT(ch->affected_by2,EXTRA_BLINKY);
        victim = NULL;
        act("$n pops back into existence.", ch, NULL, NULL, TO_ROOM);
        stc("You pop back into existence.\n\r", ch);
        stc("Your victim is no longer in the room.\n\r", ch);
        break;
      }
      SET_BIT(ch->affected_by2,EXTRA_BLINKY);
      act("$n pops back into existence next to $N.", ch,NULL,victim, TO_NOTVICT);
      act("You pop back into existence next to $N.", ch, NULL,victim, TO_CHAR);
      act("$n pops back into existence next to you.", ch, NULL,victim, TO_VICT);
      if (!is_safe(ch,victim)) {
        if (ch->hit > 0) {
        set_fighting(ch, victim);
        do_say(ch, "Muhahahahahaha");
        multi_hit(ch, victim, gsn_blinky);
        if (IS_SET(ch->newbits, THIRD_HAND) && get_eq_char(ch, WEAR_THIRD) != NULL)
          one_hit(ch, victim, gsn_blinky,1);
        if (IS_SET(ch->newbits, FOURTH_HAND) && get_eq_char(ch, WEAR_FOURTH) != NULL)
          one_hit(ch, victim, gsn_blinky,1);
        update_pos(victim);
        WAIT_STATE (ch,24);
        }
      }
    }
    } /*end of blink*/
    ch_next = ch->next;
    if (ch->rage > 0 && (IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
    || IS_CLASS(ch, CLASS_SHADOW_FIEND) || IS_CLASS(ch, CLASS_SHADOW_DRAGON))) ch->rage--;


	//Gemini Cannon
	if(!IS_NPC(ch) && ch->geminicount > 0){
		ch->geminicount--;
		if(ch->geminitar == NULL || ch->geminitar->in_room == NULL || ch->geminitar->in_room == ch->in_room){
			stc("Error, fire aborted!",ch);
			ch->geminicount = 0;
			ch->geminitar = NULL;
		}
		else{
		switch(ch->geminicount){
			case 20:
				act("The cannon extends into the air, and support struts attach to the ground.",ch,NULL,NULL,TO_CHAR);
				act("The cannon extends into the air, and support struts attach to the ground.",ch,NULL,NULL,TO_ROOM);
				break;
			case 16:
				act("Four small spikes extend from the base of the cannon and begin to spin.",ch,NULL,NULL,TO_CHAR);
				act("Four small spikes extend from the base of the cannon and begin to spin.",ch,NULL,NULL,TO_ROOM);
				break;
			case 12:
				act("Energy crackles between the spikes as the cannon charges.",ch,NULL,NULL,TO_CHAR);
				act("Energy crackles between the spikes as the cannon charges.",ch,NULL,NULL,TO_ROOM);
				break;
			case 8:
				act("A glowing ball of energy appears at the mouth of the cannon.",ch,NULL,NULL,TO_CHAR);
				act("A glowing ball of energy appears at the mouth of the cannon.",ch,NULL,NULL,TO_ROOM);
				break;
			case 4:
				act("Energy swirls about the mouth of the cannon, and it begins to glow red.",ch,NULL,NULL,TO_CHAR);
				act("Energy swirls about the mouth of the cannon, and it begins to glow red.",ch,NULL,NULL,TO_ROOM);
				break;
			case 0:
				act("The spikes stops spinning, and then there is a deafening roar as the cannon fires.",ch,NULL,NULL,TO_CHAR);
				act("The spikes stops spinning, and then there is a deafening roar as the cannon fires.",ch,NULL,NULL,TO_ROOM);
				ch->geminitar->hit = ch->geminitar->hit * .65;
				do_info(ch,"The gemini cannon has been fired!");
				stc("Pain wracks your body as you are blasted by the Gemini Cannon.\n\r",ch->geminitar);
				act("A huge beam of energy pierces down from the sky and strikes $n!",ch->geminitar,NULL,NULL,TO_ROOM);
				ch->fight_timer += 20;
				ch->geminitar->fight_timer += 20;
				ch->combat = ch->geminitar;
				break;
		}
		}
	}

    if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_PHOENIX))
    {
    if (ch->phtimer == 1)
    stc("You can utilize the sun's helpful rays once again.\n\r",ch);

    if (!IS_NPC(ch) && ch->phtimer > 0) {
	ch->phtimer--; }
    }
    else
    {
    if (!IS_NPC(ch) && ch->phtimer == 1 && IS_SET(ch->flag2, AFF_TOTALBLIND))
    {
    stc("You can see again.\n\r",ch);
    REMOVE_BIT(ch->flag2, AFF_TOTALBLIND);
    }
    if (!IS_NPC(ch) && ch->phtimer == 1 && (IS_SET(ch->affected_by, AFF_CURSE) || IS_SET(ch->affected_by, AFF_WEBBED)))
    {
    stc("You no longer bear the curse of the phoenix.\n\r",ch);
   if (IS_AFFECTED(ch, AFF_CURSE))
    REMOVE_BIT(ch->affected_by, AFF_CURSE);
   if (IS_AFFECTED(ch, AFF_WEBBED))
    REMOVE_BIT(ch->affected_by, AFF_WEBBED);
    }
    if (!IS_NPC(ch) && ch->phtimer > 0)
    { ch->phtimer--; }
    }

    if (!IS_NPC(ch) && ch->fight_timer > 0) {
	ch->fight_timer--;

	    if (ch->fight_timer == 0){
			if(ch->combat != NULL && !IS_NPC(ch->combat) && ch->combat->fight_timer == 0){
				stc("Your victim is no longer fighting you.\n\r",ch->combat);
			}
/* here */                       
                        if( ragnarok == FALSE ) {
//                        if( ch->pkcurse == 0 ) 
{
                           if(ch->in_room != NULL && !IS_SET(ch->in_room->room_flags,ROOM_SAFE) && !IS_SET(ch->in_room->room_flags, ROOM_ASTRAL) && 
				ch->combat != NULL && ch->fighting == NULL){
				char_from_room(ch);
				char_to_room(ch, get_room_index(ROOM_VNUM_ALTAR));
				stc("You are sent to the temple altar to heal your wounds.\n\r",ch);
			   }
                        }
                        }
			ch->combat = NULL;
			ch->hitfirst = FALSE;
			stc("You are pkable by others again.\n\r",ch);
//			ch->momentum = 0;
		}
	}
	    if (ch->fight_timer == 0){
			ch->combat = NULL;
			ch->hitfirst = FALSE;
//			ch->momentum = 0;
		}

    if (!IS_NPC(ch) && ch->rage > 0 && IS_CLASS(ch, CLASS_DEMON)) ch->rage--;
    if ( ch->embracing != NULL )
    {
      emb = ch->embracing;
      if ( emb == NULL ) ch->embracing = NULL;
      if ( ch->in_room != emb->in_room )
      {
        if ( emb->embraced != NULL )
        {
          emb->embraced = NULL;
          ch->embracing = NULL;
        }
        else ch->embracing = NULL;
      }
    }
    if (!IS_NPC(ch) && ch->embraced != NULL )
    {
      emb = ch->embraced;
      if ( emb == NULL ) ch->embraced = NULL;  
      if ( ch->in_room != emb->in_room )
      {
        if ( emb->embracing != NULL )
        {
          emb->embracing = NULL;
          ch->embraced   = NULL;
        }
        else ch->embraced = NULL;
      }
    }
    if ((victim = ch->fighting ) == NULL || ch->in_room == NULL) continue;
    if (!IS_NPC(ch) && !IS_NPC(victim) && !is_safe(ch, victim) &&!is_safe(victim,ch))
    {
      if (ch->fight_timer < 10) ch->fight_timer = 10;
      else if (ch->fight_timer < 25) ch->fight_timer += 3;
    }
    if (IS_AWAKE(ch) && IS_AWAKE(victim) && ch->in_room == victim->in_room) multi_hit( ch, victim, TYPE_UNDEFINED );
    else stop_fighting(ch, FALSE);
	if(ch->fighting == victim && victim->fighting == NULL) set_fighting(ch,victim);

    if ((victim = ch->fighting ) == NULL) continue;
    /*   
     * Fun for the whole family!
     */
    for ( rch = ch->in_room->people; rch != NULL; rch = rch_next )
    {
      rch_next = rch->next_in_room;

	r = number_range(0,10);
	  if (IS_NPC(rch) && IS_AFFECTED(rch,AFF_CHARM) && is_same_group(ch,rch)){
	if(rch->pIndexData->vnum == 33007 && is_same_group(ch,rch) && r == 1 ){
		  act( "$n rescues you!", rch, NULL, ch, TO_VICT    );
		  fch = ch->fighting;
		  stop_fighting( ch->fighting, FALSE );
		  stop_fighting( ch, FALSE );
		  set_fighting( rch, fch );
		  set_fighting( fch, rch );
		  set_fighting( ch, fch);
		  continue;
	}
	}
      if ( IS_AWAKE(rch) && rch->fighting == NULL )
      {
      /*
       * Mount's auto-assist their riders and vice versa.
       */
        if ( (mount = rch->mount) != NULL )
        {
          if (mount == ch) multi_hit( rch, victim, TYPE_UNDEFINED );
          continue;
        }
        /*
         * PC's auto-assist others in their group.
         */
        if ( !IS_NPC(ch))
        {
          if ((!IS_NPC(rch) || IS_AFFECTED(rch, AFF_CHARM) ) && (is_same_group(ch, rch))){
		if(!IS_NPC(rch) && !IS_NPC(victim) && victim->pcdata->kingdom != 0){
	            if(!is_safe(rch,victim)) multi_hit( rch, victim, TYPE_UNDEFINED );
        	  continue;
		}
/*		else if(IS_NPC(rch) && IS_AFFECTED(rch,AFF_CHARM)){
	            multi_hit( rch, victim, TYPE_UNDEFINED );
		    continue;
		}*/
	  }
	  if (IS_NPC(rch) && IS_AFFECTED(rch,AFF_CHARM) && is_same_group(ch,rch)){
		if(rch->fighting == NULL) multi_hit(rch,victim,TYPE_UNDEFINED );
		continue;
	  }
        }
        /*
         * NPC's assist NPC's of same type or 12.5% chance regardless.
         */
/*        if ( IS_NPC(rch) && !IS_AFFECTED(rch, AFF_CHARM) )
        {   
          if (rch->pIndexData == ch->pIndexData || number_bits(3) == 0)
          {
            CHAR_DATA *vch;
            CHAR_DATA *target;
            int number;
          
            target = NULL;
            number = 0;
            for ( vch = ch->in_room->people; vch; vch = vch->next )
            {
              if (can_see(rch,vch) && is_same_group(vch, victim) && number_range(0,number)==0)
              {
                target = vch;  
                number++;
              }
            }
            if ( target != NULL )
            multi_hit( rch, target, TYPE_UNDEFINED );
          }
        }*/
      }
    }
  }
  return;
}



/*
 * Do one group of attacks.
 */
void multi_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
{
  OBJ_DATA *wield;
  OBJ_DATA *wield1;
  OBJ_DATA *wield2;
  OBJ_DATA *wield3;
  OBJ_DATA *wield4;
  char buf[MAX_STRING_LENGTH];
  int sn, level, chance, unarmed, maxcount,countup,x,wieldie,i;
  AFFECT_DATA af;
  int wieldorig = 0;
  int wieldtype = 0;
  int dam;
  char buf1[MAX_STRING_LENGTH];
  char buf2[MAX_STRING_LENGTH];
  char buf3[MAX_STRING_LENGTH];

  // Assymetric -  Newbie protection - 4 hours
  // This should never come up, but just in case someone finds a back door into combat
  if(!IS_NPC(ch) && !IS_NPC(victim) && ((get_age(victim) - 17) < 2 || (get_age(ch) - 17) < 2))
  {
    stc("You can't attack newbies or attack as a newbie!\n\r", ch);
    stop_fighting(ch, victim);
    return;
  }
/*
   if ((IS_CLASS(ch, CLASS_SHADOW_DRAGON) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND)
|| IS_CLASS(ch, CLASS_STALKER) || IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_SHADOWBORN)
|| IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_HELL_SPAWN) || IS_CLASS(ch, CLASS_VAMPIRIC_MIST)
|| IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_BAATEZU) || IS_CLASS(ch, CLASS_NAZGUL)
|| IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN) || IS_CLASS(ch, CLASS_NECROMANCER) || IS_CLASS(ch, CLASS_HEAVENS_SOLDIER)
|| IS_CLASS(ch, CLASS_SILVER_DRAGON) || IS_CLASS(ch, CLASS_TYPHON)
|| IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_DRUID))
   && (IS_CLASS(victim, CLASS_DEMON)) || IS_CLASS(victim, CLASS_WEREWOLF) || IS_CLASS(victim, CLASS_DROW) 
   || IS_CLASS(victim, CLASS_VAMPIRE) || IS_CLASS(victim, CLASS_TANARRI) || IS_CLASS(victim, CLASS_UNDEAD_KNIGHT)
   || IS_CLASS(victim, CLASS_ANGEL) || IS_CLASS(victim, CLASS_WRAITH) || IS_CLASS(victim, CLASS_ASSASSIN) 
   || IS_CLASS(victim, CLASS_PALADIN) || IS_CLASS(victim, CLASS_DRAGON) || IS_CLASS(victim, CLASS_ELEMENTAL))
  {
    stc("You may not attack Out of your Class Range.\n\r", ch);
    stop_fighting(ch, victim);
    return;
  }
if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_WEREWOLF) || IS_CLASS(ch, CLASS_DROW) 
   || IS_CLASS(ch, CLASS_VAMPIRE) || IS_CLASS(ch, CLASS_TANARRI) || IS_CLASS(ch, CLASS_UNDEAD_KNIGHT)
   || IS_CLASS(ch, CLASS_ANGEL) || IS_CLASS(ch, CLASS_WRAITH) || IS_CLASS(ch, CLASS_ASSASSIN) 
   || IS_CLASS(ch, CLASS_PALADIN) || IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_ELEMENTAL))
   && (IS_CLASS(victim, CLASS_SHADOW_DRAGON)) || IS_CLASS(victim, CLASS_HELLS_SOLDIER) || IS_CLASS(victim, CLASS_SHADOW_FIEND)
|| IS_CLASS(victim, CLASS_STALKER) || IS_CLASS(victim, CLASS_GAIA_WOLF) || IS_CLASS(victim, CLASS_SHADOWBORN)
|| IS_CLASS(victim, CLASS_BLACK_ASSASSIN) || IS_CLASS(victim, CLASS_HELL_SPAWN) || IS_CLASS(victim, CLASS_VAMPIRIC_MIST)
|| IS_CLASS(victim, CLASS_DEVA) || IS_CLASS(victim, CLASS_BAATEZU) || IS_CLASS(victim, CLASS_NAZGUL)
|| IS_CLASS(victim, CLASS_UNDEAD_ASSASSIN) || IS_CLASS(victim, CLASS_NECROMANCER) || IS_CLASS(victim, CLASS_HEAVENS_SOLDIER)
|| IS_CLASS(victim, CLASS_SILVER_DRAGON) || IS_CLASS(victim, CLASS_TYPHON)
|| IS_CLASS(victim, CLASS_GOLD_DRAGON)|| IS_CLASS(victim, CLASS_DRUID))

  {
    stc("You may not attack Out of your Class Range.\n\r", ch);
    stop_fighting(ch, victim);
    return;
  }
*/


  if ( ch->position < POS_SLEEPING ) return;
  if ( IS_CREATOR(ch))
  {
    if (!IS_NPC(ch) && wieldorig == 0 )
    {
      countup = number_range(0,2);
      if (countup == 0) unarmed = number_range(0,3);
      else if (countup == 1) unarmed = number_range(4,7);
      else unarmed = number_range(0,7);
      if (!IS_NPC(ch) && ch->cmbt[unarmed] != 0 && wieldorig == 0)
        fightaction(ch,victim,ch->cmbt[unarmed], dt, wieldtype);
    } 
  } 

 if ( dt == gsn_headbutt )
  {
    one_hit( ch, victim, dt, 1 );
    return;
  }
  if ( dt == gsn_hooves )
  {
    one_hit( ch, victim, dt, 1 );
    one_hit( ch, victim, dt, 1 );
    if (number_range(1,3) != 2)
    {
      one_hit( ch, victim, dt, 1 );
      one_hit( ch, victim, dt, 1 );
    }
    return;
  }
//  if (dt == gsn_shiroken)
//  {
//    for(i = number_range(3,5);i>0;i--)
//      one_hit(ch, victim, dt, 1); 
//    if(ch->pcdata->powers[NPOWER_NINGENNO] >=4)
//      spell_poison(gsn_poison,(ch->level*number_range(50,60)),ch,victim); 
//    return;
//  }

  if ( dt == gsn_laser )
  {
    one_hit(ch,victim,dt,1);
    one_hit(ch,victim,dt,1);
    return;
  }
  if ( dt == gsn_stinger )
  {
    one_hit(ch,victim,dt,1);
    one_hit(ch,victim,dt,1);
    return;
  }
  if (dt == gsn_claws)
   {
    if (!IS_NPC(ch) && (IS_NPC(victim) || !IS_NPC(victim)))  // -xrak, i just threw this in quick
    {
       one_hit(ch, victim, dt, 1);
        one_hit(ch, victim, dt, 1);
        one_hit(ch, victim, dt, 1);
        one_hit(ch,victim,dt,1);
    }
    return;
  }



  if (dt == gsn_tentacle)
  {
    int x;

    act("You shoot forth a shower of tentacles to destroy $N.", ch, NULL, victim, TO_CHAR);
    act("$n shoots forth a shower of tentacles aiming straight at you.", ch, NULL, victim, TO_VICT);
    act("$n shoots forth a shower of tentacles striking $N.", ch, NULL, victim, TO_NOTVICT);

    x = number_range(2, 5);
    while (--x >= 0) one_hit(ch, victim, dt, 1);
    return;
  }
  if ( dt == gsn_fangs )
  {
    if ((IS_CLASS(ch,CLASS_WEREWOLF) || IS_CLASS(ch, CLASS_UNDEAD_LYCAN)) && (ch->power[DISC_WERE_PAIN] > 9))
    {
    one_hit( ch, victim, dt, 1 );
    return;
    }
  } 
  if ( dt== gsn_quills)
 {
    if (!IS_NPC(ch) && (IS_NPC(victim) || !IS_NPC(victim)))  // -xrak, i just threw this in quick
    {
      one_hit(ch,victim,dt,1);
      one_hit(ch,victim,dt,1);
      one_hit(ch,victim,dt,1);
      one_hit(ch,victim,dt,1);
      }
      return;
  }
  if (dt == gsn_darktendrils)
  {
    if (!IS_NPC(ch) && (IS_NPC(victim) || !IS_NPC(victim)))  // -xrak, i just threw this in quick
    {
    one_hit(ch,victim,dt,1);
    one_hit(ch,victim,dt,1);
    one_hit(ch,victim,dt,1);
    one_hit(ch,victim,dt,1);
    }
    return;
  }
  if ( dt==gsn_venomtong)
  {
    one_hit(ch,victim,dt,1);
    return;
  }
  if ( dt==gsn_spiketail)
  {
    one_hit(ch,victim,dt,1);
    return;
  }  
  if ( dt==gsn_badbreath)
  {
    one_hit(ch,victim,dt,1);
    return;
  }  
  if ( dt==gsn_magma)
  {
    one_hit(ch,victim,dt,1);
    return;
  }  
  if ( dt==gsn_shards)
  {
    one_hit(ch,victim,dt,1);
    return;
  }  
  if ( dt==gsn_cheapshot)
  {
    send_to_char("You stun them with a shoulder charge!\n\r",ch);
    send_to_char("You are stunned by a shoulder charge!\n\r",victim);
   {
    one_hit(ch,victim,dt,1);    
    one_hit(ch,victim,dt,1);
    one_hit(ch,victim,dt,1);
    one_hit(ch,victim,dt,1);
    one_hit(ch,victim,dt,1);
  }
    return;
  } 
  if ( dt == gsn_buffet )
  {
    one_hit( ch, victim, dt, 1 );
    return;
  } 

  if ((IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
  || IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON)) 
  && IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_TAIL))
  {
	 if ( number_range (1,18) < ch->pcdata->powers[dragonage])
	 {
		 one_hit ( ch, victim, gsn_spiket, 0);
	 }
	 one_hit ( ch, victim, gsn_spiket, 0);
  }
  if ((IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
  || IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON))
 && IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_WINGS) &&
	  number_range(1,3)==1) one_hit (ch,victim,gsn_buffet,0);
  if ((IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
  || IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON)) && IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_CLAWS))
  {
	  if (number_range(1, 3)==1) one_hit (ch, victim, gsn_claws,0);
	  one_hit (ch, victim, gsn_claws,0);
  }
  if ((IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
  || IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON))
 && IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_FANGS))
  {
	  if (number_range(1,4)==1) one_hit(ch,victim,gsn_rfangs,1);
          if (number_range(1,10)==1)multi_hit(ch,victim,gsn_rfangs);
	  one_hit (ch, victim, gsn_rfangs,0);
  }


  if ( dt == gsn_sweep )
  {
    one_hit( ch, victim, dt, 1 );
    return;
  }
  if ( dt == gsn_rfangs )
  {
    one_hit( ch, victim, dt, 1);
    return;
  }
  if (dt==gsn_heavenlyaura)
  {
    for (i=0; i < x; i++)
      one_hit(ch,victim,dt,1);
    return;
  }
//  if (dt==gsn_mageshield)
//  {
//    if (IS_ITEMAFF(ch, ITEMA_MAGESHIELD))
//    {
//      one_hit(ch,victim,dt,1);
//      one_hit(ch,victim,dt,1);
//      one_hit(ch,victim,dt,1);
//      one_hit(ch,victim,dt,1);
//      one_hit(ch,victim,dt,1);
//    }
//    return;
//  }

/*Wraith Shit*/
  
if ( dt == gsn_dblast)
  {  
    x = number_range(2,5);
    for (i=0; i < x; i++)
      one_hit(ch,victim,dt,1);
    return;
  }

if ( dt == gsn_jugularslice)
 {
x=number_range(2,4); 
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}

if ( dt == gsn_fblast)
{
x=number_range(1,2);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}


if ( dt == gsn_wgust)
{
x=number_range(1,2);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}

if ( dt == gsn_torrent)
{
 x=number_range(1,2);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}

if ( dt == gsn_cblast)
 {
x=number_range(1,2);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}


if ( dt == gsn_rslide)
{
x=number_range(1,2);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}



//  if ( dt == gsn_bladespin)
//  {
//    if (number_range(1,2)==1) one_hit(ch,victim,dt,1);
//    if (number_range(1,2)==1) one_hit(ch,victim,gsn_lightningkick,1);
//    if (number_range(1,2)==1) one_hit(ch,victim,gsn_knee,1);
//    if (number_range(1,2)==1) one_hit(ch,victim,gsn_lightningslash,1);
//    if ((ch->wpn[0] >= 1000)  && (ch->wpn[3] >= 1000)
//    && (ch->wpn[6] >= 1000) && (ch->wpn[9] >= 1000)
//    && (ch->wpn[1] >= 1000) && (ch->wpn[4] >= 1000)
//    && (ch->wpn[7] >= 1000)
//    && (ch->wpn[10] >= 1000) && (ch->wpn[2] >= 1000)
//    && (ch->wpn[5] >= 1000) && (ch->wpn[8] >= 1000)
//    && (ch->wpn[11] >= 1000) && (ch->wpn[12] >= 1000))
//    {
//      if (number_range(1,2)==1) one_hit(ch,victim,dt,1);
//      if (number_range(1,2)==1) one_hit(ch,victim,gsn_lightningkick,1);
//      if (number_range(1,2)==1) one_hit(ch,victim,gsn_knee,1);
//      if (number_range(1,2)==1) one_hit(ch,victim,gsn_lightningslash,1);
//    }
//    return;
//  }
  wield1 = get_eq_char( ch, WEAR_WIELD );
  wield2 = get_eq_char( ch, WEAR_HOLD );
  wield3 = get_eq_char( ch, WEAR_THIRD );
  wield4 = get_eq_char( ch, WEAR_FOURTH);
  if ( wield1 != NULL && wield1->item_type == ITEM_WEAPON ) wieldorig  = 1;
  if ( wield2 != NULL && wield2->item_type == ITEM_WEAPON ) wieldorig += 2;
  if ( wield3 != NULL && wield3->item_type == ITEM_WEAPON ) wieldorig += 4;
  if ( wield4 != NULL && wield4->item_type == ITEM_WEAPON ) wieldorig += 8;
  wieldtype = wieldorig;
  wieldie = number_range(1,4);
  if ( wieldorig == 15 ) 
  { 
    if (wieldie == 2) wieldtype = 8; 
    else wieldtype = 4;
  }
  if ( wieldorig == 14 )
  {
    if (wieldie == 2) wieldtype = 8;
    else if (wieldie == 1) wieldtype = 4;
    else if (wieldie == 3) wieldtype = 2;
    else wieldtype = 1;
  }
  if ( wieldorig == 13 )   {
    if ( wieldie == 1) wieldtype = 8;
    else if (wieldie == 2) wieldtype = 4;
    else wieldtype = 1;    
  }
  if ( wieldorig == 12 )
  {
    if ( wieldie == 1 ) wieldtype = 8;
    else wieldtype = 4;
  }
  if ( wieldorig == 11 )
  {
    if ( wieldie == 1 ) wieldtype = 8;
    if ( wieldie == 2 ) wieldtype = 2;
    else wieldtype = 1;
  }
  if ( wieldorig == 10 )
  {  
    if ( wieldie == 1 ) wieldtype = 8;
    else wieldtype = 2;    
  }
  if ( wieldorig == 9 )
  {
    if ( wieldie == 1 ) wieldtype = 8;
    else wieldtype = 1;
  }
  if ( wieldorig == 8 ) wieldtype = 8;
  if ( wieldorig == 7 )
  {
    if ( wieldie == 1 ) wieldtype = 4;
    else if ( wieldie == 2 ) wieldtype = 2;
    else wieldtype = 1;
  }
  if ( wieldorig == 6 )
  {
    if ( wieldie == 1 || wieldie == 2) wieldtype = 2;
    else wieldtype = 4;
  } 
  if ( wieldorig == 5 )
  {
    if ( wieldie == 1) wieldtype = 4;
    else wieldtype = 1;
  }
  if ( wieldorig == 4 ) wieldtype = 4;
  if ( wieldorig == 3 )    
  {
    if ( wieldie == 2 || wieldie == 4) wieldtype = 2;
    else wieldtype = 1;
  }
  if ( wieldorig == 2 ) wieldtype = 2;
  if ( wieldorig == 1 ) wieldtype = 1;

  if ( wieldtype == 8 ) wield = wield4;
  else if ( wieldtype == 4 ) wield = wield3;
  else if ( wieldtype == 2 ) wield = wield2;
  else wield = wield1;

  if (!IS_NPC(ch) && ch->stance[0] > 0 && number_percent() == 5)
  {
    int stance = ch->stance[0];
    if (ch->stance[stance] >= 200)
    {
      special_move(ch,victim);
      return;
    }    
  }

  unarmed = 0;
  if (IS_SET( ch->flag2, VAMP_OBJMASK) )
  {
    act("You return to your normal form.",ch,NULL,NULL,TO_CHAR);
    sprintf(buf,"%s reforms as %s.\n\r",ch->morph, ch->name );
    act(buf,ch,NULL,NULL,TO_ROOM);
    free_string(ch->morph);
    free_string(ch->objdesc);
    ch->long_descr = str_dup("");
    REMOVE_BIT(ch->flag2, VAMP_OBJMASK);
    REMOVE_BIT(ch->affected_by, AFF_POLYMORPH);
  }
  one_hit( ch, victim, dt, wieldtype );

  if ( victim == NULL || victim->position != POS_FIGHTING ) return;

  /* Only want one spell per round from spell weapons...otherwise it's 
   * too powerful, and would unbalance player killing (as this is a PK mud).
   */

  if ( dt == TYPE_UNDEFINED )
  {
    dt = TYPE_HIT;
    if ( wield != NULL && wield->item_type == ITEM_WEAPON )
    {
      dt += wield->value[3];
      if (wield->value[0] >= 1)
      {
        /* Look, just don't ask...   KaVir */
        if (wield->value[0] >= 1000) sn = wield->value[0] - ((wield->value[0] / 1000) * 1000);
        else sn = wield->value[0];
        if (sn != skill_lookup("gas breath") && sn != skill_lookup("desanct") && sn != skill_lookup("sleep") && sn != 0)
        {
          if (victim->position == POS_FIGHTING) (*skill_table[sn].spell_fun) (sn,wield->level,ch,victim);
        }
      }
    }
  }
  if ( victim == NULL || victim->position != POS_FIGHTING ) return;
  if ( !IS_NPC(ch) && (IS_CLASS(ch, CLASS_UNDEAD_LYCAN) || IS_CLASS(ch, CLASS_HELL_SPAWN) 
    || IS_CLASS(ch, CLASS_VAMPIRIC_MIST) || IS_CLASS(ch, CLASS_VAMPIRE))) vamp_bite(ch,victim);
  if ( ch->fighting != victim || dt == gsn_backstab 
	|| dt == gsn_garotte || dt == gsn_headbutt || dt == gsn_circle || dt == gsn_jugularslice 
      || dt == gsn_poisonbreath || dt == gsn_fbreath || dt == gsn_lbreath || dt == gsn_frbreath
      || dt == gsn_dbreath || dt == gsn_retribution) return;
  maxcount = number_attacks(ch, victim);
  if (!IS_NPC(ch))
  {
    chance = 0;
    if (wield != NULL && wield->item_type == ITEM_WEAPON)
    {
      int tempnum = wield->value[3];
      chance = (ch->wpn[tempnum]) * 0.5;
    }
    else chance = (ch->wpn[0]) * 0.5;
    if (number_percent() <= chance) maxcount += 1;
  }
  if (wieldorig == 3) maxcount += 1;
  for (countup = 0; countup <= maxcount; countup++)
  {
    wieldtype = wieldorig;
    if ( wieldorig == 15 ) 
    { 
      if (wieldie == 2)  wieldtype = 8; 
      else wieldtype = 4;
    }
    if ( wieldorig == 14 )
    {
      if (wieldie == 2) wieldtype = 8;
      else if (wieldie == 1) wieldtype = 4;
      else if (wieldie == 3) wieldtype = 2;
      else wieldtype = 1;
    }
    if ( wieldorig == 13 )
    {
      if ( wieldie == 1) wieldtype = 8;
      else if (wieldie == 2) wieldtype = 4;
      else wieldtype = 1;    
    }
    if ( wieldorig == 12 )
    {
      if ( wieldie == 1 ) wieldtype = 8;
      else wieldtype = 4;
    }
    if ( wieldorig == 11 )
    {
      if ( wieldie == 1 ) wieldtype = 8;
      if ( wieldie == 2 ) wieldtype = 2;
      else wieldtype = 1;
    }
    if ( wieldorig == 10 )
    {
      if ( wieldie == 1 ) wieldtype = 8;
      else wieldtype = 2;
    }
    if ( wieldorig == 9 )
    {
      if ( wieldie == 1 ) wieldtype = 8;
      else wieldtype = 1;
    }
    if ( wieldorig == 7 )
    {
      if ( wieldie == 1 ) wieldtype = 4;
      else if ( wieldie == 2 ) wieldtype = 2;
      else wieldtype = 1;
    }
    if ( wieldorig == 6 )
    {
      if ( wieldie == 1 || wieldie == 2) wieldtype = 2;
      else wieldtype = 4;
    } 
    if ( wieldorig == 5 )
    {
      if ( wieldie == 1) wieldtype = 4;
      else wieldtype = 1;
    }
    if ( wieldorig == 3 )
    {
      if ( wieldie == 2 || wieldie == 4) wieldtype = 2;
      else wieldtype = 1;
    }
    one_hit( ch, victim, -1, wieldtype );
    if ( victim == NULL || victim->position != POS_FIGHTING ) return;
    if ( ch->fighting != victim ) return;
  }
  if (!IS_NPC(ch) && IS_VAMPAFF(ch,VAM_FANGS))
  {
     if (!IS_NPC(victim)) {
       one_hit(ch,victim, (TYPE_HIT + 10),0);
       one_hit( ch, victim, ( TYPE_HIT + 10 ), 0 );
     }
     else {
       one_hit(ch,victim, (TYPE_HIT + 10),1);
       one_hit( ch, victim, ( TYPE_HIT + 10 ), 1 );
     }
  }
     if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
      || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
      && IS_SET(ch->warp, WARP_SPIKETAIL) && number_range(1,3) == 1)
  {
    if (IS_NPC(victim)) {
      one_hit( ch, victim, gsn_spiket, 0);
      one_hit( ch, victim, gsn_spiket, 1);
    }
    else one_hit( ch, victim, gsn_spiket, 0);
  }
  /* Golems speciels */
  if (IS_NPC(ch))
  {
    if (ch->pIndexData->vnum == MOB_VNUM_FIRE)
    {
      if ((sn = skill_lookup( "curse" ) ) > 0)
        (*skill_table[sn].spell_fun) (sn,50,ch,victim);
      if ((sn = skill_lookup( "imp faerie fire" ) ) > 0)
        (*skill_table[sn].spell_fun) (sn,50,ch,victim);
    }
    if (ch->pIndexData->vnum == MOB_VNUM_STONE)
    {
      af.type      = skill_lookup("reserved");  
      af.duration  = 20;
      af.location  = APPLY_DAMROLL;
      af.modifier  = -50;
      af.bitvector = 0;
      affect_to_char(victim, &af );
    
      af.type      = skill_lookup("reserved");
      af.duration  = 20;
      af.location  = APPLY_HITROLL;
      af.modifier  = -50;
      af.bitvector = 0;
      affect_to_char(victim, &af );
      send_to_char("You feel weak in the presence of the stone golem.\n\r",victim);
    }
    if (ch->pIndexData->vnum == MOB_VNUM_CLAY)
    {
      if ((sn = skill_lookup( "clay" ) ) > 0)
        (*skill_table[sn].spell_fun) (sn,50,ch,victim);
    }
    if (ch->pIndexData->vnum == MOB_VNUM_IRON)
    {
      if ((sn = skill_lookup( "group heal" ) ) > 0)
        (*skill_table[sn].spell_fun) (sn,50,ch,victim);
    }
  }
     if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
      || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
      && IS_SET(ch->warp, WARP_SHARDS) && number_range(1,3) == 1)
    one_hit( ch, victim, gsn_shards, 0);
     if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
     && IS_SET(ch->warp, WARP_MAGMA) && number_range(1,3) == 1)
  {
    if (IS_NPC(victim)) {
      one_hit( ch, victim, gsn_magma, 0);
      one_hit( ch, victim, gsn_magma, 1);
    }
    else one_hit( ch, victim, gsn_magma, 0);
  }
     if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
      && IS_SET(ch->warp, WARP_VENOMTONG) && number_range(1,3) == 1)
    one_hit( ch, victim, gsn_venomt, 0);  
  if ( victim == NULL || victim->position != POS_FIGHTING ) return;
  if (!IS_NPC(ch) && !IS_NPC(victim))  // pkpower
  {
    if (get_ratio(ch) > 2499)
    {
      i = number_range(1,10);
      if (i < 5) one_hit(ch,victim, gsn_supreme,0);
      else if (i < 7) one_hit(ch,victim, gsn_supreme,1);
      else ;
    }
  }

  if (!IS_NPC(ch) && ch->level > 2)
  {
    if ((IS_CLASS(ch, CLASS_UNDEAD_LYCAN) || IS_CLASS(ch, CLASS_HELL_SPAWN) 
    || IS_CLASS(ch, CLASS_VAMPIRIC_MIST) || IS_CLASS(ch, CLASS_VAMPIRE)
    || IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
    || IS_CLASS(ch, CLASS_SHADOW_FIEND) || IS_CLASS(ch, CLASS_SHADOW_DRAGON))
    && IS_VAMPAFF(ch,VAM_HORNS) && number_range(1,3) == 1)
     {
      multi_hit( ch, victim, gsn_headbutt );
     }
  }
     if ((IS_CLASS(ch, CLASS_TANARRI) || IS_CLASS(ch, CLASS_DEVA) 
      || IS_CLASS(ch, CLASS_HELL_SPAWN) || IS_CLASS(ch, CLASS_BAATEZU)) && !IS_NPC(ch))
  {
    if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_FANGS))
    {
      one_hit(ch, victim, gsn_fangs, 1);
      if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_HEAD)) one_hit(ch, victim, gsn_fangs, 1);
    }
    if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_FIERY))
    {
      one_hit(ch, victim, gsn_fiery, 1);
      if (IS_CLASS(victim, CLASS_ANGEL)) one_hit(ch, victim, gsn_fiery, 1);
    }
  }
    if ((IS_CLASS(ch, CLASS_UNDEAD_KNIGHT) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN)
    || IS_CLASS(ch, CLASS_NAZGUL) || IS_CLASS(ch, CLASS_NECROMANCER))
    && ch->pcdata->powers[WEAPONSKILL] > 9)
  {
    one_hit(ch,victim,gsn_lightningslash,1);
    one_hit(ch,victim,gsn_lightningslash,1);
    one_hit(ch,victim,gsn_lightningslash,1);
  }

     if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
     && IS_DEMAFF(ch,DEM_HORNS) && number_range(1,3) == 1)
    one_hit( ch, victim, gsn_headbutt, 0 );

     if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND)) 
     && number_range(1,3) == 1 && ch->power[DISC_DAEM_HELL] > 3)
    one_hit(ch, victim, gsn_hellfire, 0);

     if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND)) 
     && IS_DEMAFF(ch, DEM_TAIL) && number_range(1,2) == 2)
    one_hit( ch, victim, gsn_sweep, 0 );

     if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
     || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
     && ch->pcdata->powers[ASSASSIN_COMBAT] >= 4 && number_range(1,2) != 1)
    multi_hit(ch, victim, gsn_jugularslice);

//     if (IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
//     || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
 if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_WRAITH) || IS_CLASS(ch, CLASS_SHADOWBORN)
    || IS_CLASS(ch, CLASS_SHADOW_FIEND) || IS_CLASS(ch, CLASS_VAMPIRIC_MIST))
    && ch->pcdata->powers[WRAITH_WRATH] >=1 && number_range(1,2) != 1)
    multi_hit(ch, victim, gsn_dblast);
  if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_DRUID)
    || IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_NECROMANCER)
    || IS_CLASS(ch, CLASS_ELEMENTAL)) && ch->pcdata->powers[ELEMENTAL_FIRE] >=1 && number_range(1,2) != 1)
    multi_hit(ch, victim, gsn_fblast);
  if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_DRUID)
    || IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_NECROMANCER)
    || IS_CLASS(ch, CLASS_ELEMENTAL)) && ch->pcdata->powers[ELEMENTAL_AIR] >=1 && number_range(1,2) != 1)
    multi_hit(ch, victim, gsn_wgust);
  if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_DRUID)
    || IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_NECROMANCER)
    || IS_CLASS(ch, CLASS_ELEMENTAL)) && ch->pcdata->powers[ELEMENTAL_WATER] >=1 && number_range(1,2) != 1)
    multi_hit(ch, victim, gsn_torrent);
  if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_DRUID)
    || IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_NECROMANCER)
    || IS_CLASS(ch, CLASS_ELEMENTAL)) && ch->pcdata->powers[ELEMENTAL_EARTH] >=1 && number_range(1,2) != 1)
    multi_hit(ch, victim, gsn_rslide);
  if (!IS_NPC(ch) && IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) && number_range(1,2) != 1)
    multi_hit(ch, victim, gsn_cblast);

  if (!IS_NPC(ch))
  {
    if (IS_VAMPAFF(ch,VAM_TAIL) && number_range(1,2) == 1)
      multi_hit( ch, victim, gsn_sweep );
  }
  
  if (!IS_NPC(ch) && IS_VAMPAFF(ch,VAM_HEAD) && number_range(1,2) == 1)
  {
    multi_hit( ch, victim, gsn_fangs );
  }
  if (!IS_NPC(ch) && IS_SET(ch->newbits,NEW_QUILLS) && (IS_CLASS(ch,CLASS_WEREWOLF) 
  || IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
  || IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER)))
    multi_hit(ch,victim,gsn_quills);

  if (!IS_NPC(ch) && IS_SET(ch->newbits, NEW_DARKTENDRILS) 
  && (IS_CLASS(ch, CLASS_DROW) || IS_CLASS(ch, CLASS_BLACK_ASSASSIN)
  || IS_CLASS(ch, CLASS_STALKER) || IS_CLASS(ch, CLASS_SHADOWBORN)))
    multi_hit(ch,victim,gsn_darktendrils);

  if (!IS_NPC(ch) && IS_SET(ch->newbits,NEW_MULTIARMS))
    multi_hit(ch,victim,gsn_mageshield);
if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_WRAITH) || IS_CLASS(ch, CLASS_SHADOWBORN)
    || IS_CLASS(ch, CLASS_SHADOW_FIEND) || IS_CLASS(ch, CLASS_VAMPIRIC_MIST)))

  {
  if (IS_SET(ch->pcdata->powers[WRAITH_POWERS], WRAITH_AURA)) multi_hit(ch,victim,gsn_dblast);
  }

  if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_PALADIN) || IS_CLASS(ch, CLASS_HEAVENS_SOLDIER)
    || IS_CLASS(ch, CLASS_DRUID) || IS_CLASS(ch, CLASS_GOLD_DRAGON))
    && IS_SET(ch->pcdata->powers[PALADIN_EFFECTS], PAL_AURA))
// && (IS_CLASS(ch,CLASS_PALADIN)
  {
    one_hit(ch,victim,gsn_holyaura,1);
    one_hit(ch,victim,gsn_holyaura,1);
    one_hit(ch,victim,gsn_holyaura,1);
    one_hit(ch,victim,gsn_holyaura,1);
  }


  if (!IS_NPC(ch) && (IS_CLASS(ch,CLASS_ANGEL) || IS_CLASS(ch,CLASS_HEAVENS_SOLDIER)
  || IS_CLASS(ch,CLASS_TYPHON) || IS_CLASS(ch,CLASS_SILVER_DRAGON)))
    {
    if (IS_SET(ch->pcdata->powers[ANGEL_POWERS], ANGEL_AURA))
    {
	one_hit(ch,victim,gsn_heavenlyaura,1);
	one_hit(ch,victim,gsn_heavenlyaura,1);
	one_hit(ch,victim,gsn_heavenlyaura,1);
    }
    if (IS_SET(ch->pcdata->powers[ANGEL_POWERS], ANGEL_HALO))
    {
      switch(number_range(1,5))
      {
        default : break;
        case 1 :
          if ((sn = skill_lookup( "curse" ) ) > 0)
            (*skill_table[sn].spell_fun) (sn,50,ch,victim);
          break;
        case 2 :
          if ((sn = skill_lookup( "web" ) ) > 0)
            (*skill_table[sn].spell_fun) (sn,50,ch,victim);
          break;
        case 3 :
          if ((sn = skill_lookup( "imp heal" ) ) > 0)
            (*skill_table[sn].spell_fun) (sn,50,ch,victim);
          break;
        case 4 :
          if ((sn = skill_lookup( "imp fireball" ) ) > 0)
            (*skill_table[sn].spell_fun) (sn,50,ch,victim);
          break;
        case 5 :
          if ((sn = skill_lookup( "godbless" ) ) > 0)
            (*skill_table[sn].spell_fun) (sn,50,ch,victim);
          break;
      }
    }
  }
 
    if (!IS_NPC(ch) && (IS_CLASS(ch,CLASS_WEREWOLF) || IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
    || IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER)))
  {
    if (IS_SET(ch->newbits,NEW_SLAM) && number_range(1,5-ch->power[DISC_WERE_BEAR]/3)==1)
      multi_hit(ch,victim,gsn_cheapshot);
  }
  if (!IS_NPC(ch) && IS_VAMPAFF(ch,VAM_WINGS) && number_range(1,2) == 1 && ch->level > 2)
    multi_hit( ch, victim, gsn_buffet );

  if (!IS_NPC(ch) && IS_VAMPAFF(ch,VAM_WINGS) && number_range(1,2) == 1 && ch->level > 2)
    multi_hit( ch, victim, gsn_buffet );
     if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND)) 
     && IS_SET(ch->warp, WARP_WINGS) && number_range(1,3) == 1)
    one_hit(ch, victim, gsn_buffet, 0 );

  if (!IS_NPC(ch) && (IS_CLASS(ch,CLASS_WEREWOLF) || IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
    || IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER)) && ch->power[DISC_WERE_RAPT] > 0)
    multi_hit(ch,victim,gsn_rfangs);
  if ( victim == NULL || victim->position != POS_FIGHTING ) return;

  if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_UNDEAD_LYCAN) || IS_CLASS(ch, CLASS_HELL_SPAWN) 
    || IS_CLASS(ch, CLASS_VAMPIRIC_MIST) || IS_CLASS(ch, CLASS_VAMPIRE))
    && IS_VAMPAFF(ch, VAM_SERPENTIS))
    spell_poison( gsn_poison, (ch->level*number_range(5,10)),ch,victim );

  else if (!IS_NPC(ch) && (IS_CLASS(ch,CLASS_WEREWOLF)
    || IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER))
    && ch->power[DISC_WERE_SPID] > 0)
    spell_poison( gsn_poison, (ch->level*number_range(5,10)),ch,victim );

  else if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_DROW) || IS_CLASS(ch, CLASS_BLACK_ASSASSIN)
  || IS_CLASS(ch, CLASS_STALKER) || IS_CLASS(ch, CLASS_SHADOWBORN)) 
  && IS_SET(ch->pcdata->powers[1], DPOWER_DROWPOISON))
    spell_poison(gsn_poison,(ch->level*number_range(10,20)),ch,victim);

   if (victim->itemaffect < 1) return;
  if (IS_NPC(victim) || victim->spl[1] < 4) level = victim->level;
  else level = (victim->spl[1] * 0.25);
  if (IS_SET(victim->newbits, NEW_MONKFLAME) && !IS_AFFECTED(ch, AFF_FLAMING))
  {
    if (number_percent() > 95)
    {
      SET_BIT(ch->affected_by, AFF_FLAMING);
      if (!IS_NPC(ch) && (!IS_CLASS(ch,CLASS_WEREWOLF) || !IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
      || !IS_CLASS(ch, CLASS_GAIA_WOLF) || !IS_CLASS(ch, CLASS_STALKER)))
      {
        act("Your flaming hands catch $n on fire!", ch, NULL, victim, TO_VICT);
        act("$N's flaming hands catch $n on fire!", ch, NULL, victim, TO_NOTVICT);
        act("$N's flaming hands catch you on fire!.", ch, NULL, victim, TO_CHAR);
      }
      else
      {
      act("Your flaming claws catch $n on fire!", ch, NULL, victim, TO_VICT);
      act("$N's flaming claws catch $n on fire!", ch, NULL, victim, TO_NOTVICT);
      act("$N's flaming claws catch you on fire!.", ch, NULL, victim, TO_CHAR);
      }
    }
    else return;
  }
  if (!IS_NPC(victim))
  {
  if (IS_SET(victim->pcdata->powers[AURAS], DEATH_AURA) && (IS_CLASS(victim, CLASS_UNDEAD_KNIGHT)
  || IS_CLASS(victim, CLASS_UNDEAD_ASSASSIN)
  || IS_CLASS(victim, CLASS_NAZGUL) || IS_CLASS(victim, CLASS_NECROMANCER)))

  {
    while (number_range(1,2) != 1)
      one_hit(victim,ch,gsn_deathaura,0);
  }
  if (IS_SET(victim->pcdata->powers[AURAS], FEAR_AURA) && (IS_CLASS(victim, CLASS_UNDEAD_KNIGHT)
  || IS_CLASS(victim, CLASS_UNDEAD_ASSASSIN) || IS_CLASS(victim, CLASS_NAZGUL) || IS_CLASS(victim, CLASS_NECROMANCER)))

  {
    af.type      = skill_lookup("reserved");
    af.duration  = 20;
    af.location  = APPLY_DAMROLL;
    af.modifier  = -20;
    af.bitvector = 0;
    affect_to_char(ch, &af );

    af.type      = skill_lookup("reserved");
    af.duration  = 20;                      
    af.location  = APPLY_HITROLL;
    af.modifier  = -20;                             
    af.bitvector = 0;
    affect_to_char(ch, &af );
    send_to_char("You piss your pants out of fear.\n\r",ch);
  }
  }
  if (IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD) && ch->position == POS_FIGHTING)
    if ( (sn = skill_lookup( "lightning bolt" ) ) > 0)
      (*skill_table[sn].spell_fun) (sn,level,victim,ch);
  if (IS_ITEMAFF(victim, ITEMA_FIRESHIELD) && ch->position == POS_FIGHTING)
    if ( (sn = skill_lookup( "fireball" ) ) > 0)
      (*skill_table[sn].spell_fun) (sn,level,victim,ch);
  if (IS_ITEMAFF(victim, ITEMA_ICESHIELD) && ch->position == POS_FIGHTING)
    if ( (sn = skill_lookup( "chill touch" ) ) > 0)
      (*skill_table[sn].spell_fun) (sn,level,victim,ch);
  if (IS_ITEMAFF(victim, ITEMA_ACIDSHIELD) && ch->position == POS_FIGHTING)
    if ( (sn = skill_lookup( "acid blast" ) ) > 0)
      (*skill_table[sn].spell_fun) (sn,level,victim,ch);
//  if (IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) && ch->position == POS_FIGHTING)
//    if ( (sn = skill_lookup( "chaos blast" ) ) > 0)
//      (*skill_table[sn].spell_fun) (sn,level,victim,ch);
//	{
//      one_hit(ch,victim,gsn_heavenlyaura,1);
//      }


    if (IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) && ch->position == POS_FIGHTING)
	{
      one_hit(victim,ch,gsn_cblast,1);
      }

  return;
}

int number_attacks( CHAR_DATA *ch, CHAR_DATA *victim )
{
  int count = 1;
  char buf[MSL];

  if (IS_NPC(ch))
  {
    if (ch->level >= 50) count += 1;
    if (ch->level >= 100) count += 1;
    if (ch->level >= 500) count += 1;
    if (ch->level >= 1000) count +=1;
    if (ch->level >= 1500) count +=1;
    if (ch->level >= 2000) count +=2;
    if( ch->pIndexData->hitsizedice > 20) count += 20;
    else count += ch->pIndexData->hitsizedice;
    return count;
  }
  if (IS_NPC(victim))
  {
    if ( IS_STANCE(ch, STANCE_VIPER) && number_percent() < ch->stance[STANCE_VIPER] * 0.5) count += 1;
    else if ( IS_STANCE(ch, STANCE_MANTIS) && number_percent() < ch->stance[STANCE_MANTIS] * 0.5) count += 1;
    else if ( IS_STANCE(ch, STANCE_TIGER) && number_percent() < ch->stance[STANCE_TIGER] * 0.5) count += 1;
    else if ( IS_STANCE(ch, STANCE_WOLF) && number_percent() < ch->stance[STANCE_WOLF] * 0.5) count += 2;
	  else if ( IS_STANCE(ch, STANCE_BEAR) && number_percent() > 
	ch->stance[STANCE_BEAR] * 0.7) count += 3;
    if (!IS_NPC(ch)) 
    {   
      if (ch->pcdata->upgrade_level > 0) count += ( ch->pcdata->upgrade_level );
      if ((IS_CLASS(ch, CLASS_UNDEAD_LYCAN) || IS_CLASS(ch, CLASS_HELL_SPAWN) 
    || IS_CLASS(ch, CLASS_VAMPIRIC_MIST) || IS_CLASS(ch, CLASS_VAMPIRE))  && ch->power[DISC_VAMP_CELE] > 0)
      {
        count += .5;
        if (ch->power[DISC_VAMP_CELE] > 5)
        {
          count += .5;
          if ( ch->power[DISC_VAMP_CELE] > 7)
          {
            count += .5;
            if ( ch->power[DISC_VAMP_CELE] > 9)
              count += .5;
          }
        }
      }
      if (IS_CLASS(ch, CLASS_TANARRI) || IS_CLASS(ch, CLASS_DEVA) 
      || IS_CLASS(ch, CLASS_HELL_SPAWN) || IS_CLASS(ch, CLASS_BAATEZU)) count += ch->pcdata->tanrank;

      if (IS_CLASS(ch, CLASS_WRAITH) || IS_CLASS(ch, CLASS_SHADOWBORN)
      || IS_CLASS(ch, CLASS_SHADOW_FIEND) || IS_CLASS(ch, CLASS_VAMPIRIC_MIST)) count += ch->pcdata->powers[WRAITH_WRATH]/2;

    if (IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_DRUID)
    || IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_NECROMANCER)
    || IS_CLASS(ch, CLASS_ELEMENTAL)) count += 10;
// ch->pcdata->powers[ELEMENTAL_FIRE]/2;

    if (IS_CLASS(ch, CLASS_HEAVENS_SOLDIER) || IS_CLASS(ch, CLASS_TYPHON)
    || IS_CLASS(ch, CLASS_ANGEL) || IS_CLASS(ch, CLASS_SILVER_DRAGON)) count += ch->pcdata->powers[ANGEL_JUSTICE];

    if (IS_CLASS(ch, CLASS_PALADIN) || IS_CLASS(ch, CLASS_HEAVENS_SOLDIER)
    || IS_CLASS(ch, CLASS_DRUID) || IS_CLASS(ch, CLASS_GOLD_DRAGON)) count += ch->pcdata->powers[PALADIN_SPEED]*1.6;

      if (IS_EXTRA(victim, PINNEDWALL)) count+=9;  

      if (IS_EXTRA(ch, EXTRA_SLOW)) count -= 8;

    if (IS_CLASS(ch,CLASS_WEREWOLF) || IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
    || IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER))
      {
        if (ch->power[DISC_WERE_LYNX] > 2 )count += 2;
        if (ch->power[DISC_WERE_BOAR] > 6)
        {
          if( ch->move > 40000 ) count += 5;
          else count += ch->move/8000;
        }
      }
    if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN)
    || IS_CLASS(ch, CLASS_NAZGUL) || IS_CLASS(ch, CLASS_NECROMANCER))
        count += ch->pcdata->powers[WEAPONSKILL]/2;

     if (IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
      {
        if (IS_DEMPOWER( ch, DEM_SPEED)) count += 2;     
        if (IS_SET(ch->warp, WARP_QUICKNESS)) count += 3;
      }
    // GryphonHawk
  if (IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
  || IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON))
 count += (ch->pcdata->powers[dragonage]/2.5);

 if (IS_CLASS(ch, CLASS_HYDRA) || IS_CLASS(ch, CLASS_NAZGUL) 
 || IS_CLASS(ch, CLASS_TYPHON) || IS_CLASS(ch, CLASS_BAATEZU)) count += 6;



    if (IS_CLASS(ch, CLASS_DROW) || IS_CLASS(ch, CLASS_BLACK_ASSASSIN)
    || IS_CLASS(ch, CLASS_STALKER) || IS_CLASS(ch, CLASS_SHADOWBORN))
      {
        if (IS_SET(ch->special, SPC_DROW_WAR)) count += 2;
        if (IS_SET(ch->pcdata->powers[1],DPOWER_SPEED)) count += 3;
      }
     if (IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
     || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
      {
        if (ch->pcdata->powers[ASSASSIN_COMBAT] >=3) count += 3;
        if (ch->pcdata->powers[ASSASSIN_POWER] == 1) count += 1;
        if (ch->pcdata->powers[ASSASSIN_POWER] == 2) count += 1;
        if (ch->pcdata->powers[ASSASSIN_POWER] == 3) count += 2;
        if (ch->pcdata->powers[ASSASSIN_POWER] == 4) count += 2;
        if (ch->pcdata->powers[ASSASSIN_POWER] == 5) count += 3;
        if (ch->pcdata->powers[ASSASSIN_POWER] == 6) count += 3;
        if (ch->pcdata->powers[ASSASSIN_POWER] == 7) count += 4;
        if (ch->pcdata->powers[ASSASSIN_POWER] == 8) count += 4;
        if (ch->pcdata->powers[ASSASSIN_POWER] == 9) count += 5;
        if (ch->pcdata->powers[ASSASSIN_POWER] >= 10)count += 6;
      }

      if ( IS_ITEMAFF(ch, ITEMA_SPEED) ) count += 4;
    }
  }
  else
  {
    // Assymetric - this used to be upgrade_level * 3, seems too high
    if (!IS_NPC(ch)) if (ch->pcdata->upgrade_level > 0) count += ( ch->pcdata->upgrade_level );
    if ( IS_STANCE(ch, STANCE_VIPER) && number_percent() <  ch->stance[STANCE_VIPER] * 0.5) count += 1;
    else if ( IS_STANCE(ch, STANCE_MANTIS) && number_percent() < ch->stance[STANCE_MANTIS] * 0.5) count += 1;
    else if ( IS_STANCE(ch, STANCE_TIGER) && number_percent() < ch->stance[STANCE_TIGER] * 0.5) count += 1;
    else if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_SPEED) 
    && number_percent() < ch->stance[(ch->stance[0])] * 0.5 ) count += 2;
    if (!IS_NPC(ch))
    {
    if (IS_CLASS(ch, CLASS_UNDEAD_LYCAN) || IS_CLASS(ch, CLASS_HELL_SPAWN) 
    || IS_CLASS(ch, CLASS_VAMPIRIC_MIST) || IS_CLASS(ch, CLASS_VAMPIRE))
      {
        if (ch->power[DISC_VAMP_CELE] > 0) count += 1;
        if (ch ->power[DISC_VAMP_CELE] > 5) count += 1;
        if (ch->power[DISC_VAMP_CELE] > 7) count += 1;
        if ( ch->power[DISC_VAMP_CELE] > 9) count += 1;
      }
    if (IS_CLASS(ch, CLASS_HEAVENS_SOLDIER) || IS_CLASS(ch, CLASS_TYPHON)
     || IS_CLASS(ch, CLASS_ANGEL) || IS_CLASS(ch, CLASS_SILVER_DRAGON)) count += 4;
    if (IS_CLASS(ch, CLASS_WRAITH) || IS_CLASS(ch, CLASS_SHADOWBORN)
     || IS_CLASS(ch, CLASS_SHADOW_FIEND) || IS_CLASS(ch, CLASS_VAMPIRIC_MIST)) count += 5;
    if (IS_CLASS(ch, CLASS_DROW) || IS_CLASS(ch, CLASS_BLACK_ASSASSIN)
     || IS_CLASS(ch, CLASS_STALKER) || IS_CLASS(ch, CLASS_SHADOWBORN)) count += 3;
    if (IS_CLASS(ch, CLASS_PALADIN) || IS_CLASS(ch, CLASS_HEAVENS_SOLDIER)
     || IS_CLASS(ch, CLASS_DRUID) || IS_CLASS(ch, CLASS_GOLD_DRAGON)) count += 5;
    if (IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_DRUID)
     || IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_NECROMANCER)
     || IS_CLASS(ch, CLASS_ELEMENTAL)) count += 4; // Was 12, WAY too high
    if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN)
    || IS_CLASS(ch, CLASS_NAZGUL) || IS_CLASS(ch, CLASS_NECROMANCER)) count += 4;
    if (IS_CLASS(ch,CLASS_WEREWOLF) || IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
    || IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER))
      {
        if ( ch->power[DISC_WERE_LYNX] > 2) count += 1;
        if ( ch->power[DISC_WERE_BOAR] > 6)
        { // This used to be divided by 1.5k and over 15k you'd get 10 // 
 // OK UL melee SUCKED so i put it back -Xrak
          if (ch->move > 80000)
            count +=10;
          else count += (ch->move/150000); // dropped this from 2 well see.. -Xrak
        }
      }
      if (IS_CLASS(ch, CLASS_TANARRI) || IS_CLASS(ch, CLASS_DEVA) 
       || IS_CLASS(ch, CLASS_HELL_SPAWN) || IS_CLASS(ch, CLASS_BAATEZU))
      {
        count += ch->pcdata->tanrank;
        if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_SPEED)) count += 4;
      }
      if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT))
        count += ch->pcdata->powers[WEAPONSKILL]/3;


/*      if (IS_CLASS(ch, CLASS_ELEMENTAL))
      {
	if (ch->pcdata->powers[ELEMENTAL_FIRE] > 1) count += 3;
	if (ch->pcdata->powers[ELEMENTAL_WATER] > 2) count += 3;
	if (ch->pcdata->powers[ELEMENTAL_AIR] > 2) count += 3;
	if (ch->pcdata->powers[ELEMENTAL_EARTH] > 2) count += 3;
      }
*/

     if (IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
     || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
      {
	if (ch->pcdata->powers[ASSASSIN_POWER] == 1) count += 1;
	if (ch->pcdata->powers[ASSASSIN_POWER] == 2) count += 1;
	if (ch->pcdata->powers[ASSASSIN_POWER] == 3) count += 2;
	if (ch->pcdata->powers[ASSASSIN_POWER] == 4) count += 2;
	if (ch->pcdata->powers[ASSASSIN_POWER] == 5) count += 3;
	if (ch->pcdata->powers[ASSASSIN_POWER] == 6) count += 4;
	if (ch->pcdata->powers[ASSASSIN_POWER] == 7) count += 4;
	if (ch->pcdata->powers[ASSASSIN_POWER] == 8) count += 5;
	if (ch->pcdata->powers[ASSASSIN_POWER] == 9) count += 6;
	if (ch->pcdata->powers[ASSASSIN_POWER] >= 10)count += 7;
      }

      if ( IS_ITEMAFF(ch, ITEMA_SPEED) ) count += 4;
      if (!IS_NPC(ch) && IS_ITEMAFF(ch, ITEMA_BEAST)) count += 4;

	 // GryphonHawk
  if (IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
  || IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON))
 count += (ch->pcdata->powers[dragonage]/3);

 if (IS_CLASS(ch, CLASS_HYDRA) || IS_CLASS(ch, CLASS_NAZGUL) 
 || IS_CLASS(ch, CLASS_TYPHON) || IS_CLASS(ch, CLASS_BAATEZU)) count += 7;


     if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
     && ch->power[DISC_DAEM_ATTA] > 0) count += ch->power[DISC_DAEM_ATTA] / 2;
      if (IS_CLASS(ch, CLASS_DROW))
      {
        if (IS_SET(ch->special, SPC_DROW_WAR)) count += 3;
        if (IS_SET(ch->pcdata->powers[1],DPOWER_SPEED)) count += 3;
      }
    }

    // Assymetric - Anti-class bonuses
    // Xrak - hybrid antis will have to be by other hybrids
    // with the two base classes as a referance vs other Hybrids
    if (IS_CLASS(ch, CLASS_TANARRI) && IS_CLASS(victim, CLASS_ANGEL)
        || IS_CLASS(ch, CLASS_ANGEL) && IS_CLASS(victim, CLASS_DEMON)
        || IS_CLASS(ch, CLASS_DEMON) && IS_CLASS(victim, CLASS_WEREWOLF)
        || IS_CLASS(ch, CLASS_WEREWOLF) && IS_CLASS(victim, CLASS_VAMPIRE)
        || IS_CLASS(ch, CLASS_VAMPIRE) && IS_CLASS(victim, CLASS_UNDEAD_KNIGHT)
        || IS_CLASS(ch, CLASS_UNDEAD_KNIGHT) && IS_CLASS(victim, CLASS_WRAITH)
        || IS_CLASS(ch, CLASS_WRAITH) && IS_CLASS(victim, CLASS_ELEMENTAL)
        || IS_CLASS(ch, CLASS_ELEMENTAL) && IS_CLASS(victim, CLASS_DRACONIAN)
        || IS_CLASS(ch, CLASS_DRACONIAN) && IS_CLASS(victim, CLASS_DROW)
        || IS_CLASS(ch, CLASS_DROW) && IS_CLASS(victim, CLASS_PALADIN)
        || IS_CLASS(ch, CLASS_PALADIN) && IS_CLASS(victim, CLASS_ASSASSIN)
        || IS_CLASS(ch, CLASS_ASSASSIN) && IS_CLASS(victim, CLASS_TANARRI))
    {
      count += 2;
    }
    else if (IS_CLASS(victim, CLASS_TANARRI) && IS_CLASS(ch, CLASS_ANGEL)
        || IS_CLASS(victim, CLASS_ANGEL) && IS_CLASS(ch, CLASS_DEMON)
        || IS_CLASS(victim, CLASS_DEMON) && IS_CLASS(ch, CLASS_WEREWOLF)
        || IS_CLASS(victim, CLASS_WEREWOLF) && IS_CLASS(ch, CLASS_VAMPIRE)
        || IS_CLASS(victim, CLASS_VAMPIRE) && IS_CLASS(ch, CLASS_UNDEAD_KNIGHT)
        || IS_CLASS(victim, CLASS_UNDEAD_KNIGHT) && IS_CLASS(ch, CLASS_WRAITH)
        || IS_CLASS(victim, CLASS_WRAITH) && IS_CLASS(ch, CLASS_ELEMENTAL)
        || IS_CLASS(victim, CLASS_ELEMENTAL) && IS_CLASS(ch, CLASS_DRACONIAN)
        || IS_CLASS(victim, CLASS_DRACONIAN) && IS_CLASS(ch, CLASS_DROW)
        || IS_CLASS(victim, CLASS_DROW) && IS_CLASS(ch, CLASS_PALADIN)
        || IS_CLASS(victim, CLASS_PALADIN) && IS_CLASS(ch, CLASS_ASSASSIN)
        || IS_CLASS(victim, CLASS_ASSASSIN) && IS_CLASS(ch, CLASS_TANARRI))
    {
      count -= 1;
    }

    if (victim->power[DISC_VAMP_CELE] >= 3)
      count -= victim->power[DISC_VAMP_CELE] / 3;
    if (victim->power[DISC_WERE_MANT] >= 3)
      count -= victim->power[DISC_WERE_MANT] / 3;
    else if (IS_ITEMAFF(victim, ITEMA_AFFMANTIS))
      count -= 1;
    if (victim->power[DISC_DAEM_ATTA] > 0)
      count -= victim->power[DISC_DAEM_ATTA] / 3;
    if (number_range(1,4) == 2)
      count -= 1;
  }
  if ( count < 1)
  count = 1;

  sprintf(buf, "Number of attacks: %d\n\r", count);
  stc(buf, ch);

  return count;
}


/*
 * Hit one guy once.
 */
void one_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt, int handtype)
{
  OBJ_DATA *wield;
  int victim_ac;
  int thac0;
  int thac0_00;
  int thac0_32;
  int dam, wdam;
  int diceroll;
  int level;
  int attack_modify;
  int right_hand;

  // Assymetric -  Newbie protection - 4 hours
  // This should never come up, but just in case someone finds a back door into combat
  if(!IS_NPC(ch) && !IS_NPC(victim) && ((get_age(victim) - 17) < 2 || (get_age(ch) - 17) < 2))
  {
    stc("You can't attack newbies or attack as a newbie!\n\r", ch);
    stop_fighting(ch, victim);
    return;
  }

  /*
   * Can't beat a dead char!
   * Guard against weird room-leavings.
   */
  if (victim->position == POS_DEAD || ch->in_room != victim->in_room)
    return;
  if ( !IS_NPC(ch) )
  {
    if (IS_AFFECTED( ch, AFF_PEACE) && ch->fighting != NULL)
    REMOVE_BIT(ch->affected_by, AFF_PEACE);
  }
  if ( !IS_NPC(victim) )
  {
    if (IS_AFFECTED(victim, AFF_PEACE) && victim->fighting != NULL)
    REMOVE_BIT(victim->affected_by, AFF_PEACE);
  }
  /*
   * Figure out the type of damage message.
   */
  if (handtype == 8)
  {
    wield = get_eq_char( ch, WEAR_FOURTH );
    right_hand = 8;
  }
  else if (handtype == 4)
  {
    wield = get_eq_char( ch, WEAR_THIRD );
    right_hand = 4;
  }
  else if (handtype == 2)
  {
    wield = get_eq_char( ch, WEAR_HOLD );
    right_hand = 2;
  }
  else if (handtype == 0) 
  {
    wield = NULL;
    right_hand = 0;
  }
  else
  {
    if (IS_SET(ch->act, PLR_RIGHTHAND))
      wield = get_eq_char( ch, WEAR_WIELD );
    else if (IS_SET(ch->act, PLR_LEFTHAND))
      wield = get_eq_char( ch, WEAR_HOLD );
    else
    {
      if (number_range(1,10) > 4)
        wield = get_eq_char( ch, WEAR_HOLD );
      else
        wield = get_eq_char( ch, WEAR_WIELD );
    }
    right_hand = 1; // improve the right hand anyway...
  }
  if ( dt == TYPE_UNDEFINED )
  {
    dt = TYPE_HIT;
    if ( wield != NULL && wield->item_type == ITEM_WEAPON )
      dt += wield->value[3];
  }
  if (ch->wpn[dt-1000] > 5) level = (ch->wpn[dt-1000] / 5);
  else level = 1;
  if (level > 40) level = 40;

  /*
   * Calculate to-hit-armor-class-0 versus armor.
   */
  if ( IS_NPC(ch) )
  {
    thac0_00 = 20;
    thac0_32 =  0;
  }
  else
  {
    thac0_00 = SKILL_THAC0_00;
    thac0_32 = SKILL_THAC0_32;
  }
  thac0     = interpolate( level, thac0_00, thac0_32 ) - char_hitroll(ch);
  victim_ac = UMAX( -100, char_ac(victim) / 10 );
  if (!can_see( ch, victim ))
    victim_ac -= 4;
  if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_3))
    victim_ac += 300;
  if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_2))
    victim_ac += 200;
  if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_1))
    victim_ac += 100;

  
  /*
   * The moment of excitement!
   */
  while ((diceroll = number_bits( 5 ) ) >= 20)
  ;

  if ( diceroll == 0 || ( diceroll != 19 && diceroll < thac0 - victim_ac ) )
  { /* Miss. */
    damage( ch, victim, 0, dt );
    tail_chain( );
    if (!is_safe(ch,victim))
    {
      improve_wpn(ch,dt,right_hand);
      improve_stance(ch);
    }
    return;
  }

  /*
   * Hit.
   * Calc damage.
   */
  if ( IS_NPC(ch) )
  {
    dam = number_range( ch->level / 2, ch->level * 3 / 2 );
    if (ch->level >= 300) dam *= ch->level / 500;
    if ( wield != NULL )
      dam += dam * 0.5;
  }
  else
  {
    if (dt == gsn_mageshield)
    {
      dam = (ch->spl[RED_MAGIC] + ch->spl[YELLOW_MAGIC] + ch->spl[GREEN_MAGIC] 
             + ch->spl[PURPLE_MAGIC] + ch->spl[BLUE_MAGIC])/5;
      dam = number_range(2*dam, 3*dam);
    }
    else if (wield != NULL && wield->item_type == ITEM_WEAPON)
      dam = dice( wield->value[1], wield->value[2] );
    else if ( IS_VAMPAFF(ch, VAM_CLAWS) && IS_GAR1(ch, WOLF_RAZORCLAWS))
      dam = dice( 25, 35 ); 
    else if ( IS_VAMPAFF(ch,VAM_CLAWS))
      dam = dice( 10, 20 );
    else
      dam = dice( 4, 10 );
    // This really shouldn't be done this way, but regardless, I changed the dice to reasonable values
     if ((IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
     || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
     && ch->pcdata->powers[ASSASSIN_POWER] == 7)
      dam += dice( 1, 10 );
     if ((IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
     || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
     && ch->pcdata->powers[ASSASSIN_POWER] == 8)
      dam += dice( 3, 10 );
     if ((IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
     || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
     && ch->pcdata->powers[ASSASSIN_POWER] == 9)
      dam += dice( 5, 10 );
     if ((IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
     || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
     && ch->pcdata->powers[ASSASSIN_POWER] >= 10)
      dam += dice( 7, 10 );
     if (IS_CLASS(ch, CLASS_PALADIN) || IS_CLASS(ch, CLASS_HEAVENS_SOLDIER)
     || IS_CLASS(ch, CLASS_DRUID) || IS_CLASS(ch, CLASS_GOLD_DRAGON))
      dam += dice( 5, 10 );
  }
  /*
   * Bonuses.
   */
  dam += char_damroll(ch);
  if (!IS_AWAKE(victim)) dam *= 2;
  if (!IS_NPC(ch) && dt >= TYPE_HIT) dam = dam + (dam * (UMIN(350,(ch->wpn[dt-1000]+1)) / 60));

if (IS_CLASS(ch, CLASS_DRAGON)) dam * 3.0;
  /* Other Resistances */
   
  if (IS_ITEMAFF(victim, ITEMA_RESISTANCE))
  {
    dam *= 3;
    dam /= 4;
  }

  /* damage reduction */
  if (!IS_NPC(ch) && !IS_NPC(victim)) dam /= 2;  /* slow down pk */
  if (IS_NPC(ch) && dam > 2000) dam = 2000 + (dam-2000)/2;    /* mob damage >2000 halved */
  if ( dam <= 0 ) dam = 5;

  /* up that damage */
  if (!IS_NPC(ch)) {
    if (ch->pcdata->upgrade_level == 1)
//      dam *= 1.05;
      dam *= .55;
    else if (ch->pcdata->upgrade_level == 2)
//      dam *= 1.10;
      dam *= 1.05;
    else if (ch->pcdata->upgrade_level == 3)
//      dam *= 1.15;
      dam *= 1.55;
    else if (ch->pcdata->upgrade_level == 4)
//      dam *= 1.20;
      dam *= 2.05;
    else if (ch->pcdata->upgrade_level == 5)
//      dam *= 1.25;
      dam *= 2.95;
    else if (ch->pcdata->upgrade_level == 6)
//      dam *= 1.29;
      dam *= 3.45;
    else if (ch->pcdata->upgrade_level == 7)
//      dam *= 1.33;
      dam *= 3.55;
    else if (ch->pcdata->upgrade_level == 8)
//      dam *= 1.36;
      dam *= 4.05;
    else if (ch->pcdata->upgrade_level == 9)
//      dam *= 1.39;
      dam *= 4.55;
    else if (ch->pcdata->upgrade_level >= 10)
//      dam *= 1.42;
      dam *= 5.05;

    /* 5% extra damage per level */
  }

  /*
   * I doubt this has much effect - Jobo
   */
// Assymetric -- previously this only applied when the victim was an NPC
  if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_UNDEAD_LYCAN) || IS_CLASS(ch, CLASS_HELL_SPAWN) 
    || IS_CLASS(ch, CLASS_VAMPIRIC_MIST) || IS_CLASS(ch, CLASS_VAMPIRE)))
    dam *= (1 + ch->power[DISC_VAMP_POTE]/15);

  if (IS_CLASS(ch, CLASS_TANARRI) || IS_CLASS(ch, CLASS_DEVA) 
   || IS_CLASS(ch, CLASS_HELL_SPAWN) || IS_CLASS(ch, CLASS_BAATEZU))
  {
    if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_MIGHT)) dam *= 1.5;
  }

  /*
   * This one for angels have no effect, take a look and rebalance. Jobo
   */
  if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_HEAVENS_SOLDIER) || IS_CLASS(ch, CLASS_TYPHON)
    || IS_CLASS(ch, CLASS_ANGEL) || IS_CLASS(ch, CLASS_SILVER_DRAGON))) dam *= (1 + ch->pcdata->powers[ANGEL_JUSTICE] / 10);
/* Assymetric - stupidly overpowered and gone
  if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_WRAITH) || IS_CLASS(ch, CLASS_SHADOWBORN)
    || IS_CLASS(ch, CLASS_SHADOW_FIEND) || IS_CLASS(ch, CLASS_VAMPIRIC_MIST))) dam *= 2;
  if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER)
  || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
     dam *=2; 
  if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_ELEMENTAL)) dam *=2; 
*/

  if ( !IS_NPC(ch) && (IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
  || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
  &&  IS_DEMPOWER(ch, DEM_MIGHT))
    dam *= 1.1;
  if (!IS_NPC(ch) && !IS_NPC(victim) && IS_CLASS(ch, CLASS_UNDEAD_KNIGHT)) dam *= 1.2;
  if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER)))
  {
// Assymetric - I cut all the multipliers here in half
    if (ch->pcdata->powers[ASSASSIN_POWER] == 1) dam *= 1.05;
    else if (ch->pcdata->powers[ASSASSIN_POWER] == 2) dam *= 1.1;
    else if (ch->pcdata->powers[ASSASSIN_POWER] == 3) dam *= 1.15;
    else if (ch->pcdata->powers[ASSASSIN_POWER] == 4) dam *= 1.2;
    else if (ch->pcdata->powers[ASSASSIN_POWER] == 5) dam *= 1.25;
    else if (ch->pcdata->powers[ASSASSIN_POWER] == 6) dam *= 1.3;
    else if (ch->pcdata->powers[ASSASSIN_POWER] == 7) dam *= 1.35;
    else if (ch->pcdata->powers[ASSASSIN_POWER] == 8) dam *= 1.4;
    else if (ch->pcdata->powers[ASSASSIN_POWER] == 9) dam *= 1.45;
    else if (ch->pcdata->powers[ASSASSIN_POWER] >= 10) dam *= 1.5;
  }

  if ( !IS_NPC(ch) && (IS_CLASS(ch, CLASS_TANARRI) || IS_CLASS(ch, CLASS_DEVA) 
    || IS_CLASS(ch, CLASS_HELL_SPAWN) || IS_CLASS(ch, CLASS_BAATEZU)))    dam   *= 1.5;
//  if ( !IS_NPC(ch) && (IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_HELL_SPAWN) || IS_CLASS(ch, CLASS_BAATEZU)))  dam   *= 3.0;
// -Xrak opps i forgot tan hybrids get dam mod of other base class too so i probably shouldnt up it from 3.
   
  if ( !IS_NPC(ch) && (IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
     &&  IS_SET(ch->warp, WARP_STRONGARMS))
    dam   *= 1.2;

  if ( !IS_NPC(ch) && (IS_CLASS(ch, CLASS_PALADIN) || IS_CLASS(ch, CLASS_HEAVENS_SOLDIER)
    || IS_CLASS(ch, CLASS_DRUID) || IS_CLASS(ch, CLASS_GOLD_DRAGON)))
  {
    dam *= 1.3;
    dam *= 20 + ch->pcdata->powers[PALADIN_POWER];
    dam /= 20;
  }

  if(IS_NPC(victim)) {

  if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_3)
    && ch->stance[(ch->stance[0])] >100)
      dam += dam * 1.5 * (ch->stance[(ch->stance[0])] / 200);
  else if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_2)
    && ch->stance[(ch->stance[0])] >100)
      dam += dam * 1.0 * (ch->stance[(ch->stance[0])] / 200);
  else if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_1)
    && ch->stance[(ch->stance[0])] >100)
      dam += dam * 0.5 * (ch->stance[(ch->stance[0])] / 200);
  }

  if(!IS_NPC(victim)) {
    
  if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_3)
    && ch->stance[(ch->stance[0])] >100)
      dam += dam * 0.5 * (ch->stance[(ch->stance[0])] / 200);
  else if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_2)
    && ch->stance[(ch->stance[0])] >100)
      dam += dam * 0.3 * (ch->stance[(ch->stance[0])] / 200);
  else if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_1)
    && ch->stance[(ch->stance[0])] >100)
      dam += dam * 0.1 * (ch->stance[(ch->stance[0])] / 200);
  }

  if ( victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_RESIST_3)
    && victim->stance[(victim->stance[0])] >100)
      dam *= 0.7;
  else if ( victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_RESIST_2)
    && victim->stance[(victim->stance[0])] >100)
      dam *= 0.8;
  else if ( victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_RESIST_1)
    && victim->stance[(victim->stance[0])] >100)
      dam *= 0.9;

  /* The test ends here */

  if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN)
    || IS_CLASS(ch, CLASS_NAZGUL) || IS_CLASS(ch, CLASS_NECROMANCER))
  {
    if (ch->pcdata->powers[WEAPONSKILL] > 4) dam *=1.2;
    if (ch->pcdata->powers[WEAPONSKILL] > 8) dam *=1.3;
  }
  // Assymetric - this used to be 13.2!
  if (!IS_NPC(ch) && (IS_CLASS(ch,CLASS_WEREWOLF) || IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
    || IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER))
     && ch->power[DISC_WERE_BEAR] > 5)
    dam *= 1.2;
  if (!IS_NPC(victim) && (IS_CLASS(ch, CLASS_DROW) || IS_CLASS(ch, CLASS_BLACK_ASSASSIN)
  || IS_CLASS(ch, CLASS_STALKER) || IS_CLASS(ch, CLASS_SHADOWBORN)) && IS_SET(victim->newbits, NEW_DARKTENDRILS))
  {
    int ddodge = number_range(1,50);
    if (ddodge == 10 || ddodge == 20 || ddodge == 30 || ddodge == 40 || ddodge == 50)
    {
      stc("#0You dark aura absorbs the damage#n.\n\r",victim);
      stc("#0Your opponent's dark aura absorbs your damage#n.\n\r",ch);
      dam = 0;
    }
  }
  if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_WRAITH) || IS_CLASS(victim, CLASS_SHADOWBORN)
    || IS_CLASS(victim, CLASS_SHADOW_FIEND) || IS_CLASS(victim, CLASS_VAMPIRIC_MIST)) && 
IS_SET(victim->pcdata->powers[WRAITH_POWERS], WRAITH_DIMEDODGE))
  {
    if (number_range(1,11) == 2)
    { 
      stc("#0You jump dimensions to dodge their attack.#n\n\r",victim);
      stc("#0Your opponent slips temporarily into his dimension, escaping your blow.#n\n\r",ch);
      dam = 0;
    }
  }
  if (!IS_NPC(victim) && IS_ITEMAFF(victim, ITEMA_ILLUSIONS))
  {
    int ddodge = number_range(1,50);
    if (ddodge == 10 || ddodge == 20 || ddodge == 30 || ddodge == 40 || ddodge == 50)
    {
      stc("#CYour illusion takes the blow, saving you from harm#n.\n\r",victim);
      stc("#CYour weapon passes through your opponent without doing any harm#n.\n\r",ch);
      dam = 0;
    }
  }
  if (!IS_NPC(ch) && wield != NULL)
  {
    if (number_range(1,6) == 2)
    {
      if (ch->fighting == victim && IS_WEAP(wield,WEAPON_VAMPIRIC))
      {
        wdam = number_range(1,wield->level / 5 + 1);
        act("$p draws life from $n.",victim,wield,NULL,TO_ROOM);
        act("You feel $p drawing your life away.",
        victim,wield,NULL,TO_CHAR);
        hurt_person(ch,victim, wdam); 
        if (victim->hit <= 0) return;
      }
      if (ch->fighting == victim && (IS_WEAP(wield,WEAPON_FLAMING) || IS_WEAP(wield, WEAPON_ELE_FLAME)))
      {
        wdam = number_range(1,wield->level / 4 + 1);
        if (!IS_SET(ch->act, PLR_BRIEF2)) act("$N is burned by your $p.", ch, wield, victim, TO_CHAR);
        if (!IS_SET(victim->act, PLR_BRIEF2)) act("You are burned by $n's $p.", ch, wield, victim, TO_VICT);
        fire_effect( (void *) victim,wield->level/2,wdam,TARGET_CHAR);
        hurt_person(ch, victim, wdam);
        if (victim->hit <= 0) return;
      }
      if (ch->fighting == victim && (IS_WEAP(wield,WEAPON_FROST) || IS_WEAP(wield, WEAPON_ELE_WATER)))
      {
        int sn = skill_lookup("chill touch");
        if (!is_affected(victim,sn)) {
        wdam = number_range(1,wield->level / 6 + 2);
        if (!IS_SET(ch->act, PLR_BRIEF2)) act("Your $p freezes $N.", ch, wield, victim, TO_CHAR);
        if (!IS_SET(victim->act, PLR_BRIEF2)) act("You are frozen by $n's $p.", ch, wield, victim, TO_VICT);
        cold_effect(victim,wield->level/2,wdam,TARGET_CHAR);
        hurt_person(ch,victim, wdam); }
        if (victim->hit <= 0) return;
      }
      if (ch->fighting == victim && IS_WEAP(wield, WEAPON_ELE_EARTH) )
      {
        wdam = number_range(1,wield->level / 5 + 2);
        act("$p covers $n in acid.",victim,wield,NULL,TO_ROOM);
        act("The corrosive touch of $p surrounds you with acid.",
        victim,wield,NULL,TO_CHAR);
        acid_effect(victim,wield->level/2,wdam,TARGET_CHAR);
        hurt_person(ch,victim, wdam);
        if (victim->hit <= 0) return;
      }
      if (ch->fighting == victim && (IS_WEAP(wield,WEAPON_SHOCKING)  || IS_WEAP(wield, WEAPON_ELE_AIR)))
      {
        wdam = number_range(1,wield->level/5 + 2);
        act("$n is struck by lightning from $p.",victim,wield,NULL,TO_ROOM);
        act("You are shocked by $p.",victim,wield,NULL,TO_CHAR);
        shock_effect(victim,wield->level/2,wdam,TARGET_CHAR);
        hurt_person(ch,victim, wdam);
        if (victim->hit <= 0) return;
      }
    }
  }
  if ( dt == gsn_garotte )
    dam *= (number_range(3,5));
   
  if ( dt == gsn_backstab ) {
     if (IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
     || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN)
     && !IS_NPC(ch) && ch->pcdata->powers[ASSASSIN_COMBAT] >=2)
// Assymetric - why the hell is this so high? At least it's damcapped...
// Cause its backstab assy :) -xrak dont look at me btw *points at jobo*
    dam *= number_range(50,60);
    else if( IS_CLASS(ch, CLASS_DROW))
    {
      dam += number_range(100,1000);
      dam *= number_range(7,10);
    }
    else dam *= number_range(2,4);
  }
  /*
   * Damage type modifiers.
   */
  if (dt == gsn_magma && IS_CLASS(ch, CLASS_TANARRI))  dam *= 1.5;        
  if (dt == gsn_magma && (IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_HELL_SPAWN) || IS_CLASS(ch, CLASS_BAATEZU))) dam *= 1.5;


  if (dt == gsn_booming && !IS_NPC(ch) && IS_CLASS(ch, CLASS_TANARRI))    dam *= ch->pcdata->tanrank/2; // -xrak rank is max 6 so this is 3
  if (dt == gsn_booming && !IS_NPC(ch) && !IS_CLASS(ch, CLASS_TANARRI))   dam *= ch->pcdata->tanrank/2; 

/* if (dt == gsn_circle && ch->pcdata->rank == BELT_EIGHT)    dam *= 2;
 * if (dt == gsn_circle && ch->pcdata->rank == BELT_NINE)     dam *= 2.5;
 * if (dt == gsn_circle && ch->pcdata->rank == BELT_TEN)      dam *= 3.0;
 */
  if (dt == gsn_blinky)					     dam *= 3.5; // Assymetric - this used to be 20! -Xrak +1.5 from me..
  if (dt == gsn_circle && IS_CLASS(ch, CLASS_ASSASSIN)) dam *= 2.0;
  if (dt == gsn_circle && (IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) 
  || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN)))                   dam *= 3.5;
  if (dt == gsn_retribution && IS_CLASS(ch, CLASS_PALADIN))  dam *= 2.0;
  if (dt == gsn_retribution && IS_CLASS(ch, CLASS_ANGEL))    dam *= 2.0;
  if (dt == gsn_retribution && !IS_CLASS(ch, CLASS_ANGEL) && !IS_CLASS(ch, CLASS_PALADIN))    dam *= 3.5; // -xrak i picked a random modifier
  if (dt == gsn_deathaura)                                   dam /= 1.7;                                  // i'll adjust it later
  if (dt == gsn_potato)                                      dam /= 2;
  if (dt == gsn_shred)                                       dam *= 2;
  if (dt == gsn_dblast)                                      dam *= 2;
  if (dt == gsn_grimtouch)                                   dam *= 3; 
  if (dt == gsn_fblast && IS_CLASS(ch, CLASS_ELEMENTAL))     dam *= 5; // was 2
  if (dt == gsn_wgust && IS_CLASS(ch, CLASS_ELEMENTAL))      dam *= 4.5;
  if (dt == gsn_torrent && IS_CLASS(ch, CLASS_ELEMENTAL))    dam *= 4;
  if (dt == gsn_rslide && IS_CLASS(ch, CLASS_ELEMENTAL))     dam *= 5;
//  if (dt == gsn_abreath && IS_CLASS(ch, CLASS_ELEMENTAL))   dam *= 10;
  if (dt == gsn_fblast && !IS_CLASS(ch, CLASS_ELEMENTAL))     dam *= 5;
  if (dt == gsn_wgust && !IS_CLASS(ch, CLASS_ELEMENTAL))      dam *= 5;
  if (dt == gsn_torrent && !IS_CLASS(ch, CLASS_ELEMENTAL))    dam *= 5;
  if (dt == gsn_rslide && !IS_CLASS(ch, CLASS_ELEMENTAL))     dam *= 5;
//  if (dt == gsn_abreath && !IS_CLASS(ch, CLASS_ELEMENTAL))   dam *= 11;

    //    if (dt == gsn_fireball)                                  dam *= 4;
//    return;
//    }
  if (!IS_NPC(ch) && ch->pcdata->legend > 0) dam += ch->pcdata->legend * 200;
//    if (ch->pcdata->legend > 0) dam += ch->pcdata->legend * 200;

  dam = cap_dam(ch,victim,dam);
  if( IS_NPC(ch) && ch->pIndexData->hitplus > 3) dam *=3;
  else if( IS_NPC(ch) && ch->pIndexData->hitplus > 0 ) dam *= ch->pIndexData->hitplus;

  if( IS_NPC(victim) && !IS_NPC(ch))
  {
    if( victim->pIndexData->hitnodice > 100 ) victim->pIndexData->hitnodice = 0;
    dam = dam * (100 - victim->pIndexData->hitnodice) / 100;
  }

  attack_modify = dice(1, 100);
  randomize_damage(ch,dam,attack_modify);
  if (dt == gsn_deathaura && dam >= victim->hit && IS_NPC(victim)) dam = victim->hit-1; /* trust me, Jobo */
  damage( ch, victim, dam, dt );

  tail_chain( );
  if (!is_safe(ch,victim))
  {
    improve_wpn(ch,dt,right_hand);
    improve_stance(ch);
  }
}

int randomize_damage( CHAR_DATA *ch, int dam, int am )
{
  dam = dam * (am + 50) / 100;
  return dam;
}

int cap_dam(CHAR_DATA *ch, CHAR_DATA *victim, int dam)
{
  if (is_safe(ch, victim)) return 0;

  if (!IS_NPC(victim)) {
    if (victim->pcdata->upgrade_level == 1)
      dam *= 0.95;
    else if (victim->pcdata->upgrade_level == 2)
      dam *= 0.90;
    else if (victim->pcdata->upgrade_level == 3)
      dam *= 0.85;
    else if (victim->pcdata->upgrade_level == 4)
      dam *= 0.80;
    else if (victim->pcdata->upgrade_level == 5)
      dam *= 0.75;
    /* 5% less damage per level */
  }
  if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_DROW) || IS_CLASS(victim, CLASS_BLACK_ASSASSIN)
  || IS_CLASS(victim, CLASS_STALKER) || IS_CLASS(victim, CLASS_SHADOWBORN)))
  {
    if (IS_SET(victim->pcdata->powers[1], DPOWER_TOUGHSKIN))
      dam /= 3;
  }
  if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_WRAITH) || IS_CLASS(victim, CLASS_SHADOWBORN)
    || IS_CLASS(victim, CLASS_SHADOW_FIEND) || IS_CLASS(victim, CLASS_VAMPIRIC_MIST)))
  {
    dam /=2;
  }
  if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_ASSASSIN) || IS_CLASS(victim, CLASS_HELLS_SOLDIER) 
  || IS_CLASS(victim, CLASS_BLACK_ASSASSIN) || IS_CLASS(victim, CLASS_UNDEAD_ASSASSIN))
  {
    if (victim->pcdata->powers[ASSASSIN_POWER] >= 1) dam /= 2.2;
    else dam /=2;
  }

  if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_GAIA_WOLF) || IS_CLASS(victim, CLASS_DRUID)
    || IS_CLASS(victim, CLASS_DEVA) || IS_CLASS(victim, CLASS_NECROMANCER)
    || IS_CLASS(victim, CLASS_ELEMENTAL)))
  {
    dam /=2;
  }

  if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_PALADIN) || IS_CLASS(victim, CLASS_HEAVENS_SOLDIER)
    || IS_CLASS(victim, CLASS_DRUID) || IS_CLASS(victim, CLASS_GOLD_DRAGON)))
  {
    dam /=2;
    dam *= 20 - victim->pcdata->powers[PALADIN_TOUGHNESS];
    dam /= 20;
  }

  if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_HEAVENS_SOLDIER) || IS_CLASS(victim, CLASS_TYPHON)
    || IS_CLASS(victim, CLASS_SILVER_DRAGON) || IS_CLASS(victim, CLASS_ANGEL)))
  {
    dam *= (100 - (victim->pcdata->powers[ANGEL_HARMONY] * 12));
    dam /= 100;
  }
  if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_TANARRI) 
  || IS_CLASS(victim, CLASS_DEVA) || IS_CLASS(victim, CLASS_HELL_SPAWN) 
  || IS_CLASS(victim, CLASS_BAATEZU)))
  {
    if (IS_SET(victim->pcdata->powers[TANARRI_POWER], TANARRI_EXOSKELETON)) dam *= 0.20;
    if (IS_CLASS(ch, CLASS_ANGEL)) dam *= 0.75; /* trained to kill angels */
  }
//  if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_DEVA) || IS_CLASS(victim, CLASS_HELL_SPAWN) || IS_CLASS(victim, CLASS_BAATEZU)))
//  {
//    if (IS_SET(victim->pcdata->powers[TANARRI_POWER], TANARRI_EXOSKELETON)) dam *= 0.40;
//    -xrak The random damage uppin boogie. (afterthought)accualy on second thought their gettin dam mod from
//    other base class so i should leave this shit alone
//    note to self only fuck with dam mods that arnt doubled by other base class
//    such as middys and autoattacks.
//    if (IS_CLASS(ch, CLASS_ANGEL)) dam *= 0.75; /* trained to kill angels */
//    dont need the angel one hybrids aint gonna be able to fight em
//  }


  if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_UNDEAD_LYCAN) || IS_CLASS(victim, CLASS_HELL_SPAWN) 
    || IS_CLASS(victim, CLASS_VAMPIRIC_MIST) || IS_CLASS(victim, CLASS_VAMPIRE)))

  {
    if (victim->power[DISC_VAMP_PROT] >= 10) dam /= 1.5;
    if (victim->power[DISC_VAMP_FORT] > 0)
    {
      dam *= (100 - (victim->power[DISC_VAMP_FORT] * 5.5));
      dam /= 100;
    }
  }
  else dam = dam;

  if (!IS_NPC(victim) && (IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))) 
  {
    if (victim->power[DISC_DAEM_IMMU] > 0)
    {
      dam *= (100 - (victim->power[DISC_DAEM_IMMU] * 4));
      dam /= 100;
    }
    if (IS_DEMPOWER( victim, DEM_TOUGH))    dam *= 0.8;
    if (IS_SET(victim->warp, WARP_STAMINA)) dam *= 0.8;
    if (IS_SET(victim->warp, WARP_SBODY))   dam *= 0.8;
    if (IS_SET(victim->warp, WARP_CBODY))   dam *= 0.8;    
  }



  if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_UNDEAD_KNIGHT) || IS_CLASS(victim, CLASS_UNDEAD_ASSASSIN)
    || IS_CLASS(victim, CLASS_NAZGUL) || IS_CLASS(victim, CLASS_NECROMANCER)))

  {
       dam *= (100 - (victim->pcdata->powers[UNDEAD_SPIRIT] * 6));
    dam /= 100;
  }
  if (!IS_NPC(victim) && (IS_CLASS(victim,CLASS_WEREWOLF) || IS_CLASS(victim, CLASS_UNDEAD_LYCAN)
    || IS_CLASS(victim, CLASS_GAIA_WOLF) || IS_CLASS(victim, CLASS_STALKER)))

  {
    if(victim->power[DISC_WERE_BOAR] > 2) dam /= 2;
    if(IS_GAR1(victim, WOLF_COCOON))      dam /= 2;
  }
  if (dam >= 2000) dam = dam - (dam / number_range(3,10) + number_range(10,30));
  if (!IS_NPC(victim))
  {
    dam = dam + (dam / number_range(2,5) + number_range(10,50));
    dam *= (number_range(2,4) * number_range(2,3) / number_range(4,6));
  }
  if (dam <= 0) dam = 1;
  if (dam > 1000000) dam = 1000000;                                               
//  if (dam > ch->damcap[DAM_CAP])
//    dam = number_range( (ch->damcap[DAM_CAP] - 200), (ch->damcap[DAM_CAP] + 100) );
  if ( IS_AFFECTED(victim, AFF_SANCTUARY ) ) dam *= 0.5;
  return dam;
}

bool can_counter( CHAR_DATA *ch)
{
  if (!IS_NPC(ch) && IS_STANCE(ch, STANCE_MONKEY)) return TRUE;
  if (!IS_NPC(ch) && IS_STANCE(ch, STANCE_COUGAR)) return TRUE;

  return FALSE;
}

bool can_bypass( CHAR_DATA *ch, CHAR_DATA *victim )
{
  if (IS_NPC(ch) || IS_NPC(victim)) return FALSE;
  else if (IS_STANCE(ch, STANCE_VIPER)) return TRUE;
  else if (IS_STANCE(ch, STANCE_MANTIS)) return TRUE;
  else if (IS_STANCE(ch, STANCE_TIGER)) return TRUE;
  else if (IS_STANCE(ch, STANCE_WOLF)) return TRUE;
  else if (IS_STANCE(ch, STANCE_RABBIT)) return TRUE;
  else if (IS_STANCE(ch, STANCE_BEAR)) return TRUE;
  else if (IS_STANCE(ch, STANCE_COBRA)) return TRUE;

  else if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_BYPASS)) return TRUE;
  return FALSE;
}

void update_damcap( CHAR_DATA *ch, CHAR_DATA *victim )
{
  int max_dam = 1000;
//  int i = 0;

  if (!IS_NPC(ch))
  {
//    if (ch->pcdata->upgrade_level > 0) max_dam += ch->pcdata->upgrade_level * 500;
    if (ch->generation == 1) max_dam += 250;
    if (ch->generation == 2) max_dam += 200;
    if (ch->generation == 3) max_dam += 150;
    if (ch->generation == 4) max_dam += 100;
    if (ch->generation == 5) max_dam += 50;
    max_dam += (ch->pcdata->legend *20);
    if (ch->pcdata->upgrade_level == 1) max_dam +=1000;
    if (ch->pcdata->upgrade_level == 2) max_dam +=2500;
    if (ch->pcdata->upgrade_level == 3) max_dam +=3000;
    if (ch->pcdata->upgrade_level == 4) max_dam +=3500;
    if (ch->pcdata->upgrade_level == 5) max_dam +=4000;
    if (ch->pcdata->upgrade_level == 6) max_dam +=4500;
    if (ch->pcdata->upgrade_level == 7) max_dam +=5000;
    if (ch->pcdata->upgrade_level == 8) max_dam +=5500;
    if (ch->pcdata->upgrade_level == 9) max_dam +=6000;
    if (ch->pcdata->upgrade_level == 10) max_dam +=6500;
    if (ch->pcdata->upgrade_level == 11) max_dam +=7000;

   switch( ch->pRank ) {                            // this will probably need lowered
      case  0: max_dam +=   250; break;             // also thanks scorp-ice for permission.
      case  1: max_dam +=   500; break;
      case  2: max_dam +=  1000; break;
      case  3: max_dam +=  2000; break;
      case  4: max_dam +=  2500; break;
      case  5: max_dam +=  3000; break;
      case  6: max_dam +=  3500; break;
      case  7: max_dam +=  4000; break;
      case  8: max_dam +=  4500; break;
      case  9: max_dam +=  5000; break;
      case 10: max_dam +=  6000; break;
      case 11: max_dam +=  6500; break;
      case 12: max_dam +=  7000; break;
      case 13: max_dam +=  8000; break;
      case 14: max_dam +=  8500; break;
      case 15: max_dam +=  9000; break;
      case 16: max_dam +=  9500; break;
      case 17: max_dam +=  10000; break;
      case 18: max_dam +=  10500; break;
      case 19: max_dam +=  11000; break;
      case 20: max_dam +=  12000; break;
      case 21: max_dam +=  13000; break;
      default: break;
   }

  if (IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
  || IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON))

      max_dam += ch->pcdata->powers[dragonage] * 330;

  if (IS_CLASS(ch, CLASS_HYDRA) || IS_CLASS(ch, CLASS_NAZGUL) || IS_CLASS(ch, CLASS_BAATEZU)
     || IS_CLASS(ch, CLASS_TYPHON)) 
  {
     max_dam += 1800;
  }
 //GryphonHawk
  if (IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
  || IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON))

	 {
		max_dam += (ch->pcdata->powers[dragonage] * 100);
		if(IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_WINGS )) max_dam += 145;
		if(IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_FANGS )) max_dam += 155;
		if(IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_TAIL ))  max_dam += 125;
		if(IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_LUCK ))  max_dam += 125;
		if(IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_CLAWS))  max_dam += 125;
	 }
if (!IS_NPC(victim))
{
	 if (!IS_NPC(ch) && (IS_CLASS(victim, CLASS_DRAGON) || IS_CLASS(victim, CLASS_SHADOW_DRAGON)
  || IS_CLASS(victim, CLASS_GOLD_DRAGON) || IS_CLASS(victim, CLASS_SILVER_DRAGON)))

		{
		  if(IS_SET(victim->pcdata->powers[DPOWER_FLAGS], DRA_LUCK )) max_dam -= 250;
		  if(IS_SET(victim->pcdata->powers[DPOWER_FLAGS], DRA_TERROR )) max_dam -= 250;
		  max_dam -= (victim->pcdata->powers[dragonage] * 30);
		}
}

    if (IS_CLASS(ch, CLASS_TANARRI) || IS_CLASS(ch, CLASS_DEVA) 
       || IS_CLASS(ch, CLASS_HELL_SPAWN) || IS_CLASS(ch, CLASS_BAATEZU))
    {
      if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_MIGHT)) max_dam += 500;
      max_dam += ch->pcdata->tanrank*375; /* max rank is 6 btw -xrak */
    }

     if (IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER) 
     || IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
     {
// Assymetric - I actually bumped this up to make Assassins more about getting the one big hit through
	max_dam += ch->pcdata->powers[ASSASSIN_POWER] * 325;
     }
 if (IS_CLASS(ch, CLASS_HYDRA) || IS_CLASS(ch, CLASS_NAZGUL) 
 || IS_CLASS(ch, CLASS_TYPHON) || IS_CLASS(ch, CLASS_BAATEZU))
   {
    max_dam += 4000;
  }



    if (IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_DRUID)
    || IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_NECROMANCER)
    || IS_CLASS(ch, CLASS_ELEMENTAL))
     {
	max_dam += ch->pcdata->powers[ELEMENTAL_FIRE] * 275;
     }
    if (IS_CLASS(ch, CLASS_WRAITH) || IS_CLASS(ch, CLASS_SHADOWBORN)
    || IS_CLASS(ch, CLASS_SHADOW_FIEND) || IS_CLASS(ch, CLASS_VAMPIRIC_MIST))
    {
//      max_dam += ch->pcdata->powers[WRAITH_HATE] * 240;
        max_dam += 2400;

    }
   
// Hydra Damcap GONNA NEED CHANGED -Xrak, just for testing purposes
//    if (IS_CLASS(ch, CLASS_HYDRA) || IS_CLASS(ch, CLASS_TYPHON)
//    || IS_CLASS(ch, CLASS_NAZGUL) || IS_CLASS(ch, CLASS_BAATEZU))
//    {
//      max_dam += ch->pcdata->powers[HYDRA_ATTACK] * 240;
//    }
    if (IS_CLASS(ch, CLASS_PALADIN) || IS_CLASS(ch, CLASS_HEAVENS_SOLDIER)
    || IS_CLASS(ch, CLASS_DRUID) || IS_CLASS(ch, CLASS_GOLD_DRAGON))
    {
      max_dam += ch->pcdata->powers[PALADIN_POWER]*300;
      max_dam += ch->pcdata->powers[PALADIN_COMBAT]*200;
//        max_dam +=  1800;
      if ( IS_SET(ch->newbits, NEW_CUBEFORM) ) max_dam += 2000;
    }
    if (IS_CLASS(ch, CLASS_HEAVENS_SOLDIER) || IS_CLASS(ch, CLASS_TYPHON)
    || IS_CLASS(ch, CLASS_ANGEL) || IS_CLASS(ch, CLASS_SILVER_DRAGON))
    {
      max_dam += ch->pcdata->powers[ANGEL_JUSTICE]*125;
      max_dam += ch->pcdata->powers[ANGEL_PEACE]*125;
      max_dam += ch->pcdata->powers[ANGEL_HARMONY]*125;
      max_dam += ch->pcdata->powers[ANGEL_LOVE]*125;
    }
  if (IS_CLASS(ch, CLASS_DROW) || IS_CLASS(ch, CLASS_BLACK_ASSASSIN)
  || IS_CLASS(ch, CLASS_STALKER) || IS_CLASS(ch, CLASS_SHADOWBORN))

    {
      max_dam += 500;
      if (IS_SET(ch->newbits, NEW_DROWHATE)) max_dam += 650;
      if (IS_SET(ch->newbits,NEW_DFORM)) max_dam += 650;
    }
     if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND)) && ch->in_room != NULL)
    {
      max_dam += ch->power[DISC_DAEM_ATTA] * 50;
//      max_dam += 500;
      max_dam += 500;
      if (ch->pcdata->souls > 0) max_dam += UMIN(350, 70 * ch->pcdata->souls);
      if (ch->in_room->vnum >= 93420 && ch->in_room->vnum <= 93426) max_dam += 6000;
      max_dam += (ch->pcdata->stats[DEMON_POWER] * 2);
    }
    if (IS_CLASS(ch, CLASS_UNDEAD_LYCAN) || IS_CLASS(ch, CLASS_HELL_SPAWN) 
    || IS_CLASS(ch, CLASS_VAMPIRIC_MIST) || IS_CLASS(ch, CLASS_VAMPIRE))
    {
      max_dam += (ch->rage * 5);
      if (ch->power[DISC_VAMP_POTE] > 0) 
        max_dam += (ch->power[DISC_VAMP_POTE] * 50);
      if( ch->pcdata->rank == AGE_TRUEBLOOD)  max_dam += 600;
      else if( ch->pcdata->rank == AGE_LA_MAGRA) max_dam += 500;
      else if (ch->pcdata->rank == AGE_METHUSELAH) max_dam += 400;
      else if (ch->pcdata->rank == AGE_ELDER) max_dam += 250;
      else if (ch->pcdata->rank == AGE_ANCILLA) max_dam += 100;
    }
    if (IS_CLASS(ch,CLASS_WEREWOLF) || IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
    || IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER))
    {
      if (ch->rage > 99)
      {
        max_dam += ch->rage;
        max_dam += 400;
      }
      if (ch->power[DISC_WERE_PAIN] > 9) max_dam += 750;
    }
    if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN)
    || IS_CLASS(ch, CLASS_NAZGUL) || IS_CLASS(ch, CLASS_NECROMANCER))
      max_dam += ch->pcdata->powers[WEAPONSKILL] * 275;
  }
  if (IS_ITEMAFF(ch, ITEMA_ARTIFACT)) max_dam += 500;

  if (IS_NPC(victim) || victim->stance[0] != STANCE_MONKEY )   {
    if      (ch->stance[0] == STANCE_BULL)   max_dam += 200;
    else if (ch->stance[0] == STANCE_DRAGON) max_dam += 250;
    else if (ch->stance[0] == STANCE_WOLF)   max_dam += 250;
    else if (ch->stance[0] == STANCE_TIGER)  max_dam += 200;
    else if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMCAP_3)) max_dam += 550;
    else if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMCAP_2)) max_dam += 400;
    else if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMCAP_1)) max_dam += 250;
  }

  if (!IS_NPC(victim) && ch->stance[0] != STANCE_MONKEY )
  {  
    if (victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_REV_DAMCAP_3)) max_dam -= 550;
    else if (victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_REV_DAMCAP_2)) max_dam -= 400;
    else if (victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_REV_DAMCAP_1)) max_dam -= 250;
  }


  /* Max Dam Reductions */  /* Werewolves */
  /* Werewolves */

  if (!IS_NPC(victim))
  {
    int silver_tol = (victim->siltol * 2.5);
    if ((IS_CLASS(victim,CLASS_WEREWOLF) || IS_CLASS(victim, CLASS_UNDEAD_LYCAN)
    || IS_CLASS(victim, CLASS_GAIA_WOLF) || IS_CLASS(victim, CLASS_STALKER))
    && IS_ITEMAFF(ch, ITEMA_RIGHT_SILVER))
      max_dam += (250 - silver_tol);
    if ((IS_CLASS(victim,CLASS_WEREWOLF) || IS_CLASS(victim, CLASS_UNDEAD_LYCAN)
    || IS_CLASS(victim, CLASS_GAIA_WOLF) || IS_CLASS(victim, CLASS_STALKER))
     && IS_ITEMAFF(ch, ITEMA_LEFT_SILVER))
      max_dam += (250 - silver_tol);
  /* Vampies */
    if (!IS_NPC(ch) && (IS_CLASS(victim, CLASS_UNDEAD_LYCAN) || IS_CLASS(victim, CLASS_HELL_SPAWN) 
    || IS_CLASS(victim, CLASS_VAMPIRIC_MIST) || IS_CLASS(victim, CLASS_VAMPIRE)))
      max_dam -= (victim->power[DISC_VAMP_FORT] * 50); 
    if (IS_NPC(ch) || ch->stance[0] != STANCE_MONKEY)
    {
      if      (victim->stance[0] == STANCE_CRAB)    max_dam -= 250;
      else if (victim->stance[0] == STANCE_DRAGON)  max_dam -= 250;
      else if (victim->stance[0] == STANCE_SWALLOW) max_dam -= 250;
    }
     if ((IS_CLASS(victim, CLASS_DEMON) || IS_CLASS(victim, CLASS_SHADOW_DRAGON) 
     || IS_CLASS(victim, CLASS_HELLS_SOLDIER) || IS_CLASS(victim, CLASS_SHADOW_FIEND))
     && (victim->in_room->vnum >= 93420 && victim->in_room->vnum <= 93426))
      max_dam *= 0.5;
  }

  if (ch->level >= LEVEL_BUILDER) max_dam = 30000;
//  if (ch->level >= LEVEL_BUILDER && !IS_NPC(ch)) max_dam = 100000; // Det er pisse irreterende Thomas.. jeg kan intet teste mod mobs, de doer automatisk. DIE!
  ch->damcap[DAM_CAP] = max_dam;
  ch->damcap[DAM_CHANGE] = 0;
  return;
}


/*
 * Inflict damage from a hit.
 */
void damage( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt )
{
  CHAR_DATA *emb;
  int hit_loc;

  if ( victim->position == POS_DEAD ) return;
  if ( ch->embracing != NULL )
  {
	 if ( ( emb = ch->embracing ) != NULL ) stop_embrace(ch,emb);
    else stop_embrace(ch,NULL);
  }
  /*
   * Stop up any residual loopholes.
	*/
  if (ch->damcap[DAM_CHANGE] == 1) update_damcap(ch,victim);
  if ( dam > ch->damcap[0] ) dam = ch->damcap[0];
  
  /*
   * Certain attacks are forbidden.
   * Most other attacks are returned.
   */
  if ( victim != ch )
  {
    if (is_safe( ch, victim )) return;
    if ( victim->position > POS_STUNNED )
    {
      if ( victim->fighting == NULL ) set_fighting( victim, ch );
      victim->position = POS_FIGHTING;
    }
    if ( victim->position > POS_STUNNED )
    {
      if ( ch->fighting == NULL )
      set_fighting( ch, victim );
      /*
       * If victim is charmed, ch might attack victim's master.
       */
      if ( IS_NPC(ch)
      &&   IS_NPC(victim)
      &&   IS_AFFECTED(victim, AFF_CHARM)
      &&   victim->master != NULL
      &&   victim->master->in_room == ch->in_room
      &&   number_bits( 3 ) == 0 )
      {
		  stop_fighting( ch, FALSE );
        multi_hit( ch, victim->master, TYPE_UNDEFINED );
        return;
      }
    }
    if ( victim->master == ch ) stop_follower( victim );
  /*
   * Damage modifiers.
   */
    if ( IS_AFFECTED(ch, AFF_HIDE) )
    {
      if (!can_see(victim,ch)) 
      {
        dam *= 1.5;
        send_to_char("You use your concealment to get a surprise attack!\n\r",ch);
      }
      REMOVE_BIT( ch->affected_by, AFF_HIDE );
      act( "$n leaps from $s concealment.", ch, NULL, NULL, TO_ROOM );
    }
	 if ( IS_AFFECTED(victim, AFF_PROTECT) && IS_EVIL(ch) && dam > 1  )
      dam -= dam * 0.25;
    if ( IS_AFFECTED(victim, AFF_PROTECT_GOOD) && IS_GOOD(ch) && dam > 1  )
      dam -= dam * 0.25;
    if ( dam < 0 ) dam = 0;
    /*
     * Check for disarm, trip, parry, and dodge.
     */
    if ( dt >= TYPE_HIT )
    {
      if (IS_NPC(ch) && number_percent( ) < ch->level * 0.5)
		  disarm( ch, victim );
		if (IS_NPC(ch) && number_percent( ) < ch->level * 0.5)
		  trip( ch, victim );
		if (check_dodge( ch, victim, dt))
		  return;
		if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_MONGOOSE) &&
		victim->stance[STANCE_MONGOOSE] > 100 && !can_counter(ch)
		&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
		  return;
		else if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_SWALLOW) &&
		victim->stance[STANCE_SWALLOW] > 100 && !can_counter(ch)
		&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
		  return;
/* ------------ This is the part for superstances, Jobo ------------------- */
		else if (!IS_NPC(victim) && victim->stance[0] > 12
		&& IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_DODGE)
		&& victim->stance[(victim->stance[0])] > 100 && !can_counter(ch)
		&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
		  return;
/* ------------ This is the end for superstances, Jobo ------------------- */
		if (check_parry( ch, victim, dt)) return;
		if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_CRANE) &&
		victim->stance[STANCE_CRANE] > 100 && !can_counter(ch)
		&& !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
		  return;
		else if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_MANTIS) &&
		victim->stance[STANCE_MANTIS] > 100 && !can_counter(ch)
		&& !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
		  return;
/* ------------ This is the part for superstances, Jobo ------------------- */
		  else if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_RABBIT) && 
		victim->stance[STANCE_RABBIT] > 100 && !can_counter(ch)
		&& !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
		return;
		 else if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_EAGLE) && 
		victim->stance[STANCE_EAGLE] > 100 && !can_counter(ch)
		&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
		return;

/* ------------ This is the end for superstances, Jobo ------------------- */

      if (check_parry( ch, victim, dt)) return;
      if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_CRANE) && 
      victim->stance[STANCE_CRANE] > 100 && !can_counter(ch)
      && !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
        return;
      else if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_MANTIS) && 
      victim->stance[STANCE_MANTIS] > 100 && !can_counter(ch)
      && !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
        return;
    }
	 }
    hit_loc = number_range(1,11);
    dam_message( ch, victim, dam, dt, hit_loc);

    /*
     * Brief 5 System - Jobo
     */
    if (!IS_NPC(ch) && IS_SET(ch->extra, EXTRA_BRIEF5))
    {
      ch->amount_damage_dealt += dam;
      ch->amount_attacks_dealt++;
    }
    if (!IS_NPC(victim) && IS_SET(victim->extra, EXTRA_BRIEF5))
    {
      victim->amount_damage_recieved += dam;
      victim->amount_attacks_recieved++;
    }


  
  if (IS_SET(victim->newbits, NEW_IRONMIND))
  {
	 REMOVE_BIT(victim->newbits, NEW_IRONMIND);
	 send_to_char("Your focus your full concentration on the attack,\n\r", victim);
	 send_to_char("and absorb the full impact into your system, channeling it into a healing force.\n\r",victim);
	 victim->hit += dam;
	 dam = 0;
  }
  hurt_person(ch,victim,dam);
  dropinvis(ch);
  dropinvis(victim);
  return;
}


void angel_eye( CHAR_DATA *ch, CHAR_DATA *victim, int dam )
{
  char buf[MAX_STRING_LENGTH];
  char buf2[MAX_STRING_LENGTH];
  int new_dam;

  if (IS_SET(victim->pcdata->powers[ANGEL_POWERS], ANGEL_EYE) && dam > 100)
  {
    new_dam = number_range(dam/4,dam/5);
    if (new_dam > 300) new_dam = number_range(275,325);
    if (new_dam >= victim->hit) new_dam = victim->hit -1;  
    if (new_dam < 10) new_dam = 10;
    hurt_person(victim, ch, new_dam);
    sprintf(buf, "God's justice strikes you HARD [#C%d#n]",new_dam);
    sprintf(buf2, "The sinner dares to lay hands on you, God's wrath on the sinner [#C%d#n]", new_dam);
    act(buf, victim, NULL, ch, TO_VICT);
    act(buf2, victim, NULL, ch, TO_CHAR);
  }
  return;
}

void vamp_bite( CHAR_DATA *ch, CHAR_DATA *victim )
{
  char buf[MAX_STRING_LENGTH];
  char buf2[MAX_STRING_LENGTH];
  int dam;

  if (IS_SET(ch->extra, EXTRA_BAAL))
  {
    dam = number_range(100,500);
    hurt_person(ch, victim, dam);
    ch->pcdata->condition[COND_THIRST] += number_range(1,5);
    if (ch->pcdata->condition[COND_THIRST] > 240)
      ch->pcdata->condition[COND_THIRST] = 240;
    sprintf(buf, "You Have Been BITTEN! [#C%d#n]",dam);
    sprintf(buf2, "You Bite Them #[Damage:#C%d#n#R][#nBlood: #C%d#R]\n\r", dam, ch->pcdata->condition[COND_THIRST]);
    act(buf, ch, NULL, victim, TO_VICT);
    act(buf2, ch, NULL, victim, TO_CHAR);
  }
  return;
}


void elemental_enflame( CHAR_DATA *ch, CHAR_DATA *victim, int dam )
{
  char buf[MAX_STRING_LENGTH];
  char buf2[MAX_STRING_LENGTH];
  int new_dam;

  if (IS_SET(victim->pcdata->powers[ELEMENTAL_POWERS], ELEMENTAL_ENFLAME) && dam > 100)
  {
    new_dam = number_range(dam/4,dam/5);
    if (new_dam > 300) new_dam = number_range(275,325);
    if (new_dam >= victim->hit) new_dam = victim->hit -1;  
    if (new_dam < 10) new_dam = number_range(275,325);
    hurt_person(victim, ch, new_dam);
    sprintf(buf, "The Elemental Flames DEVESTATE you [#C%d#n]",new_dam);
    sprintf(buf2, "You seek RETRIBUTION! [#C%d#n]", new_dam);
    act(buf, victim, NULL, ch, TO_VICT);
    act(buf2, victim, NULL, ch, TO_CHAR);
  }
  return;
}



void hurt_person( CHAR_DATA *ch, CHAR_DATA *victim, int dam )
{
  char buf[MAX_STRING_LENGTH];

  victim->hit -= dam;
  if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_ANGEL) && !IS_CLASS(ch, CLASS_ANGEL))
    angel_eye(ch,victim,dam); // check for that eye for an eye.
  if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_ELEMENTAL) && !IS_CLASS(ch, CLASS_ELEMENTAL))
    elemental_enflame(ch,victim,dam); // check for that eye for an eye. AKA ENFLAME
  if (!IS_NPC(victim) && victim->level >= LEVEL_IMMORTAL && victim->hit < 1) 
    victim->hit = 1;
  if (!IS_NPC(victim) && IS_SET(victim->newbits, NEW_CLOAK) &&victim->hit < 1 )
  {
    victim->hit += UMIN((victim->max_hit * .1), 4000);
    if (IS_CLASS(victim, CLASS_ANGEL)) send_to_char("your cloak of life saves your from certain death.\n\r",victim);
    else send_to_char("your cloa

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

Site Stats

Snippets: 1791
Codebases: 571