fight.c.jun08

src/fight.c.jun08 · 430.1 KB

From the archive cotn-4.0.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.                                               *
 *                                                                         *
 *  Dystopia Mud improvements copyright (C) 2000, 2001 by Brian Graversen  *
 *                                                                         *
 *  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.                                                  *
 ***************************************************************************/
/***************************************************************************
 *                                 _/                            _/        *
 *      _/_/_/  _/_/      _/_/_/  _/    _/_/    _/    _/    _/_/_/         *
 *     _/    _/    _/  _/        _/  _/    _/  _/    _/  _/    _/          *
 *    _/    _/    _/  _/        _/  _/    _/  _/    _/  _/    _/           *
 *   _/    _/    _/    _/_/_/  _/    _/_/      _/_/_/    _/_/_/            *
 ***************************************************************************
 * Mindcloud Copyright 2001-2003 by Jeff Boschee (Zarius),                 *
 * Additional credits are in the help file CODECREDITS                     *
 * All Rights Reserved.                                                    *
 ***************************************************************************/
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include "merc.h"
#include "interp.h"
#include "magic.h"
#include "memwatch.h"

#define MAX_SLAY_TYPES 3
#define MONK_AUTODROP 12

/*
 * Local functions.
 */
void autodrop 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));
void death_cry args((CHAR_DATA * ch));
void group_gain args((CHAR_DATA * ch, CHAR_DATA * victim));
int xp_compute args((CHAR_DATA * gch, CHAR_DATA * victim));
bool 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 decap_message args((CHAR_DATA * ch, CHAR_DATA * victim));
void fae_update args((CHAR_DATA * ch));
void angel_eye args((CHAR_DATA * ch, CHAR_DATA * victim, int dam));
void fae_shield args((CHAR_DATA * ch, CHAR_DATA * victim, int dam));
void improve_weapon_res args((CHAR_DATA * ch, int dtype));

extern CHAR_DATA *quest_target;
extern CHAR_DATA *quest_mob;

/*
 * Control the fights going on.
 * Called periodically by update_handler.
 */
void violence_update(void)
{
        CHAR_DATA *ch;
        CHAR_DATA *ch_next;
        CHAR_DATA *emb;
        CHAR_DATA *victim;
        CHAR_DATA *rch;
        CHAR_DATA *rch_next;
        CHAR_DATA *mount;
        OBJ_DATA *obj, *obj_next;
        bool      room_trig = FALSE;
        int       chance;

        chance = number_percent();

        for (ch = char_list; ch != NULL; ch = ch->next)
        {
                if (IS_NPC(ch) && IS_SET(ch->act, ACT_NODAMAGE))
                {
                        ch->hit = ch->max_hit;
                }
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_FAE)
                    && ch->position != POS_STUNNED)
                        fae_update(ch);

                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,
                                                             TRUE);
                                                do_say(ch, "Muhahahahahaha");
                                                multi_hit(ch, victim,
                                                          gsn_blinky);
                                                multi_hit(ch, victim,
                                                          gsn_blinky);
                                                if (IS_SET
                                                    (ch->newbits, THIRD_HAND)
                                                    && get_eq_char(ch,
                                                                   WEAR_THIRD)
                                                    != NULL)
                                                        multi_hit(ch, victim,
                                                                  gsn_blinky);
                                                if (IS_SET
                                                    (ch->newbits, FOURTH_HAND)
                                                    && get_eq_char(ch,
                                                                   WEAR_FOURTH)
                                                    != NULL)
                                                        multi_hit(ch, victim,
                                                                  gsn_blinky);
                                                update_pos(victim);
                                        }
                                }
                        }
                }   /*end of blink */
                ch_next = ch->next;
                if (!IS_NPC(ch))
                {
                        if (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);
                        	}
                        	ch->combat = NULL;
                	}


                        if (ch->pcdata->agg_counter > 0)
                        {
                                ch->pcdata->agg_counter--;
                                if (ch->pcdata->agg_counter == 0)
                                {
                                        ch->pcdata->aggress_from = 0;
                                        ch->pcdata->aggress_towards = 0;
                                }
                        }
                }
                if (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 (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 (IS_SET(ch->monkstuff, MONK_DEATH))
                {
                        if (ch->hit > (ch->max_hit / 2))
                        {
                                ch->hit -= number_range(50, 200);
                                stc("Your writhe in agony as magical energies tear you asunder.\n\r", ch);
                                act("$n writhes in agony as magical forces tear apart $s body.", ch, NULL, NULL, TO_ROOM);
                        }
                        else
                        {
                                if (number_range(1, 2) == 1)
                                {
                                        stc("You feel the magical forces leave your body.\n\r", ch);
                                        act("The magical forces leave $n's body.", ch, NULL, NULL, TO_ROOM);
                                        REMOVE_BIT(ch->monkstuff, MONK_DEATH);
                                }
                                else
                                {
                                        ch->hit -= number_range(50, 200);
                                        stc("Your writhe in agony as magical energies tear you asunder.\n\r", ch);
                                        act("$n writhes in agony as magical forces tear apart $s body.", ch, NULL, NULL, TO_ROOM);
                                }
                        }
                }
                if (IS_SET(ch->monkstuff, MONK_HEAL))
                {
                        if (ch->hit < (ch->max_hit / 2) && ch->hit > 0)
                        {
                                if (ch->hit < ch->max_hit)
                                        ch->hit += number_range(200, 400);
                                if (ch->move < ch->max_move)
                                        ch->move += number_range(175, 400);
                                stc("Your body emits glowing sparks.\n\r",
                                    ch);
                                act("$n's body emits glowing sparks and fizzes.", ch, NULL, NULL, TO_ROOM);
                        }
                        else if (ch->hit > 0)
                        {
                                if (number_range(1, 2) == 1)
                                {
                                        stc("The sparks fizzle and die.\n\r",
                                            ch);
                                        act("The sparks around $n's body fizzle and die.", ch, NULL, NULL, TO_ROOM);
                                        REMOVE_BIT(ch->monkstuff, MONK_HEAL);
                                }
                                else
                                {
                                        if (ch->hit < ch->max_hit)
                                                ch->hit +=
                                                        number_range(200,
                                                                     400);
                                        if (ch->move < ch->max_move)
                                                ch->move +=
                                                        number_range(175,
                                                                     400);
                                        stc("Your body emits glowing sparks.\n\r", ch);
                                        act("$n's body emits glowing sparks and fizzes.", ch, NULL, NULL, TO_ROOM);
                                }
                        }
                }
                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 < 9)
                                ch->fight_timer = 10;
                        else if (ch->fight_timer < 25)
                                ch->fight_timer += 3;
                        if (ch->pcdata->aggress_towards != 0
                            || ch->pcdata->aggress_from != 0)
                        {
                                if (ch->pcdata->agg_counter < 9)
                                        ch->pcdata->agg_counter = 10;
                                else if (ch->pcdata->agg_counter < 25)
                                        ch->pcdata->agg_counter += 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 ((victim = ch->fighting) == NULL)
                        continue;
                /*
                 * Fun for the whole family!
                 */
                for (rch = ch->in_room->people; rch != NULL; rch = rch_next)
                {
                        rch_next = rch->next_in_room;
                        if (IS_AWAKE(rch) && rch->fighting == NULL)
                        {
                                /*
                                 * Mount's auto-assist their riders and vice versa.
                                 */
                                if ((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) || IS_AFFECTED(ch, AFF_CHARM))
                                {
                                        if ((!IS_NPC(rch)
                                             || IS_AFFECTED(rch, AFF_CHARM))
                                            && is_same_group(ch, rch))
                                                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);
                                        }
                                }
                        }
                }
                //mob prog
                if (IS_NPC(ch))
                {
                        if (HAS_TRIGGER_MOB(ch, TRIG_FIGHT))
                                p_percent_trigger(ch, NULL, NULL, victim,
                                                  NULL, NULL, TRIG_FIGHT);
                        if (HAS_TRIGGER_MOB(ch, TRIG_HPCNT))
                                p_hprct_trigger(ch, victim);
                }
                for (obj = ch->carrying; obj; obj = obj_next)
                {
                        obj_next = obj->next_content;

                        if (obj->wear_loc != WEAR_NONE
                            && HAS_TRIGGER_OBJ(obj, TRIG_FIGHT))
                                p_percent_trigger(NULL, obj, NULL, victim,
                                                  NULL, NULL, TRIG_FIGHT);
                }

                if (HAS_TRIGGER_ROOM(ch->in_room, TRIG_FIGHT)
                    && room_trig == FALSE)
                {
                        room_trig = TRUE;
                        p_percent_trigger(NULL, NULL, ch->in_room, victim,
                                          NULL, NULL, TRIG_FIGHT);
                }
                if (IS_AFF2(ch, AFF2_FROZEN))
                {
                        send_to_char("The ice around melts a little bit.\n\r",
                                     ch);
                        act("The ice around $n melts a little.", ch, NULL,
                            NULL, TO_ROOM);
                        if (number_range(1, 100) > 49)
                        {
                                send_to_char
                                        ("The ice around you is so thin you flex your muscles and shatter it.\n\r",
                                         ch);
                                act("The ice around $n shatters revealing one pissed off $n.", ch, NULL, NULL, TO_ROOM);
                                REMOVE_BIT(ch->affected_by2, AFF2_FROZEN);
                        }
                }
        }
        return;
}

void fae_update(CHAR_DATA * ch)
{
        if (ch->hit < 1)
                return;
        if (ch->pcdata->powers[FAE_PLASMA_TICK] >
            ch->pcdata->powers[FAE_PLASMA])
        {
                ch->hit =
                        UMAX(1,
                             ch->hit -
                             ch->pcdata->powers[FAE_PLASMA_TICK] *
                             number_range(200, 400));
                send_to_char
                        ("#oYou scream in pain as you lose control over the forces of plasma.#n\n\r",
                         ch);
                act("$n screams in pain, strange plasma flows from $s body.",
                    ch, NULL, NULL, TO_ROOM);
                ch->pcdata->powers[FAE_PLASMA_TICK] = 0;
                ch->pcdata->powers[FAE_PLASMA_GROWTH] = 0;
        }
        if (ch->pcdata->powers[FAE_WILL_TICK] > ch->pcdata->powers[FAE_WILL])
        {
                ch->hit =
                        UMAX(1,
                             ch->hit -
                             ch->pcdata->powers[FAE_WILL_TICK] *
                             number_range(200, 400));
                send_to_char
                        ("#oYou scream in pain as you lose concentration and your willpower crumbles.#n\n\r",
                         ch);
                act("$n screams in pain, and clutches $s head.", ch, NULL,
                    NULL, TO_ROOM);
                ch->pcdata->powers[FAE_WILL_TICK] = 0;
                ch->pcdata->powers[FAE_WILL_GROWTH] = 0;
        }
        if (ch->pcdata->powers[FAE_ENERGY_TICK] >
            ch->pcdata->powers[FAE_ENERGY])
        {
                ch->hit =
                        UMAX(1,
                             ch->hit -
                             ch->pcdata->powers[FAE_ENERGY_TICK] *
                             number_range(200, 400));
                send_to_char
                        ("#oYou scream in pain as you lose control over the forces of energy.#n\n\r",
                         ch);
                act("$n screams in pain, strange energies flows from $s body.", ch, NULL, NULL, TO_ROOM);
                ch->pcdata->powers[FAE_ENERGY_TICK] = 0;
                ch->pcdata->powers[FAE_ENERGY_GROWTH] = 0;
        }
        if (ch->pcdata->powers[FAE_MATTER_TICK] >
            ch->pcdata->powers[FAE_MATTER])
        {
                ch->hit =
                        UMAX(1,
                             ch->hit -
                             ch->pcdata->powers[FAE_MATTER_TICK] *
                             number_range(200, 400));
                send_to_char
                        ("#oYou scream in pain as you lose control over the forces of matter.#n\n\r",
                         ch);
                act("$n screams in pain, strange matter flows from $s body.",
                    ch, NULL, NULL, TO_ROOM);
                ch->pcdata->powers[FAE_MATTER_TICK] = 0;
                ch->pcdata->powers[FAE_MATTER_GROWTH] = 0;
        }
        if (ch->pcdata->powers[FAE_PLASMA_GROWTH] > 0)
        {
                ch->pcdata->powers[FAE_PLASMA_TICK] +=
                        ch->pcdata->powers[FAE_PLASMA_GROWTH];
                send_to_char
                        ("#YYou channel more #Gplasma#Y from your surroundings into your body.#n\n\r",
                         ch);
        }
        if (ch->pcdata->powers[FAE_MATTER_GROWTH] > 0)
        {
                ch->pcdata->powers[FAE_MATTER_TICK] +=
                        ch->pcdata->powers[FAE_MATTER_GROWTH];
                send_to_char
                        ("#YYou channel more #Gmatter#Y from your homeplane into existance.#n\n\r",
                         ch);
        }
        if (ch->pcdata->powers[FAE_ENERGY_GROWTH] > 0)
        {
                ch->pcdata->powers[FAE_ENERGY_TICK] +=
                        ch->pcdata->powers[FAE_ENERGY_GROWTH];
                send_to_char
                        ("#YYou channel more #Genergy#Y from the arcane into your mind.#n\n\r",
                         ch);
        }
        if (ch->pcdata->powers[FAE_WILL_GROWTH] > 0)
        {
                ch->pcdata->powers[FAE_WILL_TICK] +=
                        ch->pcdata->powers[FAE_WILL_GROWTH];
                send_to_char
                        ("#YYou concentrate on your #Gwillpower#Y, focusing your thoughts into combat.#n\n\r",
                         ch);
        }
        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;
        OBJ_DATA *familiar;
        char      buf[MAX_STRING_LENGTH];
        int       sn, level, chance, unarmed, maxcount, countup = -1, x =
                0, wieldie, i;
        AFFECT_DATA af;
        int       wieldorig = 0;
        int       wieldtype = 0;

        if (ch->position < POS_SLEEPING)
                return;
        if (IS_CREATOR(ch) || IS_CLASS(ch, CLASS_MONK))
        {
                if (!IS_NPC(ch) && wieldorig == 0)
                {
                        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)
        {
                one_hit(ch, victim, dt, 1);
                one_hit(ch, victim, dt, 1);
                return;
        }
        if (dt == gsn_tentacle)
        {

                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)
        {
                one_hit(ch, victim, dt, 1);
                return;
        }
        if (dt == gsn_quills)
        {
                if ((IS_CLASS(ch, CLASS_WEREWOLF))
                    && (ch->power[DISC_WERE_PAIN] > 9))
                {
                        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_darktendrils && IS_CLASS(ch, CLASS_DROW))
        {
                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);
                return;
        }
        if (dt == gsn_buffet)
        {
                one_hit(ch, victim, dt, 1);
                return;
        }
        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)
        {
                if (IS_CLASS(ch, CLASS_MONK))
                        x = number_range(1, 4);
                else
                {
                        if (IS_CLASS(victim, CLASS_SAMURAI))
                                x = number_range(3, 5); // angels don't like em samurais.
                        else
                                x = number_range(2, 5);
                }
                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;
        }
        if (dt == gsn_bash) // giants only, mind you.
        {
                for (i = 1; i < ch->pcdata->rank; i++)
                {
                        x = number_range(1, 3);
                        if (x == 1)
                                one_hit(ch, victim, gsn_thwack, 1);
                        else if (x == 2)
			     {
                                one_hit(ch, victim, gsn_smack, 1);
			     }
                        else
                                one_hit(ch, victim, gsn_bash, 1);
                }
                ch->pcdata->powers[GIANT_ATTACK] = x;   // setting the attack bit.
                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;
        }
        else if (wieldorig == 14)
        {
                if (wieldie == 2)
                        wieldtype = 8;
                else if (wieldie == 1)
                        wieldtype = 4;
                else if (wieldie == 3)
                        wieldtype = 2;
                else
                        wieldtype = 1;
        }
        else if (wieldorig == 13)
        {
                if (wieldie == 1)
                        wieldtype = 8;
                else if (wieldie == 2)
                        wieldtype = 4;
                else
                        wieldtype = 1;
        }
        else if (wieldorig == 12)
        {
                if (wieldie == 1)
                        wieldtype = 8;
                else
                        wieldtype = 4;
        }
        else if (wieldorig == 11)
        {
                if (wieldie == 1)
                        wieldtype = 8;
                if (wieldie == 2)
                        wieldtype = 2;
                else
                        wieldtype = 1;
        }
        else if (wieldorig == 10)
        {
                if (wieldie == 1)
                        wieldtype = 8;
                else
                        wieldtype = 2;
        }
        else if (wieldorig == 9)
        {
                if (wieldie == 1)
                        wieldtype = 8;
                else
                        wieldtype = 1;
        }
        else if (wieldorig == 8)
                wieldtype = 8;
        else if (wieldorig == 7)
        {
                if (wieldie == 1)
                        wieldtype = 4;
                else if (wieldie == 2)
                        wieldtype = 2;
                else
                        wieldtype = 1;
        }
        else if (wieldorig == 6)
        {
                if (wieldie == 1 || wieldie == 2)
                        wieldtype = 2;
                else
                        wieldtype = 4;
        }
        else if (wieldorig == 5)
        {
                if (wieldie == 1)
                        wieldtype = 4;
                else
                        wieldtype = 1;
        }
        else if (wieldorig == 4)
                wieldtype = 4;
        else if (wieldorig == 3)
        {
                if (wieldie == 2 || wieldie == 4)
                        wieldtype = 2;
                else
                        wieldtype = 1;
        }
        else if (wieldorig == 2)
                wieldtype = 2;
        else 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);
                xprintf(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("faith armor")
                                    && 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 (ch->fighting != victim || dt == gsn_backstab || dt == gsn_shiroken
            || dt == gsn_garotte || dt == gsn_headbutt || dt == gsn_circle)
                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;
                }
                else if (wieldorig == 14)
                {
                        if (wieldie == 2)
                                wieldtype = 8;
                        else if (wieldie == 1)
                                wieldtype = 4;
                        else if (wieldie == 3)
                                wieldtype = 2;
                        else
                                wieldtype = 1;
                }
                else if (wieldorig == 13)
                {
                        if (wieldie == 1)
                                wieldtype = 8;
                        else if (wieldie == 2)
                                wieldtype = 4;
                        else
                                wieldtype = 1;
                }
                else if (wieldorig == 12)
                {
                        if (wieldie == 1)
                                wieldtype = 8;
                        else
                                wieldtype = 4;
                }
                else if (wieldorig == 11)
                {
                        if (wieldie == 1)
                                wieldtype = 8;
                        if (wieldie == 2)
                                wieldtype = 2;
                        else
                                wieldtype = 1;
                }
                else if (wieldorig == 10)
                {
                        if (wieldie == 1)
                                wieldtype = 8;
                        else
                                wieldtype = 2;
                }
                else if (wieldorig == 9)
                {
                        if (wieldie == 1)
                                wieldtype = 8;
                        else
                                wieldtype = 1;
                }
                else if (wieldorig == 7)
                {
                        if (wieldie == 1)
                                wieldtype = 4;
                        else if (wieldie == 2)
                                wieldtype = 2;
                        else
                                wieldtype = 1;
                }
                else if (wieldorig == 6)
                {
                        if (wieldie == 1 || wieldie == 2)
                                wieldtype = 2;
                        else
                                wieldtype = 4;
                }
                else if (wieldorig == 5)
                {
                        if (wieldie == 1)
                                wieldtype = 4;
                        else
                                wieldtype = 1;
                }
                else 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_SHADOW))
        {
                if (IS_SET
                    (ch->pcdata->powers[SHADOW_BITS], NPOWER_KNIFESHIELD))
                {
                        one_hit(ch, victim, gsn_knifespin, 1);
                        one_hit(ch, victim, gsn_knifespin, 1);
                }
                if (IS_SET(ch->pcdata->powers[SHADOW_BITS], NPOWER_BLOODRAGE))
                        one_hit(ch, victim, gsn_gutcutter, 1);
        }
        else if (IS_CLASS(ch, CLASS_DRACONIAN) && 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);
        }
        else if (IS_CLASS(ch, CLASS_DEMON) && 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);
        }
        //Ghoul Disease
        else if (IS_CLASS(ch, CLASS_GHOUL)
            && ch->pcdata->powers[GPOWER_ZOMBIE] >= 2)
        {
                char      buf1[MAX_STRING_LENGTH];
                char      buf2[MAX_STRING_LENGTH];
                int       rand_num = number_range(1, 4);
                int       dam = ch->damcap[DAM_CAP] / 2;

                dam += ch->pcdata->powers[GPOWER_ZOMBIE] * 500;

                if (rand_num > 2)
                {
                        xprintf(buf1,
                                "#G$N #ccringes in pain as your diseased claws rend their flesh!  #g[#G%d#g]#n",
                                dam);
                        xprintf(buf2,
                                "#cYou cringe in pain as #G$n's #cdiseased claws rend your flesh!  #g[#G%d#g]#n",
                                dam);
                        act(buf1, ch, NULL, victim, TO_CHAR);
                        act(buf2, ch, NULL, victim, TO_VICT);

                        hurt_person(ch, victim, dam);
                }
        }
        if (IS_CLASS(victim, CLASS_DRACONIAN)
            && victim->pcdata->stats[DRACONIAN_SPIKES] > 0)
        {
                char      buf1[MAX_STRING_LENGTH];
                char      buf2[MAX_STRING_LENGTH];
                int       dam =
                        number_range(victim->pcdata->stats[DRACONIAN_SPIKES] *
                                     10,
                                     victim->pcdata->stats[DRACONIAN_SPIKES] *
                                     20);
                if (number_percent() > 70)
                {
                        xprintf(buf1,
                                "#Y$N's #Gspikes come in contact with you, piercing your flesh!  #r[#R%d#r]#n",
                                dam);
                        xprintf(buf2,
                                "#GYour spikes come in contact with #Y$n, #Gpiercing their flesh! #r[#R%d#r]#n",
                                dam);
                        act(buf1, ch, NULL, victim, TO_CHAR);
                        act(buf2, ch, NULL, victim, TO_VICT);

                        hurt_person(victim, ch, dam);
                }
        }

        /*
         * Familiars Attack Round
         */
        if ((familiar = get_eq_char(ch, WEAR_FAMILIAR)) != NULL
            && familiar->item_type == ITEM_FAMILIAR && familiar->value[2] > 0)
        {
                char      buf1[MSL];
                char      buf2[MSL];
                int       dam;
                int       fart;
                int       attacks;

                if (familiar->value[0] != 9)
                {
                        if (familiar->value[1] < 33)
                                attacks = 1;
                        else if (familiar->value[1] >= 33
                                 && familiar->value[1] < 99)
                                attacks = 2;
                        else if (familiar->value[1] >= 99)
                                attacks = 3;
                        else
                                (attacks = 1);
                }
                else
                {
                        if (familiar->value[1] < 33)
                                attacks = 2;
                        else if (familiar->value[1] >= 33
                                 && familiar->value[1] < 99)
                                attacks = 3;
                        else if (familiar->value[1] >= 99)
                                attacks = 4;
                        else
                                (attacks = 2);
                }
                for (fart = 0; fart < attacks; fart++)
                {
                        /*
                         * A hit
                         */
                        if (number_percent() < (familiar->value[4]))
                        {
                                dam = familiar->value[2];
                                dam += number_range(0, 250);
                                dam += 5 * familiar->value[1];
                                sprintf(buf1, familiar->hit_msg1, dam);
                                sprintf(buf2, familiar->hit_msg2, dam);

                                act(buf1, ch, familiar, victim, TO_CHAR);
                                act(buf2, ch, familiar, victim, TO_VICT);

                                hurt_person(ch, victim, dam);
                        }
                        /*
                         * A miss
                         */
                        else
                        {
                                if (IS_NPC(ch)
                                    || !IS_SET(ch->act, PLR_BRIEF3))
                                        act("$p's #7attack misses $N!#n", ch,
                                            familiar, victim, TO_CHAR);
                                if (IS_NPC(victim)
                                    || !IS_SET(victim->act, PLR_BRIEF3))
                                        act("$p's #7attack misses you!#n", ch,
                                            familiar, victim, TO_VICT);
                        }
                }

        }


        //Thief Critical Strike
        if (IS_CLASS(ch, CLASS_THIEF)
            && IS_SET(ch->pcdata->powers[1], THIEF_CRITICALSTRIKE)
            && wield1 != NULL && wield1->value[3] == 11)
        {
                char      buf1[MAX_STRING_LENGTH];
                char      buf2[MAX_STRING_LENGTH];
                int       rand_num = number_range(1, 6);
                int       dam = number_range(ch->damcap[DAM_CAP] * 1.5,
                                             ch->damcap[DAM_CAP] * 2);

                if (rand_num >= 5)
                {
                        xprintf(buf1,
                                "#0You #Rdeftly lunge #0with your #7dagger #0and score a #rC#Rritical #rH#Rit#n #0on #r$N!  #r[#R%d#r]#n",
                                dam);
                        xprintf(buf2,
                                "#r$n #Rdeftly lunges #0at you, #Rslicing #0you in a vital area and scoring a #rC#Rritical #rH#Rit! #r[#R%d#r]#n",
                                dam);
                        act(buf1, ch, NULL, victim, TO_CHAR);
                        act(buf2, ch, NULL, victim, TO_VICT);
                        hurt_person(ch, victim, dam);
                }
        }
        else if (IS_CLASS(ch, CLASS_SKYBLADE)
            && ch->pcdata->powers[SKYBLADE_SKILLS] >= 4)
        {
                char      buf1[MAX_STRING_LENGTH];
                char      buf2[MAX_STRING_LENGTH];
                int       rand_num = number_range(1, 4);
                int       dam = number_range(ch->damcap[DAM_CAP] / 4,
                                             ch->damcap[DAM_CAP]);

                if (rand_num == 3)
                {
                        do_say(ch, "Haha, you swine, take this!");
                        xprintf(buf1,
                                "#B$n sidesteps $N#B's jab and strikes back!#0[#R%d#0]#n",
                                dam);
                        xprintf(buf2,
                                "#BYou sidestep $N#B's jab and strike back!#0[#R%d#0]#n",
                                dam);
                        act(buf1, ch, NULL, victim, TO_VICT);
                        act(buf2, ch, NULL, victim, TO_CHAR);
                        victim->hit -= dam;
                }
        }

        if (wield1 != NULL && wield->item_type == ITEM_WEAPON)
        {
                char      buf1[MAX_STRING_LENGTH];
                char      buf2[MAX_STRING_LENGTH];
                int       dam;
		int	  fire = wield->fire_level;
		int 	  water = wield->water_level;
		int	  electric = wield->lightning_level;
		int	  earth = wield->earth_level;
                
		if (fire > 0)
		{
			dam = (number_range(500,1000) * fire);
			if (!IS_SET(ch->act, PLR_BRIEF2))
			{
                	    xprintf(buf1, "#0Fire from your enflamed weapon strikes out at $N!  #0[#R%d#0]#n", dam);
                	    xprintf(buf2, "#0Fire from $n's enflamed weapon strikes you!  #0[#R%d#0]#n",dam);
                     	    act(buf1, ch, NULL, victim, TO_CHAR);
                	    act(buf2, ch, NULL, victim, TO_VICT);
			}
                	hurt_person(ch, victim, dam);
		}
                if (water > 0)
                {
                    dam = (number_range(500,1000) * water);
                    if (!IS_SET(ch->act, PLR_BRIEF2))
                    {
                    	xprintf(buf1, "#0Ice from your frozen weapon strikes out at $N!  #0[#R%d#0]#n", dam);
                    	xprintf(buf2, "#0Ice from $n's frozen weapon strikes you!  #0[#R%d#0]#n", dam);
                    	act(buf1, ch, NULL, victim, TO_CHAR);
                    	act(buf2, ch, NULL, victim, TO_VICT);
		    }
                    hurt_person(ch, victim, dam);
                }
                if (electric > 0)
                {
                    dam = (number_range(500,1000) * electric);
                    if (!IS_SET(ch->act, PLR_BRIEF2))
                    {
                    	xprintf(buf1,
                        "#0Lightning from your electric weapon strikes out at $N!  #0[#R%d#0]#n",
                        dam);
                    	xprintf(buf2,
                        "#0Lightning from $n's electric weapon strikes you!  #0[#R%d#0]#n",
                        dam);
                    	act(buf1, ch, NULL, victim, TO_CHAR);
                    	act(buf2, ch, NULL, victim, TO_VICT);
		    }
                    hurt_person(ch, victim, dam);
                }
                if (earth > 0)
                {
                    dam = (number_range(500,1000) * earth);
                    if (!IS_SET(ch->act, PLR_BRIEF2))
                    {

	                xprintf(buf1,
	                "#0Stones from your earthly weapon strikes out at $N!  #0[#R%d#0]#n",
			dam);
                    	xprintf(buf2,
                        "#0Stones from $n's earthly weapon strikes you!  #0[#R%d#0]#n",
                        dam);
			act(buf1, ch, NULL, victim, TO_CHAR);
                    	act(buf2, ch, NULL, victim, TO_VICT);
 		    }
                    hurt_person(ch, victim, dam);
                }

        }


        if (wield1 != NULL
            && (IS_SET(wield1->extra_flags, ITEM_ELECENCHANT)
                || wield1->pIndexData->vnum == 42721))
        {
                char      buf1[MAX_STRING_LENGTH];
                char      buf2[MAX_STRING_LENGTH];
                int       dam = number_range(1000, 2000);

                xprintf(buf1,
                        "#0Your weapon #oS#yH#7OC#yK#oS #0$N!  #0[#R%d#0]#n",
                        dam);
                xprintf(buf2,
                        "#0$n's weapon #oS#yH#7OC#yK#oS #0you!  #0[#R%d#0]#n",
                        dam);
                act(buf1, ch, NULL, victim, TO_CHAR);
                act(buf2, ch, NULL, victim, TO_VICT);

                hurt_person(ch, victim, dam);
        }

        if (wield1 != NULL
            && (IS_SET(wield1->extra_flags, ITEM_FIREENCHANT)
                || wield1->pIndexData->vnum == 42722
                || wield1->pIndexData->vnum == 42723))
        {
                char      buf1[MAX_STRING_LENGTH];
                char      buf2[MAX_STRING_LENGTH];
                int       dam = number_range(1500, 2500);

                xprintf(buf1,
                        "#0Your weapon #rIN#RCI#yN#7E#yR#RAT#rES #0$N!  #0[#R%d#0]#n",
                        dam);
                xprintf(buf2,
                        "#0$n's weapon #rIN#RCI#yN#7E#yR#RAT#rES #0you!  #0[#R%d#0]#n",
                        dam);
                act(buf1, ch, NULL, victim, TO_CHAR);
                act(buf2, ch, NULL, victim, TO_VICT);

                hurt_person(ch, victim, dam);

                if (!IS_AFFECTED(victim, AFF_FLAMING))
                {
                        SET_BIT(victim->affected_by, AFF_FLAMING);
                }

        }

        if (wield1 != NULL && IS_SET(wield1->extra_flags, ITEM_ICEENCHANT))
        {
                char      buf1[MAX_STRING_LENGTH];
                char      buf2[MAX_STRING_LENGTH];
                int       dam = number_range(1200, 2200);

                xprintf(buf1,
                        "#0Your weapon #cF#CRE#7E#CZE#cS #0$N!  #0[#R%d#0]#n",
                        dam);
                xprintf(buf2,
                        "#0$n's weapon #cF#CRE#7E#CZE#cS #0you!  #0[#R%d#0]#n",
                        dam);
                act(buf1, ch, NULL, victim, TO_CHAR);
                act(buf2, ch, NULL, victim, TO_VICT);

                hurt_person(ch, victim, dam);
        }

        if (wield1 != NULL && IS_SET(wield1->quest, QUEST_WWPOISON))
        {
                char      buf1[MAX_STRING_LENGTH];
                char      buf2[MAX_STRING_LENGTH];
                int       dam = number_range(500, 1500);

                xprintf(buf1,
                        "#0Your weapon's #gp#Goiso#gn #0seeps into #R$N!  #0[#R%d#0]#n",
                        dam);
                xprintf(buf2,
                        "#R$n's #0weapon #co#C0#gP#GoI#ys#GOn#GS#C0#co #0you!  #0[#R%d#0]#n",
                        dam);
                act(buf1, ch, NULL, victim, TO_CHAR);
                act(buf2, ch, NULL, victim, TO_VICT);

                hurt_person(ch, victim, dam);
        }
        /*
         * Golems specials 
         */
        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);
                }
                else if (ch->pIndexData->vnum == MOB_VNUM_STONE
                    && (char_damroll(victim) > 0 || char_hitroll(victim) > 0))
                {
                        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);
                }
                else if (ch->pIndexData->vnum == MOB_VNUM_CLAY)
                {
                        if ((sn = skill_lookup("clay")) > 0)
                                (*skill_table[sn].spell_fun) (sn, 50, ch,
                                                              victim);
                }
                else 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_SET(ch->warp, WARP_SHARDS)
            && number_range(1, 3) == 1)
                one_hit(ch, victim, gsn_shards, 0);
        if (IS_CLASS(ch, CLASS_DEMON) && 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_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 (ch->race > 24)
                {
                        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) && IS_CLASS(ch, CLASS_DRONE)
            && number_range(1, 3) != 2)
        {
                if (ch->pcdata->powers[DRONE_EVASION] > 2
                    && ch->pcdata->powers[DRONE_FOCUS] > 2
                    && ch->pcdata->powers[DRONE_FORTITUDE] > 2)
                        multi_hit(ch, victim, gsn_tentacle);
        }
        else if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_HOBBIT))
        {
                if (ch->pcdata->powers[HOBBIT_DISHES] > 5)
                        one_hit(ch, victim, gsn_thrownpie, 1);
                if (ch->pcdata->powers[HOBBIT_DISHES] > 10)
                        one_hit(ch, victim, gsn_thrownpie, 1);
                if (ch->pcdata->powers[HOBBIT_DISHES] > 15)
                        one_hit(ch, victim, gsn_thrownpie, 1);
        }
        else if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_SHAPESHIFTER))
        {
                if (ch->pcdata->powers[SHAPE_FORM] == HYDRA_FORM)
                {
                        one_hit(ch, victim, gsn_fangs, 1);
                        if (ch->pcdata->powers[HYDRA_LEVEL] > 0)
                                one_hit(ch, victim, gsn_fangs, 1);
                        if (ch->pcdata->powers[HYDRA_LEVEL] > 1)
                                one_hit(ch, victim, gsn_fangs, 1);
                        if (ch->pcdata->powers[HYDRA_LEVEL] > 3)
                                one_hit(ch, victim, gsn_fangs, 1);
                        if (ch->pcdata->powers[HYDRA_LEVEL] > 4)
                                one_hit(ch, victim, gsn_fangs, 1);
                }
                if (ch->pcdata->powers[SHAPE_FORM] == TIGER_FORM)
                {
                        if (ch->pcdata->powers[TIGER_LEVEL] > 0)
                                multi_hit(ch, victim, gsn_claws);
                        if (ch->pcdata->powers[TIGER_LEVEL] > 1)
                                multi_hit(ch, victim, gsn_fangs);
                }
                if (ch->pcdata->powers[SHAPE_FORM] == BULL_FORM)
                {
                        if (ch->pcdata->powers[BULL_LEVEL] > 0)
                                multi_hit(ch, victim, gsn_headbutt);
                        if (ch->pcdata->powers[BULL_LEVEL] > 1)
                                multi_hit(ch, victim, gsn_hooves);
                }
                if (ch->pcdata->powers[SHAPE_FORM] == FAERIE_FORM)
                {
                        if (IS_NPC(victim))
                        {
                                one_hit(ch, victim, gsn_fireball, 1);
                                one_hit(ch, victim, gsn_fireball, 1);
                        }
                        else
                        {
                                one_hit(ch, victim, gsn_fireball, 0);
                                one_hit(ch, victim, gsn_fireball, 0);
                        }
                        if (ch->pcdata->powers[FAERIE_LEVEL] > 1)
                                one_hit(ch, victim, gsn_buffet, 1);
                }
        }
        if (!IS_NPC(ch) && ch->level > 2)
        {
                if (IS_VAMPAFF(ch, VAM_HORNS) && number_range(1, 3) == 1)
                        multi_hit(ch, victim, gsn_headbutt);
        }
        if (IS_CLASS(ch, CLASS_TANARRI) && !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);
                }
        }
        else if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT)
            && ch->pcdata->powers[WEAPONSKILL] > 8)
        {
                one_hit(ch, victim, gsn_lightningslash, 1);
                one_hit(ch, victim, gsn_lightningslash, 1);
                one_hit(ch, victim, gsn_lightningslash, 1);
                one_hit(ch, victim, gsn_lightningslash, 1);
        }
        else if (IS_CLASS(ch, CLASS_LICH))
        {
                if (ch->pcdata->powers[CON_LORE] > 4)
                        one_hit(ch, victim, gsn_fireball, 1);
                if (ch->pcdata->powers[NECROMANTIC] > 4)
                        one_hit(ch, victim, gsn_chillhand, 1);
                if (ch->pcdata->powers[DEATH_LORE] > 4)
                        one_hit(ch, victim, gsn_deathaura, 1);
        }
        if (IS_CLASS(ch, CLASS_DEMON) && IS_DEMAFF(ch, DEM_HORNS)
            && number_range(1, 3) == 1)
                one_hit(ch, victim, gsn_headbutt, 0);
        if (IS_CLASS(ch, CLASS_DEMON) && 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_DEMAFF(ch, DEM_TAIL)
            && number_range(1, 2) == 2)
                one_hit(ch, victim, gsn_sweep, 0);
        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
            && ch->pcdata->powers[NPOWER_NINGENNO] >= 5
            && number_range(1, 2) != 1)
                multi_hit(ch, victim, gsn_shiroken);

        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))
                multi_hit(ch, victim, gsn_quills);
        if (!IS_NPC(ch) && IS_SET(ch->newbits, NEW_BLADESPIN)
            && IS_CLASS(ch, CLASS_SAMURAI))
                multi_hit(ch, victim, gsn_bladespin);
        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_GIANT))
                multi_hit(ch, victim, gsn_bash);
        if (!IS_NPC(ch) && IS_SET(ch->newbits, NEW_DARKTENDRILS)
            && IS_CLASS(ch, CLASS_DROW))
                multi_hit(ch, victim, gsn_darktendrils);
        if (!IS_NPC(ch) && IS_SET(ch->newbits, NEW_MULTIARMS)
            && IS_CLASS(ch, CLASS_MAGE))
                multi_hit(ch, victim, gsn_mageshield);
        if (!IS_NPC(ch) && ch->monkab[BODY] > 3 && IS_CLASS(ch, CLASS_MONK))
                multi_hit(ch, victim, gsn_heavenlyaura);
        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_ANGEL))
        {
                if (IS_SET(ch->pcdata->powers[ANGEL_POWERS], ANGEL_AURA))
                        multi_hit(ch, victim, gsn_heavenlyaura);
                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, ch);
                                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, ch);
                                break;
                        }
                }
        }
        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_DROID))
        {
                one_hit(ch, victim, gsn_pincers, 1);
                one_hit(ch, victim, gsn_pincers, 1);
                if (IS_SET(ch->newbits, NEW_CUBEFORM))
                {
                        one_hit(ch, victim, gsn_stinger, 1);
                        one_hit(ch, victim, gsn_stinger, 1);
                }
        }
        else if (!IS_NPC(ch) && IS_SET(ch->newbits, NEW_CUBEFORM)
            && IS_CLASS(ch, CLASS_CYBORG))
        {
                one_hit(ch, victim, gsn_stuntubes, 1);
                multi_hit(ch, victim, gsn_stinger);
        }
        else if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_WEREWOLF))
        {
                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_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)
            && 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_VAMPIRE)
            && IS_VAMPAFF(ch, VAM_SERPENTIS))
                spell_poison(gsn_poison, (ch->level * number_range(5, 20)),
                             ch, victim);
        else if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_WEREWOLF)
                 && ch->power[DISC_WERE_SPID] > 0)
                spell_poison(gsn_poison, (ch->level * number_range(5, 15)),
                             ch, victim);
        else if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_DROW)
                 && IS_SET(ch->pcdata->powers[1], DPOWER_DROWPOISON))
                spell_poison(gsn_poison, (ch->level * number_range(10, 20)),
                             ch, victim);
        else if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                 && ch->pcdata->powers[NPOWER_NINGENNO] >= 5)
                spell_poison(gsn_poison, (ch->level * number_range(5, 10)),
                             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() > 93)
                {
                        SET_BIT(ch->affected_by, AFF_FLAMING);
                        if (!IS_CLASS(ch, CLASS_WEREWOLF))
                        {
                                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))
                {
                        while (number_range(1, 2) != 1)
                                one_hit(victim, ch, gsn_deathaura, 0);
                        while (number_range(1, 2) != 1)
                                one_hit(victim, ch, gsn_deathaura, 0);
                        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)
                    && (char_damroll(ch) > 0 || char_hitroll(ch) > 0))
                {
                        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_TATTOO) && ch->position == POS_FIGHTING)
        {
                int       tdam;

                tdam = number_range(500, 1500);
                if (IS_NPC(ch))
                        tdam *= 3;
                if (tdam > victim->damcap[DAM_CAP])
                        tdam = victim->damcap[DAM_CAP];
                if (tdam > ch->hit - 1)
                        tdam = ch->hit - 1;
                if (tdam < 0)
                        tdam = 0;
                damage(victim, ch, tdam, gsn_tattoo);
        }

        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);
        return;
}

int number_attacks(CHAR_DATA * ch, CHAR_DATA * victim)
{
        int       count = 1;
        OBJ_DATA *wield;

        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->extra_attack > 20)
                        count += 20;
                else
                        count += ch->pIndexData->extra_attack;
                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 (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 ((wield = get_eq_char(ch, WEAR_WIELD)) != NULL
            		&& wield->item_type == ITEM_WEAPON)
					{
						if (wield->attack_level > 0) count += (wield->attack_level);
                    }
                        if (ch->tier > 0)
                                count += ch->tier;
                        if (ch->pcdata->relrank > 0)
                                count += ch->pcdata->relrank;
                        if (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 += 1;
                                                if (ch->
                                                    power[DISC_VAMP_CELE] > 9)
                                                        count += 1;
                                        }
                                }
                        }
                        if (IS_CLASS(ch, CLASS_JEDI)
                            && (ch->pcdata->powers[JPOWER_SPIRIT] >= 5))
                                count += 3;
                        if (IS_CLASS(ch, CLASS_JEDI)
                            && (ch->pcdata->powers[JPOWER_MIND] >= 4))
                                count += 2;
                        if (IS_CLASS(ch, CLASS_JEDI)
                            && (ch->pcdata->powers[JPOWER_BODY] >= 6))
                                count += 3;
                        if (IS_CLASS(ch, CLASS_JEDI)
                            && (ch->pcdata->powers[JPOWER_TECHNIQUE] >= 9))
                                count += 4;
                        if (IS_CLASS(ch, CLASS_SHADOW))
                                count += ch->pcdata->powers[SHADOW_MARTIAL] / 5;
                        if (IS_CLASS(ch, CLASS_GIANT))
                                count += ch->pcdata->rank / 2;
                        if (IS_CLASS(ch, CLASS_DRONE))
                                count += ch->pcdata->powers[DRONE_FOCUS] * 2;
                        if (IS_CLASS(ch, CLASS_FAE))
                        {
                                if (ch->pcdata->powers[FAE_PLASMA] > 7)
                                        count += 2;
                                if (ch->pcdata->powers[FAE_MATTER] > 7)
                                        count += 2;
                                if (ch->pcdata->powers[FAE_ENERGY] > 7)
                                        count += 2;
                                if (ch->pcdata->powers[FAE_WILL] > 7)
                                        count += 2;
                        }
                        if (IS_CLASS(ch, CLASS_TANARRI))
                                count += ch->pcdata->rank;
                        if (IS_CLASS(ch, CLASS_CYBORG))
                                count += ch->pcdata->powers[CYBORG_LIMBS];
                        if (IS_CLASS(ch, CLASS_THIEF)
                            && IS_SET(ch->pcdata->powers[1], THIEF_SWIFTNESS))
                                count += 5;
                        if (IS_CLASS(ch, CLASS_DROID))
                        {
                                count += ch->pcdata->powers[DROID_SPEED] / 2;   // max 3 at speed 6
                                if (IS_SET
                                    (ch->pcdata->powers[DROID_IMPLANTS],
                                     IMPLANT_EXTRA_ARMS))
                                        count += 2;
                        }
                        if (IS_CLASS(ch, CLASS_HOBBIT))
                                count += ch->pcdata->powers[HOBBIT_DISHES] /
                                        4;
                        if (IS_CLASS(ch, CLASS_ANGEL))
                                count += ch->pcdata->powers[ANGEL_JUSTICE];
                        if (IS_CLASS(ch, CLASS_WEREWOLF))
                        {
                                if (ch->power[DISC_WERE_LYNX] > 2)
                                        count += 2;
                                if (ch->power[DISC_WERE_BOAR] > 6)
                                {
					count += 4;
                                }
                        }
                        if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT))
                                count += ch->pcdata->powers[WEAPONSKILL] /
                                        1.6;
                        if (IS_CLASS(ch, CLASS_LICH))
                                count += 4;

                        if (IS_CLASS(ch, CLASS_SHAPESHIFTER))
                        {
                                count += 3;
                                if (ch->pcdata->powers[SHAPE_FORM] ==
                                    BULL_FORM)
                                        count += ch->pcdata->
                                                powers[BULL_LEVEL] / 2;
                                if (ch->pcdata->powers[SHAPE_FORM] ==
                                    TIGER_FORM)
                                        count += ch->pcdata->
                                                powers[TIGER_LEVEL];
                                if (ch->pcdata->powers[SHAPE_FORM] ==
                                    FAERIE_FORM)
                                        count += ch->pcdata->
                                                powers[FAERIE_LEVEL];
                                if (ch->pcdata->powers[SHAPE_FORM] ==
                                    HYDRA_FORM)
                                        count += ch->pcdata->
                                                powers[HYDRA_LEVEL] / 2;
                        }
                        if (IS_CLASS(ch, CLASS_DEMON))
                        {
                                if (IS_DEMPOWER(ch, DEM_SPEED))
                                        count += 3;
                                if (IS_SET(ch->warp, WARP_QUICKNESS))
                                        count += 4;
                        }
                        if (IS_CLASS(ch, CLASS_SKYBLADE))
                                count += 6;
                        if (IS_CLASS(ch, CLASS_GHOUL))
                                count += 7;
                        if (IS_CLASS(ch, CLASS_DRACONIAN))
                                count += 8;
                        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 += 5;
                        }
                }
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_MAGE)
                    && IS_ITEMAFF(ch, ITEMA_BEAST))
                        count += 4;
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                    && ch->pcdata->powers[NPOWER_CHIKYU] >= 3)
                        count += 3;
		if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)&& ch->pcdata->powers[HARA_KIRI] > 0)
			count += 2;
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                    && ch->pcdata->rank == BELT_ONE)
                        count += 1;
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                    && ch->pcdata->rank == BELT_TWO)
                        count += 1;
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                    && ch->pcdata->rank == BELT_THREE)
                        count += 2;
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                    && ch->pcdata->rank == BELT_FOUR)
                        count += 2;
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                    && ch->pcdata->rank == BELT_FIVE)
                        count += 2;
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                    && ch->pcdata->rank == BELT_SIX)
                        count += 3;
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                    && ch->pcdata->rank == BELT_SEVEN)
                        count += 3;
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                    && ch->pcdata->rank == BELT_EIGHT)
                        count += 4;
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                    && ch->pcdata->rank == BELT_NINE)
                        count += 4;
                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                    && ch->pcdata->rank == BELT_TEN)
                        count += 5;
                if (IS_CLASS(ch, CLASS_SAMURAI))
                        count += 6;
                if (IS_ITEMAFF(ch, ITEMA_SPEED))
                        count += 2;
        }
        else
        {
                if (!IS_NPC(ch))
                        if (ch->tier > 0)
                                count += ch->tier;
                if (!IS_NPC(ch))
                        if (ch->pcdata->relrank > 0)
                                count += ch->pcdata->relrank;
                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 (rel_oppose(ch, victim))
                        {
                                if (ch->in_room)
                                {
                                        if (has_area_affect
                                            (ch->in_room->area,
                                             AREA_AFF_GZONE,
                                             ch->pcdata->religion))
                                                count++;
                                }
                        }
                        if (IS_CLASS(ch, CLASS_CYBORG))
                                count += ch->pcdata->powers[CYBORG_LIMBS];
                        if (IS_CLASS(ch, CLASS_GIANT))
                                count += ch->pcdata->rank / 2;
                        if (IS_CLASS(ch, CLASS_SHADOW))
                                count += ch->pcdata->powers[SHADOW_MARTIAL] /
                                        5;
                        if (IS_CLASS(ch, CLASS_FAE))
                        {
                                if (ch->pcdata->powers[FAE_PLASMA] > 7)
                                        count++;
                                if (ch->pcdata->powers[FAE_MATTER] > 7)
                                        count++;
                                if (ch->pcdata->powers[FAE_ENERGY] > 7)
                                        count++;
                                if (ch->pcdata->powers[FAE_WILL] > 7)
                                        count++;
                        }
                        if (IS_CLASS(ch, CLASS_HOBBIT))
                                count += ch->pcdata->powers[HOBBIT_DISHES] /
                                        4;
                        if (IS_CLASS(ch, CLASS_DROID))
                        {
                                count += ch->pcdata->powers[DROID_SPEED] / 2;   // max 3 at speed 6
                                if (IS_SET
                                    (ch->pcdata->powers[DROID_IMPLANTS],
                                     IMPLANT_EXTRA_ARMS))
                                        count += 2;
                        }
                        if (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 += 3;
                        }
                        if (IS_CLASS(ch, CLASS_SHADOW)) /* CLASS_REMOVE */
                                count += ch->pcdata->powers[SHADOW_MARTIAL] /
                                        5;

                        if (IS_CLASS(ch, CLASS_JEDI)
                            && (ch->pcdata->powers[JPOWER_SPIRIT] >= 5))
                                count += 3;
                        if (IS_CLASS(ch, CLASS_JEDI)
                            && (ch->pcdata->powers[JPOWER_MIND] >= 4))
                                count += 2;
                        if (IS_CLASS(ch, CLASS_JEDI)
                            && (ch->pcdata->powers[JPOWER_BODY] >= 6))
                                count += 3;
                        if (IS_CLASS(ch, CLASS_JEDI)
                            && (ch->pcdata->powers[JPOWER_TECHNIQUE] >= 9))
                                count += 4;
                        if (IS_CLASS(victim, CLASS_JEDI)
                            && (victim->pcdata->powers[JPOWER_SPIRIT] > 3))
                                count -= 1;
                        if (IS_CLASS(ch, CLASS_MONK)
                            && ch->monkab[COMBAT] > 0)
                                count += ch->monkab[COMBAT];
                        if (IS_CLASS(ch, CLASS_MAGE)
                            && IS_ITEMAFF(ch, ITEMA_BEAST))
                                count += 4;
                        if (IS_CLASS(ch, CLASS_ANGEL))
                                count += 2;
                        if (IS_CLASS(ch, CLASS_DRONE))
                                count += ch->pcdata->powers[DRONE_FOCUS] * 2;
                        if (IS_CLASS(ch, CLASS_WEREWOLF))
                        {
                                if (ch->power[DISC_WERE_LYNX] > 2)
                                        count += 2;
                                if (ch->power[DISC_WERE_BOAR] > 6)
                                {
                                                count += 4;
                                }
                        }
                        /*
                         * bonus for high stats 
                         */
                        count += (get_curr_str(ch) + get_curr_dex(ch)) / 50;
                        if (IS_CLASS(ch, CLASS_LICH))
                                count += 4;
                        if (IS_CLASS(ch, CLASS_TANARRI))
                        {
                                count += ch->pcdata->rank;
                                if (IS_SET
                                    (ch->pcdata->powers[TANARRI_POWER],
                                     TANARRI_SPEED))
                                        count += 4;
                        }
                        if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT))
                                count += ch->pcdata->powers[WEAPONSKILL] /
                                        1.6;
	                if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)&& ch->pcdata->powers[HARA_KIRI] > 0)
        	                count += 2;
                        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                            && ch->pcdata->rank == BELT_ONE)
                                count += 1;
                        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                            && ch->pcdata->rank == BELT_TWO)
                                count += 1;
                        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                            && ch->pcdata->rank == BELT_THREE)
                                count += 2;
                        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                            && ch->pcdata->rank == BELT_FOUR)
                                count += 2;
                        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                            && ch->pcdata->rank == BELT_FIVE)
                                count += 2;
                        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                            && ch->pcdata->rank == BELT_SIX)
                                count += 3;
                        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                            && ch->pcdata->rank == BELT_SEVEN)
                                count += 3;
                        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                            && ch->pcdata->rank == BELT_EIGHT)
                                count += 4;
                        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                            && ch->pcdata->rank == BELT_NINE)
                                count += 4;
                        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
                            && ch->pcdata->rank == BELT_TEN)
                                count += 5;
                        if (IS_ITEMAFF(ch, ITEMA_SPEED))
                                count += 1;
                        if (IS_CLASS(ch, CLASS_SAMURAI))
                                count += 6;
                        if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_MAGE)
                            && IS_ITEMAFF(ch, ITEMA_BEAST))
                                count += 4;
                        if (IS_CLASS(ch, CLASS_DEMON)
                            && ch->power[DISC_DAEM_ATTA] > 0)
                                count += ch->power[DISC_DAEM_ATTA] / 1.5;
                        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 += 5;
                        }
                }
                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] / 2;
                if (number_range(1, 4) == 2)
                        count -= 1;
        }
        if (count < 1)
                count = 1;
        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;

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

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

Site Stats

Snippets: 1791
Codebases: 571