fight.c
src/fight.c · 272.5 KB
From the archive cotn-2.5.tar.gz
Download the archive « Back to the archive contents
/***************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
* *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
***************************************************************************/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#define MAX_SLAY_TYPES 3
#define MONK_AUTODROP 12
// #define MONK_AUTODROP ch->pcdata->autostance
/*
* Local functions.
*/
int can_pk args((CHAR_DATA *ch, CHAR_DATA *victim));
void autodrop args((CHAR_DATA *ch));
void dropinvis args((CHAR_DATA *ch));
bool check_dodge args((CHAR_DATA *ch, CHAR_DATA *victim, int dt));
bool check_parry args((CHAR_DATA *ch, CHAR_DATA *victim, int dt));
void dam_message args((CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, int hit_loc));
void death_cry args((CHAR_DATA *ch));
void group_gain args((CHAR_DATA *ch, CHAR_DATA *victim));
int xp_compute args((CHAR_DATA *gch, CHAR_DATA *victim));
void set_fighting args((CHAR_DATA *ch, CHAR_DATA *victim));
bool can_counter args((CHAR_DATA *ch));
bool can_bypass args((CHAR_DATA *ch, CHAR_DATA *victim));
int number_attacks args((CHAR_DATA *ch, CHAR_DATA *victim));
int dambonus args((CHAR_DATA *ch, CHAR_DATA *victim, int dam, int stance));
void update_damcap args((CHAR_DATA *ch, CHAR_DATA *victim));
void decap_message args((CHAR_DATA *ch, CHAR_DATA *victim));
void angel_eye args((CHAR_DATA *ch, CHAR_DATA *victim, int dam));
void s_taiegra args((CHAR_DATA *ch, CHAR_DATA *victim, int dam));
void elemental_enflame args((CHAR_DATA *ch, CHAR_DATA *victim, int dam));
void vamp_bite args((CHAR_DATA *ch, CHAR_DATA *victim));
void ragnarokdecap args((CHAR_DATA *ch, CHAR_DATA *victim));
bool can_decapitate args((CHAR_DATA *ch, CHAR_DATA *victim));
void improve_weapon_res args((CHAR_DATA * ch, int dtype));
bool check_shieldblock args (( CHAR_DATA *ch, CHAR_DATA *victim, int dt ));
/*
* Control the fights going on.
* Called periodically by update_handler.
*/
// void do_weaponpractice (CHAR_DATA *ch, char *argument)
void violence_update(void)
{
CHAR_DATA *ch;
CHAR_DATA *ch_next;
CHAR_DATA *emb;
CHAR_DATA *victim;
CHAR_DATA *rch;
CHAR_DATA *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)
{
victim = ch->blinkykill;
if (victim != NULL)
{
if (IS_SET(ch->flag3, AFF3_BLINK_1ST_RD))
{
REMOVE_BIT(ch->flag3, AFF3_BLINK_1ST_RD);
SET_BIT(ch->flag3, AFF3_BLINK_2ND_RD);
}
else if (IS_SET(ch->flag3, AFF3_BLINK_2ND_RD))
{
REMOVE_BIT(ch->flag3, AFF3_BLINK_2ND_RD);
REMOVE_BIT(ch->flag3, AFF3_BLINK_1ST_RD);
/*
* Has the victim left?
*/
if (victim->in_room != ch->in_room)
{
SET_BIT(ch->affected_by2,
EXTRA_BLINKY);
victim = NULL;
act("$n pops back into existence.",
ch, NULL, NULL, TO_ROOM);
stc("You pop back into existence.\n\r", ch);
stc("Your victim is no longer in the room.\n\r", ch);
break;
}
SET_BIT(ch->affected_by2, EXTRA_BLINKY);
act("$n pops back into existence next to $N.",
ch, NULL, victim, TO_NOTVICT);
act("You pop back into existence next to $N.",
ch, NULL, victim, TO_CHAR);
act("$n pops back into existence next to you.", ch, NULL, victim, TO_VICT);
if (!is_safe(ch, victim))
{
if (ch->hit > 0)
{
set_fighting(ch, victim);
do_say(ch, "Muhahahahahaha");
multi_hit(ch, victim, gsn_blinky);
multi_hit(ch, victim, gsn_blinky);
if (IS_SET(ch->newbits, THIRD_HAND)
&& get_eq_char(ch, WEAR_THIRD) != NULL)
one_hit(ch, victim, gsn_blinky, 1);
if (IS_SET(ch->newbits, FOURTH_HAND)
&& get_eq_char(ch, WEAR_FOURTH) != NULL)
one_hit(ch, victim, gsn_blinky, 1);
update_pos(victim);
}
}
}
} /*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_HELLS_SOLDIER) || 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;
}
/*
* Do one group of attacks.
*/
void multi_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
{
OBJ_DATA *wield;
OBJ_DATA *wield1;
OBJ_DATA *wield2;
OBJ_DATA *wield3;
OBJ_DATA *wield4;
char buf[MAX_STRING_LENGTH];
int sn, level, chance, unarmed, maxcount,countup,x,wieldie,i;
AFFECT_DATA af;
int wieldorig = 0;
int wieldtype = 0;
int dam;
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
char buf3[MAX_STRING_LENGTH];
// Assymetric - Newbie protection - 4 hours
// This should never come up, but just in case someone finds a back door into combat
if(!IS_NPC(ch) && !IS_NPC(victim) && ((get_age(victim) - 17) < 2 || (get_age(ch) - 17) < 2))
{
stc("You can't attack newbies or attack as a newbie!\n\r", ch);
stop_fighting(ch, victim);
return;
}
if ( ch->position < POS_SLEEPING ) return;
if ( IS_CREATOR(ch))
{
if (!IS_NPC(ch) && wieldorig == 0 )
{
countup = number_range(0,2);
if (countup == 0) unarmed = number_range(0,3);
else if (countup == 1) unarmed = number_range(4,7);
else unarmed = number_range(0,7);
if (!IS_NPC(ch) && ch->cmbt[unarmed] != 0 && wieldorig == 0)
fightaction(ch,victim,ch->cmbt[unarmed], dt, wieldtype);
}
}
if ( dt == gsn_headbutt )
{
one_hit( ch, victim, dt, 1 );
return;
}
if ( dt == gsn_lightningslash )
{
one_hit( ch, victim, dt, 1 );
return;
}
if ( dt == gsn_malice )
{
one_hit( ch, victim, dt, 1 );
return;
}
if (dt == gsn_blinky)
{
one_hit( ch, victim, dt, 1 );
one_hit( ch, victim, dt, 1 );
if (number_range(1,4) == 2)
{
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_tongue )
{
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
return;
}
if ( dt == gsn_stinger )
{
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
return;
}
if (dt == gsn_claws)
{
if (!IS_NPC(ch) && (IS_NPC(victim) || !IS_NPC(victim))) // -xrak, i just threw this in quick
{
one_hit(ch, victim, dt, 1);
one_hit(ch, victim, dt, 1);
one_hit(ch, victim, dt, 1);
one_hit(ch,victim,dt,1);
}
return;
}
if (dt == gsn_tentacle)
{
int x;
act("You shoot forth a shower of tentacles to destroy $N.", ch, NULL, victim, TO_CHAR);
act("$n shoots forth a shower of tentacles aiming straight at you.", ch, NULL, victim, TO_VICT);
act("$n shoots forth a shower of tentacles striking $N.", ch, NULL, victim, TO_NOTVICT);
x = number_range(2, 5);
while (--x >= 0) one_hit(ch, victim, dt, 1);
return;
}
if ( dt == gsn_fangs )
{
if ((IS_CLASS(ch,CLASS_WEREWOLF) || IS_CLASS(ch, CLASS_UNDEAD_LYCAN)) && (ch->power[DISC_WERE_PAIN] > 9))
{
one_hit( ch, victim, dt, 1 );
one_hit( ch, victim, dt, 1 );
return;
}
if (IS_CLASS(ch, CLASS_TANARRI) || IS_CLASS(ch, CLASS_VAMPIRE) || IS_CLASS(ch, CLASS_HUMAN))
{
one_hit( ch, victim, dt, 1 );
one_hit( ch, victim, dt, 1 );
return;
}
}
if ( dt== gsn_quills)
{
if (!IS_NPC(ch))
{
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
}
return;
}
if (dt == gsn_darktendrils)
{
if (!IS_NPC(ch))
{
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
}
return;
}
if ( dt==gsn_venomtong)
{
one_hit(ch,victim,dt,1);
return;
}
if ( dt==gsn_spiketail)
{
one_hit(ch,victim,dt,1);
return;
}
if ( dt==gsn_badbreath)
{
one_hit(ch,victim,dt,1);
return;
}
if ( dt==gsn_magma)
{
one_hit(ch,victim,dt,1);
return;
}
if ( dt==gsn_shards)
{
one_hit(ch,victim,dt,1);
return;
}
if ( dt==gsn_cheapshot)
{
send_to_char("You stun them with a shoulder charge!\n\r",ch);
send_to_char("You are stunned by a shoulder charge!\n\r",victim);
{
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
}
return;
}
if(IS_CLASS(ch,CLASS_SHINOBI)){
switch (ch->pcdata->powers[S_ELEMENT]){
case S_FIRE:
if(IS_SET(ch->in_room->shinobi, ROOM_SFIRE)){
one_hit(ch,victim,gsn_shinfire,0);
one_hit(ch,victim,gsn_shinfire,0);
one_hit(ch,victim,gsn_shinfire,0);}
break;
case S_WIND:
if(IS_SET(ch->in_room->shinobi, ROOM_SWIND)){
one_hit(ch,victim,gsn_shinwind,0);
one_hit(ch,victim,gsn_shinwind,0);
one_hit(ch,victim,gsn_shinwind,0);}
break;
case S_WATER:
if(IS_SET(ch->in_room->shinobi, ROOM_SWATER)){
one_hit(ch,victim,gsn_shinwater,0);
one_hit(ch,victim,gsn_shinwater,0);
one_hit(ch,victim,gsn_shinwater,0);}
break;
case S_EARTH:
if(IS_SET(ch->in_room->shinobi, ROOM_SEARTH)){
one_hit(ch,victim,gsn_shinearth,0);
one_hit(ch,victim,gsn_shinearth,0);
one_hit(ch,victim,gsn_shinearth,0);}
break;
case S_HOLY:
if(IS_SET(ch->in_room->shinobi, ROOM_SHOLY)){
one_hit(ch,victim,gsn_shinholy,0);
one_hit(ch,victim,gsn_shinholy,0);
one_hit(ch,victim,gsn_shinholy,0);}
break;
case S_SHADOW:
if(ch->pcdata->powers[S_HANDSHADOW] == 6){
one_hit(ch,victim,gsn_shinshadow,0);
one_hit(ch,victim,gsn_shinshadow,0);
one_hit(ch,victim,gsn_shinshadow,0);}
break;
}
one_hit(ch,victim,gsn_shin,0);
}
if ( dt == gsn_buffet )
{
one_hit( ch, victim, dt, 1 );
return;
}
if ((IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON))
&& IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_TAIL))
{
if ( number_range (1,18) < ch->pcdata->powers[dragonage])
{
one_hit ( ch, victim, gsn_spiket, 0);
}
one_hit ( ch, victim, gsn_spiket, 0);
}
if ((IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON))
&& IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_WINGS) &&
number_range(1,3)==1) one_hit (ch,victim,gsn_buffet,0);
if ((IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON)) && IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_CLAWS))
{
if (number_range(1, 3)==1) one_hit (ch, victim, gsn_claws,0);
one_hit (ch, victim, gsn_claws,0);
}
if ((IS_CLASS(ch, CLASS_DRAGON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_GOLD_DRAGON) || IS_CLASS(ch, CLASS_SILVER_DRAGON))
&& IS_SET(ch->pcdata->powers[DPOWER_FLAGS], DRA_FANGS))
{
if (number_range(1,4)==1) one_hit(ch,victim,gsn_rfangs,1);
if (number_range(1,10)==1)multi_hit(ch,victim,gsn_rfangs);
one_hit (ch, victim, gsn_rfangs,0);
}
if ( dt == gsn_sweep )
{
one_hit( ch, victim, dt, 1 );
return;
}
if ( dt == gsn_rfangs )
{
one_hit( ch, victim, dt, 1);
return;
}
if (dt==gsn_engulf)
{
if (IS_CLASS(ch, CLASS_PHOENIX))
{
if (IS_CLASS(victim, CLASS_ZOMBIE) || IS_CLASS(victim, CLASS_VAMPIRE)) x = number_range(4,5);
else x = number_range(2,3);
}
for (i=0; i < x; i++)
one_hit(ch,victim,dt,1);
return;
}
if (dt==gsn_heavenlyaura)
{
for (i=0; i < x; i++)
one_hit(ch,victim,dt,1);
return;
}
if (dt==gsn_mageshield)
{
if (IS_ITEMAFF(ch, ITEMA_MAGESHIELD))
{
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
}
return;
}
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;
}
/* Wraith */
if ( dt == gsn_dblast)
{
one_hit(ch,victim,dt,1);
return;
}
if ( dt == gsn_jugularslice)
{
one_hit(ch,victim,dt,1);
return;
}
/*
if ( dt == gsn_swoop)
{
x=number_range(2,4);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}
*/
if ( dt == gsn_fblast)
{
x=number_range(1,2);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}
if ( dt == gsn_wgust)
{
x=number_range(1,2);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}
if ( dt == gsn_torrent)
{
x=number_range(1,2);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}
if ( dt == gsn_cblast)
{
x=number_range(1,2);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}
if ( dt == gsn_rslide)
{
x=number_range(1,2);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}
if ( dt == gsn_zomplague)
{
x=number_range(1,3);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}
if ( dt == gsn_stench)
{
x=number_range(2,4);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}
wield1 = get_eq_char( ch, WEAR_WIELD );
wield = get_eq_char(ch, WEAR_WIELD );
wield2 = get_eq_char( ch, WEAR_HOLD );
wield3 = get_eq_char( ch, WEAR_THIRD );
wield4 = get_eq_char( ch, WEAR_FOURTH);
if ( wield1 != NULL && wield1->item_type == ITEM_WEAPON ) wieldorig = 1;
if ( wield2 != NULL && wield2->item_type == ITEM_WEAPON ) wieldorig += 2;
if ( wield3 != NULL && wield3->item_type == ITEM_WEAPON ) wieldorig += 4;
if ( wield4 != NULL && wield4->item_type == ITEM_WEAPON ) wieldorig += 8;
wieldtype = wieldorig;
wieldie = number_range(1,4);
if ( wieldorig == 15 )
{
if (wieldie == 2) wieldtype = 8;
else wieldtype = 4;
}
if ( wieldorig == 14 )
{
if (wieldie == 2) wieldtype = 8;
else if (wieldie == 1) wieldtype = 4;
else if (wieldie == 3) wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 13 ) {
if ( wieldie == 1) wieldtype = 8;
else if (wieldie == 2) wieldtype = 4;
else wieldtype = 1;
}
if ( wieldorig == 12 )
{
if ( wieldie == 1 ) wieldtype = 8;
else wieldtype = 4;
}
if ( wieldorig == 11 )
{
if ( wieldie == 1 ) wieldtype = 8;
if ( wieldie == 2 ) wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 10 )
{
if ( wieldie == 1 ) wieldtype = 8;
else wieldtype = 2;
}
if ( wieldorig == 9 )
{
if ( wieldie == 1 ) wieldtype = 8;
else wieldtype = 1;
}
if ( wieldorig == 8 ) wieldtype = 8;
if ( wieldorig == 7 )
{
if ( wieldie == 1 ) wieldtype = 4;
else if ( wieldie == 2 ) wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 6 )
{
if ( wieldie == 1 || wieldie == 2) wieldtype = 2;
else wieldtype = 4;
}
if ( wieldorig == 5 )
{
if ( wieldie == 1) wieldtype = 4;
else wieldtype = 1;
}
if ( wieldorig == 4 ) wieldtype = 4;
if ( wieldorig == 3 )
{
if ( wieldie == 2 || wieldie == 4) wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 2 ) wieldtype = 2;
if ( wieldorig == 1 ) wieldtype = 1;
if ( wieldtype == 8 ) wield = wield4;
else if ( wieldtype == 4 ) wield = wield3;
else if ( wieldtype == 2 ) wield = wield2;
else wield = wield1;
if (!IS_NPC(ch) && ch->stance[0] > 0 && number_percent() == 5)
{
int stance = ch->stance[0];
if (ch->stance[stance] >= 200)
{
special_move(ch,victim);
return;
}
}
unarmed = 0;
if (IS_SET( ch->flag2, VAMP_OBJMASK) )
{
act("You return to your normal form.",ch,NULL,NULL,TO_CHAR);
sprintf(buf,"%s reforms as %s.\n\r",ch->morph, ch->name );
act(buf,ch,NULL,NULL,TO_ROOM);
free_string(ch->morph);
free_string(ch->objdesc);
ch->long_descr = str_dup("");
REMOVE_BIT(ch->flag2, VAMP_OBJMASK);
REMOVE_BIT(ch->affected_by, AFF_POLYMORPH);
}
one_hit( ch, victim, dt, wieldtype );
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
/* Only want one spell per round from spell weapons...otherwise it's
* too powerful, and would unbalance player killing (as this is a PK mud).
*/
if ( dt == TYPE_UNDEFINED )
{
dt = TYPE_HIT;
if ( wield != NULL && wield->item_type == ITEM_WEAPON )
{
dt += wield->value[3];
if (wield->value[0] >= 1)
{
/* Look, just don't ask... KaVir */
if (wield->value[0] >= 1000) sn = wield->value[0] - ((wield->value[0] / 1000) * 1000);
else sn = wield->value[0];
if (sn != skill_lookup("gas breath") && sn != skill_lookup("desanct") && sn != skill_lookup("sleep") && sn != 0)
{
if (victim->position == POS_FIGHTING) (*skill_table[sn].spell_fun) (sn,wield->level,ch,victim);
}
}
}
}
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if ( !IS_NPC(ch) && (IS_CLASS(ch, CLASS_UNDEAD_LYCAN) || IS_CLASS(ch, CLASS_HELL_SPAWN)
|| IS_CLASS(ch, CLASS_VAMPIRIC_MIST) || IS_CLASS(ch, CLASS_VAMPIRE))) vamp_bite(ch,victim);
if ( ch->fighting != victim || dt == gsn_backstab
|| dt == gsn_garotte || dt == gsn_headbutt || dt == gsn_circle || dt == gsn_jugularslice
|| dt == gsn_poisonbreath || dt == gsn_fbreath || dt == gsn_lbreath || dt == gsn_frbreath
|| dt == gsn_dbreath || dt == gsn_retribution || dt == gsn_malice || dt == gsn_swoop ) return;
maxcount = number_attacks(ch, victim);
maxcount -= 3;
if (!IS_NPC(ch))
{
chance = 0;
if (wield != NULL && wield->item_type == ITEM_WEAPON)
{
int tempnum = wield->value[3];
chance = (ch->wpn[tempnum]) * 0.5;
}
else chance = (ch->wpn[0]) * 0.5;
if (number_percent() <= chance) maxcount += 1;
}
if (wieldorig == 3) maxcount += 1;
for (countup = 0; countup <= maxcount; countup++)
{
wieldtype = wieldorig;
if ( wieldorig == 15 )
{
if (wieldie == 2) wieldtype = 8;
else wieldtype = 4;
}
if ( wieldorig == 14 )
{
if (wieldie == 2) wieldtype = 8;
else if (wieldie == 1) wieldtype = 4;
else if (wieldie == 3) wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 13 )
{
if ( wieldie == 1) wieldtype = 8;
else if (wieldie == 2) wieldtype = 4;
else wieldtype = 1;
}
if ( wieldorig == 12 )
{
if ( wieldie == 1 ) wieldtype = 8;
else wieldtype = 4;
}
if ( wieldorig == 11 )
{
if ( wieldie == 1 ) wieldtype = 8;
if ( wieldie == 2 ) wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 10 )
{
if ( wieldie == 1 ) wieldtype = 8;
else wieldtype = 2;
}
if ( wieldorig == 9 )
{
if ( wieldie == 1 ) wieldtype = 8;
else wieldtype = 1;
}
if ( wieldorig == 7 )
{
if ( wieldie == 1 ) wieldtype = 4;
else if ( wieldie == 2 ) wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 6 )
{
if ( wieldie == 1 || wieldie == 2) wieldtype = 2;
else wieldtype = 4;
}
if ( wieldorig == 5 )
{
if ( wieldie == 1) wieldtype = 4;
else wieldtype = 1;
}
if ( wieldorig == 3 )
{
if ( wieldie == 2 || wieldie == 4) wieldtype = 2;
else wieldtype = 1;
}
one_hit( ch, victim, -1, wieldtype );
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if ( ch->fighting != victim ) return;
}
if (!IS_NPC(ch) && IS_VAMPAFF(ch,VAM_FANGS))
{
if (!IS_NPC(victim)) {
one_hit(ch,victim, (TYPE_HIT + 10),0);
one_hit( ch, victim, ( TYPE_HIT + 10 ), 0 );
}
else {
one_hit(ch,victim, (TYPE_HIT + 10),1);
one_hit( ch, victim, ( TYPE_HIT + 10 ), 1 );
}
}
if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
&& IS_SET(ch->warp, WARP_SPIKETAIL) && number_range(1,3) == 1)
{
if (IS_NPC(victim)) {
one_hit( ch, victim, gsn_spiket, 0);
one_hit( ch, victim, gsn_spiket, 1);
}
else one_hit( ch, victim, gsn_spiket, 0);
}
/* Golems speciels */
if (IS_NPC(ch))
{
if (ch->pIndexData->vnum == MOB_VNUM_FIRE)
{
if ((sn = skill_lookup( "curse" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
if ((sn = skill_lookup( "imp faerie fire" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
}
if (ch->pIndexData->vnum == MOB_VNUM_STONE)
{
af.type = skill_lookup("reserved");
af.duration = 20;
af.location = APPLY_DAMROLL;
af.modifier = -50;
af.bitvector = 0;
affect_to_char(victim, &af );
af.type = skill_lookup("reserved");
af.duration = 20;
af.location = APPLY_HITROLL;
af.modifier = -50;
af.bitvector = 0;
affect_to_char(victim, &af );
send_to_char("You feel weak in the presence of the stone golem.\n\r",victim);
}
if (ch->pIndexData->vnum == MOB_VNUM_CLAY)
{
if ((sn = skill_lookup( "clay" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
}
if (ch->pIndexData->vnum == MOB_VNUM_IRON)
{
if ((sn = skill_lookup( "group heal" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
}
}
if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
&& IS_SET(ch->warp, WARP_SHARDS) && number_range(1,3) == 1)
{
one_hit( ch, victim, gsn_shards, 0);
one_hit( ch, victim, gsn_shards, 0);
}
if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
&& IS_SET(ch->warp, WARP_MAGMA) && number_range(1,3) == 1)
{
if (IS_NPC(victim)) {
one_hit( ch, victim, gsn_magma, 0);
one_hit( ch, victim, gsn_magma, 1);
}
else one_hit( ch, victim, gsn_magma, 0);
}
if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
&& IS_SET(ch->warp, WARP_VENOMTONG) && number_range(1,3) == 1)
one_hit( ch, victim, gsn_venomt, 0);
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if (!IS_NPC(ch) && !IS_NPC(victim)) // pkpower
{
if (get_ratio(ch) > 2499)
{
i = number_range(1,10);
if (i < 5) one_hit(ch,victim, gsn_supreme,0);
else if (i < 7) one_hit(ch,victim, gsn_supreme,1);
else ;
}
}
if (!IS_NPC(ch) && ch->level > 2)
{
if ((IS_CLASS(ch, CLASS_UNDEAD_LYCAN) || IS_CLASS(ch, CLASS_HELL_SPAWN)
|| IS_CLASS(ch, CLASS_VAMPIRIC_MIST) || IS_CLASS(ch, CLASS_VAMPIRE)
|| IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_HELLS_SOLDIER)
|| IS_CLASS(ch, CLASS_SHADOW_FIEND) || IS_CLASS(ch, CLASS_SHADOW_DRAGON))
&& IS_VAMPAFF(ch,VAM_HORNS) && number_range(1,3) == 1)
{
multi_hit( ch, victim, gsn_headbutt );
}
}
if ((IS_CLASS(ch, CLASS_TANARRI) || IS_CLASS(ch, CLASS_DEVA)
|| IS_CLASS(ch, CLASS_HELL_SPAWN) || IS_CLASS(ch, CLASS_BAATEZU)) && !IS_NPC(ch))
{
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_FANGS))
{
one_hit(ch, victim, gsn_fangs, 1);
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_HEAD))
one_hit(ch, victim, gsn_fangs, 1);
}
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_FIERY))
{
one_hit(ch, victim, gsn_fiery, 1);
if (IS_CLASS(victim, CLASS_ANGEL)) one_hit(ch, victim, gsn_fiery, 1);
}
}
if (IS_CLASS(ch, CLASS_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!");
sprintf(buf1, "#B$n sidesteps $N#B's jab and strikes back!#0[#R%d#0]#n", dam);
sprintf(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 ((IS_CLASS(ch, CLASS_UNDEAD_KNIGHT) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN)
|| IS_CLASS(ch, CLASS_NAZGUL) || IS_CLASS(ch, CLASS_NECROMANCER) || IS_CLASS(ch, CLASS_BLADE_MASTER))
&& ch->pcdata->powers[WEAPONSKILL] > 9)
{
one_hit(ch,victim,gsn_lightningslash,1);
one_hit(ch,victim,gsn_lightningslash,1);
one_hit(ch,victim,gsn_lightningslash,1);
}
if (IS_CLASS(ch, CLASS_WRAITH) || IS_CLASS(ch, CLASS_SHADOWBORN))
{
one_hit(ch,victim,gsn_dblast,1);
one_hit(ch,victim,gsn_dblast,1);
one_hit(ch,victim,gsn_dblast,1);
one_hit(ch,victim,gsn_dblast,1);
}
if (IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER))
{
one_hit(ch,victim,gsn_jugularslice,1);
one_hit(ch,victim,gsn_jugularslice,1);
one_hit(ch,victim,gsn_jugularslice,1);
}
if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
&& IS_DEMAFF(ch,DEM_HORNS) && number_range(1,3) == 1)
one_hit( ch, victim, gsn_headbutt, 0 );
if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
&& number_range(1,3) == 1 && ch->power[DISC_DAEM_HELL] > 3)
one_hit(ch, victim, gsn_hellfire, 0);
if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
&& IS_DEMAFF(ch, DEM_TAIL) && number_range(1,2) == 2)
one_hit( ch, victim, gsn_sweep, 0 );
//Ghoul Disease
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)
{
sprintf(buf1,
"#G$N #ccringes in pain as your diseased claws rend their flesh! #g[#G%d#g]#n",
dam);
sprintf(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(ch, CLASS_GHOUL))
{
if (IS_VAMPAFF(ch, VAM_CLAWS))
{
one_hit(ch,victim,gsn_claws,0);
one_hit(ch,victim,gsn_claws,0);
if ( ch->pcdata->powers[GPOWER_SHADOW] >= 4) one_hit(ch,victim,gsn_claws,0);
}
}
if(!IS_NPC(ch) && IS_CLASS(ch, CLASS_ZOMBIE) && IS_SET(ch->pcdata->powers[ZOM_ACTIVE], ZOM_PLAGUE)){
multi_hit(ch,victim,gsn_zomplague);
}
if(!IS_NPC(ch) && IS_CLASS(ch, CLASS_ZOMBIE) && IS_SET(ch->pcdata->powers[ZOM_ACTIVE], ZOM_DECAY)){
multi_hit(ch,victim,gsn_stench);
}
/*
if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER)
|| IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
&& ch->pcdata->powers[ASSASSIN_COMBAT] >= 4 && number_range(1,2) != 1)
multi_hit(ch, victim, gsn_jugularslice);
*/
/* if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_WRAITH) || IS_CLASS(ch, CLASS_SHADOWBORN)
|| IS_CLASS(ch, CLASS_SHADOW_FIEND) || IS_CLASS(ch, CLASS_VAMPIRIC_MIST))
&& ch->pcdata->powers[WRAITH_WRATH] >=1 && number_range(1,4) != 1)
multi_hit(ch, victim, gsn_dblast);
*/
if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_DRUID)
|| IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_NECROMANCER)
|| IS_CLASS(ch, CLASS_ELEMENTAL)) && ch->pcdata->powers[ELEMENTAL_FIRE] >=1 && number_range(1,4) == 1)
multi_hit(ch, victim, gsn_fblast);
if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_DRUID)
|| IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_NECROMANCER)
|| IS_CLASS(ch, CLASS_ELEMENTAL)) && ch->pcdata->powers[ELEMENTAL_AIR] >=1 && number_range(1,4) == 1)
multi_hit(ch, victim, gsn_wgust);
if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_DRUID)
|| IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_NECROMANCER)
|| IS_CLASS(ch, CLASS_ELEMENTAL)) && ch->pcdata->powers[ELEMENTAL_WATER] >=1 && number_range(1,4) == 1)
multi_hit(ch, victim, gsn_torrent);
if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_DRUID)
|| IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_NECROMANCER)
|| IS_CLASS(ch, CLASS_ELEMENTAL)) && ch->pcdata->powers[ELEMENTAL_EARTH] >=1 && number_range(1,4) == 1)
multi_hit(ch, victim, gsn_rslide);
if (!IS_NPC(ch) && IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) && number_range(1,2) != 1)
multi_hit(ch, victim, gsn_cblast);
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_HYDRA))
{
one_hit(ch,victim,gsn_malice,1);
one_hit(ch,victim,gsn_malice,1);
one_hit(ch,victim,gsn_malice,1);
}
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_ANTIPALADIN) && IS_SET(ch->pcdata->powers[15], APOWER_MALICE))
{
one_hit(ch,victim,gsn_malice,1);
one_hit(ch,victim,gsn_malice,1);
one_hit(ch,victim,gsn_malice,1);
}
if (!IS_NPC(ch))
{
if (IS_VAMPAFF(ch,VAM_TAIL) && number_range(1,2) == 1)
multi_hit( ch, victim, gsn_sweep );
}
if (!IS_NPC(ch) && (IS_VAMPAFF(ch,VAM_HEAD) && number_range(1,2) == 1))
{
multi_hit( ch, victim, gsn_fangs );
}
if (!IS_NPC(ch) && IS_SET(ch->newbits,NEW_QUILLS) && (IS_CLASS(ch,CLASS_WEREWOLF)
|| IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
|| IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER)))
multi_hit(ch,victim,gsn_quills);
if (!IS_NPC(ch) && IS_SET(ch->newbits, NEW_DARKTENDRILS)
&& (IS_CLASS(ch, CLASS_DROW) || IS_CLASS(ch, CLASS_BLACK_ASSASSIN)
|| IS_CLASS(ch, CLASS_STALKER) || IS_CLASS(ch, CLASS_SHADOWBORN)))
multi_hit(ch,victim,gsn_darktendrils);
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_HUMAN)) // IS_SET(ch->newbits,NEW_MULTIARMS))
multi_hit(ch,victim,gsn_mageshield);
if (IS_CLASS(ch, CLASS_GIANT))
multi_hit(ch, victim, gsn_bash);
if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_PALADIN) || IS_CLASS(ch, CLASS_HEAVENS_SOLDIER)
|| IS_CLASS(ch, CLASS_DRUID) || IS_CLASS(ch, CLASS_GOLD_DRAGON))
&& IS_SET(ch->pcdata->powers[PALADIN_EFFECTS], PAL_AURA))
// && (IS_CLASS(ch,CLASS_PALADIN)
{
one_hit(ch,victim,gsn_holyaura,1);
one_hit(ch,victim,gsn_holyaura,1);
one_hit(ch,victim,gsn_holyaura,1);
one_hit(ch,victim,gsn_holyaura,1);
}
if (!IS_NPC(ch) && (IS_CLASS(ch,CLASS_ANGEL) || IS_CLASS(ch,CLASS_HEAVENS_SOLDIER)
|| IS_CLASS(ch,CLASS_TYPHON) || IS_CLASS(ch,CLASS_BETRAYER)
|| IS_CLASS(ch,CLASS_SILVER_DRAGON)))
{
if (IS_SET(ch->pcdata->powers[ANGEL_POWERS], ANGEL_AURA))
{
one_hit(ch,victim,gsn_heavenlyaura,1);
one_hit(ch,victim,gsn_heavenlyaura,1);
one_hit(ch,victim,gsn_heavenlyaura,1);
}
if (IS_SET(ch->pcdata->powers[ANGEL_POWERS], ANGEL_HALO))
{
switch(number_range(1,5))
{
default : break;
case 1 :
if ((sn = skill_lookup( "curse" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
break;
case 2 :
if ((sn = skill_lookup( "web" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
break;
case 3 :
if ((sn = skill_lookup( "imp heal" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
break;
case 4 :
if ((sn = skill_lookup( "imp fireball" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
break;
case 5 :
if ((sn = skill_lookup( "godbless" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
break;
}
}
}
if (wield != NULL)
{
if (victim->hit < 1) return;
if (wield->item_type == ITEM_WEAPON)
{
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int dam;
int dam2;
int fire = wield->fire_level;
int water = wield->water_level;
int electric = wield->lightning_level;
int earth = wield->earth_level;
int wpnlevel = wield->weapon_level;
if (wield2 != NULL)
{
fire += wield2->fire_level;
water += wield2->water_level;
electric += wield2->lightning_level;
earth += wield2->earth_level;
wpnlevel += wield2->weapon_level;
}
if (wield3 != NULL)
{
fire += wield3->fire_level;
water += wield3->water_level;
electric += wield3->lightning_level;
earth += wield3->earth_level;
wpnlevel += wield3->weapon_level;
}
if (wield4 != NULL)
{
fire += wield4->fire_level;
water += wield4->water_level;
electric += wield4->lightning_level;
earth += wield4->earth_level;
wpnlevel += wield4->weapon_level;
}
if (victim->hit < 1) return;
if (wpnlevel > 0)
{
if (wpnlevel >= 10) earth += 1;
if (wpnlevel >= 20) fire += 1;
if (wpnlevel >= 30) electric+= 1;
if (wpnlevel >= 50) water += 1;
if (wpnlevel >= 60) fire += 1;
if (wpnlevel >= 70) electric += 1;
if (wpnlevel >= 80) water += 1;
if (wpnlevel >= 100) earth += 1;
}
if (wpnlevel > 0)
{
if (victim->hit < 1) return;
dam2 = (number_range(5,10) * wpnlevel);
if (!IS_SET(ch->act, PLR_BRIEF2))
{
sprintf(buf1, "#0Your weapon #RSoulSucks #0$N! #0[#R%d#0]#n", dam2);
sprintf(buf2, "#0$n's living weapon #RSoulSucks#0 you! #0[#R%d#0]#n",dam2);
act(buf1, ch, NULL, victim, TO_CHAR);
act(buf2, ch, NULL, victim, TO_VICT);
}
// hurt_person(ch, victim, dam2);
sprintf(buf, "#0You are #LH#7ealed #0for %d HP\n\r", dam2);
stc(buf, ch);
ch->hit += dam2;
if (ch->hit > ch->max_hit) ch->hit = ch->max_hit;
}
if (fire > 0)
{
if (victim->hit < 1) return;
dam = (number_range(500,1000) * fire);
if (!IS_SET(ch->act, PLR_BRIEF2))
{
sprintf(buf1, "#0Fire from your enflamed weapon strikes out at $N! #0[#R%d#0]#n", dam);
sprintf(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)
{
if (victim->hit < 1) return;
dam = (number_range(500,1000) * water);
if (!IS_SET(ch->act, PLR_BRIEF2))
{
sprintf(buf1, "#0Ice from your frozen weapon strikes out at $N! #0[#R%d#0]#n", dam);
sprintf(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)
{
if (victim->hit < 1) return;
dam = (number_range(500,1000) * electric);
if (!IS_SET(ch->act, PLR_BRIEF2))
{
sprintf(buf1,
"#0Lightning from your electric weapon strikes out at $N! #0[#R%d#0]#n",
dam);
sprintf(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)
{
if (victim->hit < 1) return;
dam = (number_range(500,1000) * earth);
if (!IS_SET(ch->act, PLR_BRIEF2))
{
sprintf(buf1,
"#0Stones from your earthly weapon strikes out at $N! #0[#R%d#0]#n",
dam);
sprintf(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 (IS_SET(wield1->quest2, QUEST2_WWPOISON))
{
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int dam = number_range(500, 1500);
sprintf(buf1,
"#0Your weapon's #gp#Goiso#gn #0seeps into #R$N! #0[#R%d#0]#n",
dam);
sprintf(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);
}
*/
}
}
if (!IS_NPC(ch) && (IS_CLASS(ch,CLASS_WEREWOLF) || IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
|| IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER)))
{
if (IS_SET(ch->newbits,NEW_SLAM) && number_range(1,7-ch->power[DISC_WERE_BEAR]/3)==1)
multi_hit(ch,victim,gsn_cheapshot);
}
if (!IS_NPC(ch) && IS_VAMPAFF(ch,VAM_WINGS) && number_range(1,2) == 1 && ch->level > 2)
multi_hit( ch, victim, gsn_buffet );
if (!IS_NPC(ch) && IS_VAMPAFF(ch,VAM_WINGS) && number_range(1,2) == 1 && ch->level > 2)
multi_hit( ch, victim, gsn_buffet );
if ((IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND))
&& IS_SET(ch->warp, WARP_WINGS) && number_range(1,3) == 1)
one_hit(ch, victim, gsn_buffet, 0 );
if (!IS_NPC(ch) && (IS_CLASS(ch,CLASS_WEREWOLF) || IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
|| IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER)) && ch->power[DISC_WERE_RAPT] > 0)
multi_hit(ch,victim,gsn_rfangs);
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_UNDEAD_LYCAN) || IS_CLASS(ch, CLASS_HELL_SPAWN)
|| IS_CLASS(ch, CLASS_VAMPIRIC_MIST) || IS_CLASS(ch, CLASS_VAMPIRE))
&& IS_VAMPAFF(ch, VAM_SERPENTIS))
spell_poison( gsn_poison, (ch->level*number_range(5,10)),ch,victim );
else if (!IS_NPC(ch) && (IS_CLASS(ch,CLASS_WEREWOLF)
|| IS_CLASS(ch, CLASS_GAIA_WOLF) || IS_CLASS(ch, CLASS_STALKER))
&& ch->power[DISC_WERE_SPID] > 0)
spell_poison( gsn_poison, (ch->level*number_range(5,10)),ch,victim );
else if (!IS_NPC(ch) && (IS_CLASS(ch, CLASS_DROW) || IS_CLASS(ch, CLASS_BLACK_ASSASSIN)
|| IS_CLASS(ch, CLASS_STALKER) || IS_CLASS(ch, CLASS_SHADOWBORN))
&& IS_SET(ch->pcdata->powers[1], DPOWER_DROWPOISON))
spell_poison(gsn_poison,(ch->level*number_range(10,20)),ch,victim);
if (victim->itemaffect < 1) return;
if (IS_NPC(victim) || victim->spl[1] < 4) level = victim->level;
else level = (victim->spl[1] * 0.25);
if (IS_SET(victim->newbits, NEW_MONKFLAME) && !IS_AFFECTED(ch, AFF_FLAMING))
{
if (number_percent() > 95)
{
SET_BIT(ch->affected_by, AFF_FLAMING);
if (!IS_NPC(ch) && (!IS_CLASS(ch,CLASS_WEREWOLF) || !IS_CLASS(ch, CLASS_UNDEAD_LYCAN)
|| !IS_CLASS(ch, CLASS_GAIA_WOLF) || !IS_CLASS(ch, CLASS_STALKER)))
{
act("Your flaming hands catch $n on fire!", ch, NULL, victim, TO_VICT);
act("$N's flaming hands catch $n on fire!", ch, NULL, victim, TO_NOTVICT);
act("$N's flaming hands catch you on fire!.", ch, NULL, victim, TO_CHAR);
}
else
{
act("Your flaming claws catch $n on fire!", ch, NULL, victim, TO_VICT);
act("$N's flaming claws catch $n on fire!", ch, NULL, victim, TO_NOTVICT);
act("$N's flaming claws catch you on fire!.", ch, NULL, victim, TO_CHAR);
}
}
else return;
}
if (!IS_NPC(victim))
{
if (IS_SET(victim->pcdata->powers[AURAS], DEATH_AURA) && (IS_CLASS(victim, CLASS_UNDEAD_KNIGHT)
|| IS_CLASS(victim, CLASS_UNDEAD_ASSASSIN)
|| IS_CLASS(victim, CLASS_NAZGUL) || IS_CLASS(victim, CLASS_NECROMANCER)))
{
while (number_range(1, 2) != 1)
one_hit(victim, ch, gsn_deathaura, 0);
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_CLASS(victim,CLASS_ANTIPALADIN) && IS_SET(victim->pcdata->powers[15], APOWER_TAKAURA))
{
while (number_range(1, 2) != 1)
one_hit(victim, ch, gsn_takaura, 0);
while (number_range(1, 2) != 1)
one_hit(victim, ch, gsn_takaura, 0);
while (number_range(1, 2) != 1)
one_hit(victim, ch, gsn_takaura, 0);
}
if (IS_SET(victim->pcdata->powers[AURAS],
FEAR_AURA) && (IS_CLASS(victim, CLASS_UNDEAD_KNIGHT)
|| IS_CLASS(victim, CLASS_UNDEAD_ASSASSIN) || IS_CLASS(victim, CLASS_NAZGUL) || IS_CLASS(victim, CLASS_NECROMANCER)))
{
af.type = skill_lookup("reserved");
af.duration = 20;
af.location = APPLY_DAMROLL;
af.modifier = -20;
af.bitvector = 0;
affect_to_char(ch, &af );
af.type = skill_lookup("reserved");
af.duration = 20;
af.location = APPLY_HITROLL;
af.modifier = -20;
af.bitvector = 0;
affect_to_char(ch, &af );
send_to_char("You piss your pants out of fear.\n\r",ch);
}
}
if (IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD) && ch->position == POS_FIGHTING)
if ( (sn = skill_lookup( "lightning bolt" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,level,victim,ch);
if (IS_ITEMAFF(victim, ITEMA_FIRESHIELD) && ch->position == POS_FIGHTING)
if ( (sn = skill_lookup( "fireball" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,level,victim,ch);
if (IS_ITEMAFF(victim, ITEMA_ICESHIELD) && ch->position == POS_FIGHTING)
if ( (sn = skill_lookup( "chill touch" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,level,victim,ch);
if (IS_ITEMAFF(victim, ITEMA_ACIDSHIELD) && ch->position == POS_FIGHTING)
if ( (sn = skill_lookup( "acid blast" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,level,victim,ch);
// if (IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) && ch->position == POS_FIGHTING)
// if ( (sn = skill_lookup( "chaos blast" ) ) > 0)
// (*skill_table[sn].spell_fun) (sn,level,victim,ch);
// {
// one_hit(ch,victim,gsn_heavenlyaura,1);
// }
if (IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) && ch->position == POS_FIGHTING)
{
one_hit(victim,ch,gsn_cblast,1);
}
return;
}
int number_attacks( CHAR_DATA *ch, CHAR_DATA *victim )
{
int count = 1;
char buf[MSL];
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->hitsizedice > 20) count += 20;
else count += ch->pIndexData->hitsizedice;
return count;
}
if (!IS_NPC(ch))
{
if (!IS_NPC(ch)) if (ch->tier > 0) count += ch->tier;
if (!IS_NPC(ch)) if (ch->pcdata->upgrade_level > 0) count += ch->pcdata->upgrade_level;
if ((wield = get_eq_char(ch, WEAR_WIELD)) != NULL && wield->item_type == ITEM_WEAPON)
if (wield->attack_level > 0) count += (wield->attack_level);
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_CLASS(ch, CLASS_VAMPIRE))
{
count += (balance[3].number_attacks - 4);
if (ch->power[DISC_VAMP_CELE] > 0) count += 1;
if (ch ->power[DISC_VAMP_CELE] > 5) count += 1;
if (ch->power[DISC_VAMP_CELE] > 7) count += 1;
if ( ch->power[DISC_VAMP_CELE] > 9) count += 1;
}
if (IS_CLASS(ch, CLASS_ANGEL)) count += balance[5].number_attacks;
if (IS_CLASS(ch, CLASS_ZOMBIE)) count += balance[13].number_attacks;
if (IS_CLASS(ch, CLASS_HUMAN)) count += balance[15].number_attacks;
if (IS_CLASS(ch, CLASS_WRAITH)) count += balance[8].number_attacks;
if (IS_CLASS(ch, CLASS_PALADIN)) count += balance[10].number_attacks;
if (IS_CLASS(ch, CLASS_ELEMENTAL)) count += balance[9].number_attacks;
if (IS_CLASS(ch,CLASS_WEREWOLF))
{
if ( ch->power[DISC_WERE_LYNX] > 2) count += 2;
if ( ch->power[DISC_WERE_BOAR] > 6)
{
if (ch->move > 100000)
count += (balance[1].number_attacks - 2);
else count += (ch->move/10000);
}
}
count += (get_curr_str(ch) + get_curr_dex(ch))/50;
if (IS_CLASS(ch, CLASS_TANARRI)) count += balance[4].number_attacks;
if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT)) count += balance[6].number_attacks;
if (IS_CLASS(ch, CLASS_ANTIPALADIN))
{
count += (balance[17].number_attacks - 2);
if (IS_SET(ch->pcdata->powers[15], APOWER_SPEED)) count += 4;
}
if (IS_CLASS(ch, CLASS_GHOUL)) count += balance[20].number_attacks;
if (IS_CLASS(ch, CLASS_GIANT)) count += balance[16].number_attacks;
if (IS_CLASS(ch, CLASS_SKYBLADE)) count += balance[18].number_attacks;
if (IS_CLASS(ch, CLASS_PRIEST)) count += balance[19].number_attacks;
if (IS_CLASS(ch, CLASS_ASSASSIN)) count += balance[7].number_attacks;
if (IS_CLASS(ch, CLASS_UNDEAD_LYCAN)) count += balance[21].number_attacks;
if (IS_CLASS(ch, CLASS_HELLS_SOLDIER)) count += balance[22].number_attacks;
if (IS_CLASS(ch, CLASS_GAIA_WOLF)) count += balance[23].number_attacks;
if (IS_CLASS(ch, CLASS_SHADOWBORN)) count += balance[24].number_attacks;
if (IS_CLASS(ch, CLASS_BETRAYER)) count += balance[25].number_attacks;
if (IS_ITEMAFF(ch, ITEMA_SPEED) ) count += 2;
if (!IS_NPC(ch) && IS_ITEMAFF(ch, ITEMA_BEAST)) count += 2;
if (IS_CLASS(ch, CLASS_DRAGON)) count += balance[12].number_attacks;
if (IS_CLASS(ch, CLASS_HYDRA)) count += balance[11].number_attacks;
if (IS_CLASS(ch, CLASS_DEMON) && ch->power[DISC_DAEM_ATTA] > 0) count += balance[0].number_attacks;
if(IS_CLASS(ch,CLASS_SHINOBI)){
switch(ch->pcdata->powers[S_ELEMENT]){
case S_WIND:
count += balance[14].number_attacks + 3;
break;
case S_FIRE:
count += balance[14].number_attacks + 1;
break;
case S_WATER:
count += balance[14].number_attacks;
break;
case S_HOLY:
count += balance[14].number_attacks - 1;
break;
case S_EARTH:
count += balance[14].number_attacks + 3;
break;
case S_SHADOW:
count += balance[14].number_attacks - 1;
break;
}
if(IS_SET(ch->pcdata->powers[S_ACTIVE], S_FLUIDITY)) count += 2;
if(IS_SET(ch->pcdata->powers[S_ACTIVE], S_DAEMI)) count += 2;
}
if(IS_SET(ch->newbits2, NEW2_WASH)) count -= 2;
if(IS_SET(ch->newbits2, NEW2_TORRA)) count -= 2;
if (IS_CLASS(ch, CLASS_DROW)) count += balance[2].number_attacks;
}
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;
if ( count > 10) count = 10;
return count;
}
/*
* Hit one guy once.
*/
void one_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt, int handtype)
{
OBJ_DATA *wield;
int victim_ac;
int thac0;
int thac0_00;
int thac0_32;
int dam, wdam;
int diceroll;
int level;
int attack_modify;
int right_hand;
// Assymetric - Newbie protection - 4 hours
// This should never come up, but just in case someone finds a back door into combat
if(!IS_NPC(ch) && !IS_NPC(victim) && ((get_age(victim) - 17) < 2 || (get_age(ch) - 17) < 2))
{
stc("You can't attack newbies or attack as a newbie!\n\r", ch);
stop_fighting(ch, victim);
return;
}
/*
* Can't beat a dead char!
* Guard against weird room-leavings.
*/
if (victim->position == POS_DEAD || ch->in_room != victim->in_room)
return;
if ( !IS_NPC(ch) )
{
if (IS_AFFECTED( ch, AFF_PEACE) && ch->fighting != NULL)
REMOVE_BIT(ch->affected_by, AFF_PEACE);
}
if ( !IS_NPC(victim) )
{
if (IS_AFFECTED(victim, AFF_PEACE) && victim->fighting != NULL)
REMOVE_BIT(victim->affected_by, AFF_PEACE);
}
/*
* Figure out the type of damage message.
*/
if (handtype == 8)
{
wield = get_eq_char( ch, WEAR_FOURTH );
right_hand = 8;
}
else if (handtype == 4)
{
wield = get_eq_char( ch, WEAR_THIRD );
right_hand = 4;
}
else if (handtype == 2)
{
wield = get_eq_char( ch, WEAR_HOLD );
right_hand = 2;
}
else if (handtype == 0)
{
wield = NULL;
right_hand = 0;
}
else
{
if (IS_SET(ch->act, PLR_RIGHTHAND))
wield = get_eq_char( ch, WEAR_WIELD );
else if (IS_SET(ch->act, PLR_LEFTHAND))
wield = get_eq_char( ch, WEAR_HOLD );
else
{
if (number_range(1,10) > 4)
wield = get_eq_char( ch, WEAR_HOLD );
else
wield = get_eq_char( ch, WEAR_WIELD );
}
right_hand = 1; // improve the right hand anyway...
}
if ( dt == TYPE_UNDEFINED )
{
dt = TYPE_HIT;
if ( wield != NULL && wield->item_type == ITEM_WEAPON )
dt += wield->value[3];
}
if (ch->wpn[dt - 1000] > 5)
level = (ch->wpn[dt - 1000] / 5);
else
level = 1;
if (level > 40)
level = 40;
/*
* Calculate to-hit-armor-class-0 versus armor.
*/
if ( IS_NPC(ch) )
{
thac0_00 = 20;
thac0_32 = 0;
}
else
{
thac0_00 = SKILL_THAC0_00;
thac0_32 = SKILL_THAC0_32;
}
thac0 = interpolate( level, thac0_00, thac0_32 ) - char_hitroll(ch);
victim_ac = UMAX( -100, char_ac(victim) / 10 );
if (!can_see( ch, victim ))
victim_ac -= 4;
if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_3))
victim_ac += 300;
if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_2))
victim_ac += 200;
if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_1))
victim_ac += 100;
/*
* The moment of excitement!
*/
while ((diceroll = number_bits( 5 ) ) >= 20)
;
if ( diceroll == 0 || ( diceroll != 19 && diceroll < thac0 - victim_ac ) )
{ /* Miss. */
damage( ch, victim, 0, dt );
improve_weapon_res(victim, dt);
tail_chain( );
if (!is_safe(ch,victim))
{
improve_wpn(ch,dt,right_hand);
improve_stance(ch);
}
return;
}
/*
* Hit.
* Calc damage.
*/
if ( IS_NPC(ch) )
{
dam = number_range( ch->level / 2, ch->level * 3 / 2 );
if (ch->level >= 300) dam *= ch->level / 500;
if ( wield != NULL )
dam += dam * 0.5;
}
else
{
if (dt == gsn_mageshield)
{
dam = (ch->spl[RED_MAGIC] + ch->spl[YELLOW_MAGIC] + ch->spl[GREEN_MAGIC]
+ ch->spl[PURPLE_MAGIC] + ch->spl[BLUE_MAGIC])/5;
dam = number_range(2*dam, 3*dam);
}
else if (wield != NULL && wield->item_type == ITEM_WEAPON)
dam = dice( wield->value[1], wield->value[2] );
else if ( IS_VAMPAFF(ch, VAM_CLAWS) && IS_GAR1(ch, WOLF_RAZORCLAWS))
dam = dice( 25, 35 );
else if ( IS_VAMPAFF(ch,VAM_CLAWS))
dam = dice( 10, 20 );
else
dam = dice( 4, 10 );
// This really shouldn't be done this way, but regardless, I changed the dice to reasonable values
if ((IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER)
|| IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
&& ch->pcdata->powers[ASSASSIN_POWER] == 7)
dam += dice( 1, 10 );
if ((IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER)
|| IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
&& ch->pcdata->powers[ASSASSIN_POWER] == 8)
dam += dice( 3, 10 );
if ((IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER)
|| IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
&& ch->pcdata->powers[ASSASSIN_POWER] == 9)
dam += dice( 5, 10 );
if ((IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER)
|| IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))
&& ch->pcdata->powers[ASSASSIN_POWER] >= 10)
dam += dice( 7, 10 );
if (IS_CLASS(ch, CLASS_PALADIN) || IS_CLASS(ch, CLASS_HEAVENS_SOLDIER)
|| IS_CLASS(ch, CLASS_DRUID) || IS_CLASS(ch, CLASS_GOLD_DRAGON))
dam += dice( 3, 7 );
}
/*
* Bonuses.
*/
dam += char_damroll(ch);
if (!IS_AWAKE(victim)) dam *= 2;
if (!IS_NPC(ch) && dt >= TYPE_HIT) dam = dam + (dam * (UMIN(350,(ch->wpn[dt-1000]+1)) / 60));
/* Other Resistances */
if (IS_ITEMAFF(victim, ITEMA_RESISTANCE))
{
dam *= 3;
dam /= 4;
}
if (!IS_NPC(victim) && victim->pResist > 0)
{
if (victim->pResist == 1) dam / 1;
if (victim->pResist == 2) dam / 1.1;
if (victim->pResist == 3) dam / 1.1;
if (victim->pResist == 4) dam / 1.2;
if (victim->pResist == 5) dam / 1.2;
if (victim->pResist == 6) dam / 1.3;
if (victim->pResist == 7) dam / 1.3;
if (victim->pResist == 8) dam / 1.3;
if (victim->pResist == 9) dam / 1.4;
if (victim->pResist == 10) dam / 1.4;
if (victim->pResist == 11) dam / 1.4;
if (victim->pResist == 12) dam / 1.4;
if (victim->pResist == 13) dam / 1.5;
if (victim->pResist == 14) dam / 1.5;
if (victim->pResist == 15) dam / 1.5;
if (victim->pResist == 16) dam / 1.5;
if (victim->pResist == 17) dam / 1.6;
if (victim->pResist == 18) dam / 1.6;
if (victim->pResist == 19) dam / 1.7;
if (victim->pResist >= 20) dam / 1.8;
}
/* damage reduction */
if (!IS_NPC(ch) && !IS_NPC(victim)) dam /= 2; /* slow down pk */
if (IS_NPC(ch) && dam > 2000) dam = 2000 + (dam-2000)/1.5; /* mob damage >2000 divided by 1.5 */
if ( dam <= 0 ) dam = 5;
if(IS_NPC(victim)) {
if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_3)
&& ch->stance[(ch->stance[0])] >100)
dam += dam * 1.5 * (ch->stance[(ch->stance[0])] / 200);
else if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_2)
&& ch->stance[(ch->stance[0])] >100)
dam += dam * 1.0 * (ch->stance[(ch->stance[0])] / 200);
else if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_1)
&& ch->stance[(ch->stance[0])] >100)
dam += dam * 0.5 * (ch->stance[(ch->stance[0])] / 200);
}
if(!IS_NPC(victim)) {
if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_3)
&& ch->stance[(ch->stance[0])] >100)
dam += dam * 0.5 * (ch->stance[(ch->stance[0])] / 200);
else if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_2)
&& ch->stance[(ch->stance[0])] >100)
dam += dam * 0.3 * (ch->stance[(ch->stance[0])] / 200);
else if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_1)
&& ch->stance[(ch->stance[0])] >100)
dam += dam * 0.1 * (ch->stance[(ch->stance[0])] / 200);
}
if ( victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_RESIST_3)
&& victim->stance[(victim->stance[0])] >100)
dam *= 0.7;
else if ( victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_RESIST_2)
&& victim->stance[(victim->stance[0])] >100)
dam *= 0.8;
else if ( victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_RESIST_1)
&& victim->stance[(victim->stance[0])] >100)
dam *= 0.9;
/* The test ends here */
if (!IS_NPC(victim) && (IS_CLASS(ch, CLASS_DROW) || IS_CLASS(ch, CLASS_BLACK_ASSASSIN)
|| IS_CLASS(ch, CLASS_STALKER) || IS_CLASS(ch, CLASS_SHADOWBORN)) && IS_SET(victim->newbits, NEW_DARKTENDRILS))
{
int ddodge = number_range(1,50);
if (ddodge == 10 || ddodge == 20 || ddodge == 30 || ddodge == 40 || ddodge == 50)
{
stc("#0You dark aura absorbs the damage#n.\n\r",victim);
stc("#0Your opponent's dark aura absorbs your damage#n.\n\r",ch);
dam = 0;
}
}
if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_WRAITH) || IS_CLASS(victim, CLASS_SHADOWBORN)
|| IS_CLASS(victim, CLASS_SHADOW_FIEND) || IS_CLASS(victim, CLASS_VAMPIRIC_MIST)) &&
IS_SET(victim->pcdata->powers[WRAITH_POWERS], WRAITH_DIMEDODGE))
{
if (number_range(1,11) == 2)
{
stc("#0You jump dimensions to dodge their attack.#n\n\r",victim);
stc("#0Your opponent slips temporarily into his dimension, escaping your blow.#n\n\r",ch);
dam = 0;
}
}
if (!IS_NPC(victim) && IS_ITEMAFF(victim, ITEMA_ILLUSIONS))
{
int ddodge = number_range(1,50);
if (ddodge == 10 || ddodge == 20 || ddodge == 30 || ddodge == 40 || ddodge == 50)
{
stc("#CYour illusion takes the blow, saving you from harm#n.\n\r",victim);
stc("#CYour weapon passes through your opponent without doing any harm#n.\n\r",ch);
dam = 0;
}
}
if (!IS_NPC(ch) && wield != NULL)
{
if (number_range(1,6) == 2)
{
if (ch->fighting == victim && IS_WEAP(wield,WEAPON_VAMPIRIC))
{
wdam = number_range(1,wield->level / 5 + 1);
act("$p draws life from $n.",victim,wield,NULL,TO_ROOM);
act("You feel $p drawing your life away.",
victim,wield,NULL,TO_CHAR);
hurt_person(ch,victim, wdam);
if (victim->hit <= 0) return;
}
if (ch->fighting == victim && (IS_WEAP(wield,WEAPON_FLAMING) || IS_WEAP(wield, WEAPON_ELE_FLAME)))
{
wdam = number_range(1,wield->level / 4 + 1);
if (!IS_SET(ch->act, PLR_BRIEF2)) act("$N is burned by your $p.", ch, wield, victim, TO_CHAR);
if (!IS_SET(victim->act, PLR_BRIEF2)) act("You are burned by $n's $p.", ch, wield, victim, TO_VICT);
fire_effect( (void *) victim,wield->level/2,wdam,TARGET_CHAR);
hurt_person(ch, victim, wdam);
if (victim->hit <= 0) return;
}
if (ch->fighting == victim && (IS_WEAP(wield,WEAPON_FROST) || IS_WEAP(wield, WEAPON_ELE_WATER)))
{
int sn = skill_lookup("chill touch");
if (!is_affected(victim,sn)) {
wdam = number_range(1,wield->level / 6 + 2);
if (!IS_SET(ch->act, PLR_BRIEF2)) act("Your $p freezes $N.", ch, wield, victim, TO_CHAR);
if (!IS_SET(victim->act, PLR_BRIEF2)) act("You are frozen by $n's $p.", ch, wield, victim, TO_VICT);
cold_effect(victim,wield->level/2,wdam,TARGET_CHAR);
hurt_person(ch,victim, wdam); }
if (victim->hit <= 0) return;
}
if (ch->fighting == victim && IS_WEAP(wield, WEAPON_ELE_EARTH) )
{
wdam = number_range(1,wield->level / 5 + 2);
act("$p covers $n in acid.",victim,wield,NULL,TO_ROOM);
act("The corrosive touch of $p surrounds you with acid.",
victim,wield,NULL,TO_CHAR);
acid_effect(victim,wield->level/2,wdam,TARGET_CHAR);
hurt_person(ch,victim, wdam);
if (victim->hit <= 0) return;
}
if (ch->fighting == victim && (IS_WEAP(wield,WEAPON_SHOCKING) || IS_WEAP(wield, WEAPON_ELE_AIR)))
{
wdam = number_range(1,wield->level/5 + 2);
act("$n is struck by lightning from $p.",victim,wield,NULL,TO_ROOM);
act("You are shocked by $p.",victim,wield,NULL,TO_CHAR);
shock_effect(victim,wield->level/2,wdam,TARGET_CHAR);
hurt_person(ch,victim, wdam);
if (victim->hit <= 0) return;
}
}
}
if ( dt == gsn_garotte )
dam *= (number_range(3,5));
if ( dt == gsn_backstab ) {
if (IS_CLASS(ch, CLASS_ASSASSIN) || IS_CLASS(ch, CLASS_HELLS_SOLDIER)
|| IS_CLASS(ch, CLASS_BLACK_ASSASSIN) || IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN)
&& !IS_NPC(ch) && ch->pcdata->powers[ASSASSIN_COMBAT] >=2)
// Assymetric - why the hell is this so high? At least it's damcapped...
// Cause its backstab assy :) -xrak dont look at me btw *points at jobo*
dam *= number_range(50,60);
else if( IS_CLASS(ch, CLASS_DROW))
{
dam += number_range(100,1000);
dam *= number_range(7,10);
}
else dam *= number_range(2,4);
}
/*
* Damage type modifiers.
*/
if (dt == gsn_magma && IS_CLASS(ch, CLASS_TANARRI)) dam *= 2.5;
if (dt == gsn_magma && (IS_CLASS(ch, CLASS_DEVA) || IS_CLASS(ch, CLASS_HELL_SPAWN) || IS_CLASS(ch, CLASS_BAATEZU))) dam *= 1.5;
if (dt == gsn_booming && !IS_NPC(ch) && IS_CLASS(ch, CLASS_TANARRI)) dam *= 6; // -xrak rank is max 6 so this is 3
if (dt == gsn_booming && !IS_NPC(ch) && !IS_CLASS(ch, CLASS_TANARRI)) dam *= 6;
/* if (dt == gsn_circle && ch->pcdata->rank == BELT_EIGHT) dam *= 2;
* if (dt == gsn_circle && ch->pcdata->rank == BELT_NINE) dam *= 2.5;
* if (dt == gsn_circle && ch->pcdata->rank == BELT_TEN) dam *= 3.0;
*/
if (dt == gsn_blinky) dam *= 2.7; // Assymetric - this used to be 20! -Xrak +1.5
if (dt == gsn_circle && IS_CLASS(ch, CLASS_ASSASSIN)) dam *= 3.0;
if (dt == gsn_circle && (IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_BLACK_ASSASSIN)
|| IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN))) dam *= 3.5;
if (dt == gsn_retribution && IS_CLASS(ch, CLASS_PALADIN)) dam *= 3;
if (dt == gsn_lightningslash) dam *= 3;
if (dt == gsn_retribution && IS_CLASS(ch, CLASS_ANGEL)) dam *= 3;
if (dt == gsn_retribution && !IS_CLASS(ch, CLASS_ANGEL) && !IS_CLASS(ch, CLASS_PALADIN)) dam *= 3.5; // -xrak i picked a random modifier
if (dt == gsn_deathaura) dam *= 3; // i'll adjust it later
if (dt == gsn_takaura) dam *= 3;
if (dt == gsn_potato) dam /= 2;
if (dt == gsn_shred) dam *= 2;
if (dt == gsn_claws) dam *= 2;
if (dt == gsn_dblast) dam *= 2;
if (dt == gsn_grimtouch) dam *= 3;
if (dt == gsn_fblast && IS_CLASS(ch, CLASS_ELEMENTAL)) dam *= 5;
if (dt == gsn_wgust && IS_CLASS(ch, CLASS_ELEMENTAL)) dam *= 3;
if (dt == gsn_torrent && IS_CLASS(ch, CLASS_ELEMENTAL)) dam *= 3;
if (dt == gsn_rslide && IS_CLASS(ch, CLASS_ELEMENTAL)) dam *= 3;
if (dt == gsn_fblast && !IS_CLASS(ch, CLASS_ELEMENTAL)) dam *= 5;
if (dt == gsn_wgust && !IS_CLASS(ch, CLASS_ELEMENTAL)) dam *= 3;
if (dt == gsn_torrent && !IS_CLASS(ch, CLASS_ELEMENTAL)) dam *= 3;
if (dt == gsn_rslide && !IS_CLASS(ch, CLASS_ELEMENTAL)) dam *= 3;
if (!IS_NPC(victim) && victim->pcdata->legend > 0)
{
dam += victim->pcdata->legend * 200;
dam = dam * (100 - victim->pcdata->legend) / 100;
}
else if (IS_CLASS(victim, CLASS_HUMAN) && victim->pcdata->powers[CYBER_ARMS] > 2)
{
dam / 1.2;
}
else if (IS_CLASS(victim, CLASS_HUMAN) && victim->pcdata->powers[CYBER_LEGS] > 2)
{
dam / 1.2;
}
else if (IS_CLASS(victim, CLASS_HUMAN) && victim->pcdata->powers[CYBER_ARMS] > 4)
{
dam *=300;
dam / 400;
}
else if (IS_CLASS(victim, CLASS_HUMAN) && victim->pcdata->powers[CYBER_LEGS] > 4)
{
dam *=300;
dam / 400;
}
dam = cap_dam(ch,victim,dam);
if( IS_NPC(ch) && ch->pIndexData->hitplus > 3) dam *=3;
else if( IS_NPC(ch) && ch->pIndexData->hitplus > 0 ) dam *= ch->pIndexData->hitplus;
if( IS_NPC(victim) && !IS_NPC(ch))
{
if( victim->pIndexData->hitnodice > 100 ) victim->pIndexData->hitnodice = 0;
dam = dam * (100 - victim->pIndexData->hitnodice) / 100;
}
attack_modify = dice(1, 100);
randomize_damage(ch,dam,attack_modify);
if (dt == gsn_deathaura && dam >= victim->hit && IS_NPC(victim)) dam = victim->hit-1; /* trust me, Jobo */
damage( ch, victim, dam, dt );
tail_chain( );
if (!is_safe(ch,victim))
{
improve_wpn(ch,dt,right_hand);
improve_stance(ch);
}
}
int randomize_damage( CHAR_DATA *ch, int dam, int am )
{
dam = dam * (am + 50) / 100;
return dam;
}
int cap_dam(CHAR_DATA *ch, CHAR_DATA *victim, int dam)
{
if (is_safe(ch, victim)) return 0;
if (!IS_NPC(victim)) {
if (victim->tier == 1)
dam *= 0.95;
else if (victim->tier == 2)
dam *= 0.90;
else if (victim->tier == 3)
dam *= 0.85;
else if (victim->tier == 4)
dam *= 0.80;
else if (victim->tier == 5)
dam *= 0.75;
/* 5% less damage per level */
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_DROW))
// || IS_CLASS(victim, CLASS_BLACK_ASSASSIN)
// || IS_CLASS(victim, CLASS_STALKER) || IS_CLASS(victim, CLASS_SHADOWBORN)))
{
if (IS_SET(victim->pcdata->powers[1], DPOWER_TOUGHSKIN))
dam /= 3;
}
if(!IS_NPC(victim) && IS_CLASS(victim, CLASS_ZOMBIE)){
dam /= 2;
if(IS_SET(victim->pcdata->powers[ZOM_ACTIVE], ZOM_TOUGH)) dam /= 2.5;
}
if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_WRAITH) || IS_CLASS(victim, CLASS_SHADOWBORN)
|| IS_CLASS(victim, CLASS_SHADOW_FIEND) || IS_CLASS(victim, CLASS_VAMPIRIC_MIST)))
{
dam /=2;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_ASSASSIN) || IS_CLASS(victim, CLASS_HELLS_SOLDIER)
|| IS_CLASS(victim, CLASS_BLACK_ASSASSIN) || IS_CLASS(victim, CLASS_UNDEAD_ASSASSIN))
{
if (victim->pcdata->powers[ASSASSIN_POWER] >= 1) dam /= 2.2;
else dam /=2;
}
if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_GAIA_WOLF) || IS_CLASS(victim, CLASS_DRUID)
|| IS_CLASS(victim, CLASS_DEVA) || IS_CLASS(victim, CLASS_NECROMANCER)
|| IS_CLASS(victim, CLASS_ELEMENTAL)))
{
dam /=2;
}
if ( IS_SET(victim->in_room->shinobi, ROOM_SEARTH) && IS_CLASS(victim,CLASS_SHINOBI) && victim->pcdata->powers[S_ELEMENT] != S_WIND) dam *= 0.9;
if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_PALADIN) || IS_CLASS(victim, CLASS_HEAVENS_SOLDIER)
|| IS_CLASS(victim, CLASS_DRUID) || IS_CLASS(victim, CLASS_GOLD_DRAGON)))
{
dam /=2;
dam *= 20 - victim->pcdata->powers[PALADIN_TOUGHNESS];
dam /= 20;
}
if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_HEAVENS_SOLDIER) || IS_CLASS(victim, CLASS_TYPHON)
|| IS_CLASS(victim, CLASS_SILVER_DRAGON) || IS_CLASS(victim, CLASS_ANGEL)))
{
dam *= (100 - (victim->pcdata->powers[ANGEL_HARMONY] * 12));
dam /= 100;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_SCORPION))
{
dam *= (100 - (victim->pcdata->powers[SCORPION_LIFE] * 12));
dam /= 100;
}
if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_TANARRI)
|| IS_CLASS(victim, CLASS_DEVA) || IS_CLASS(victim, CLASS_HELL_SPAWN)
|| IS_CLASS(victim, CLASS_BAATEZU)))
{
if (IS_SET(victim->pcdata->powers[TANARRI_POWER], TANARRI_EXOSKELETON)) dam /= 2.0;
if (IS_CLASS(ch, CLASS_ANGEL)) dam *= 0.75; /* trained to kill angels */
}
// if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_DEVA) || IS_CLASS(victim, CLASS_HELL_SPAWN) || IS_CLASS(victim, CLASS_BAATEZU)))
// {
// if (IS_SET(victim->pcdata->powers[TANARRI_POWER], TANARRI_EXOSKELETON)) dam *= 0.80;
// -xrak The random damage uppin boogie. (afterthought)accualy on second thought their gettin dam mod from
// other base class so i should leave this shit alone
// note to self only fuck with dam mods that arnt doubled by other base class
// such as middys and autoattacks.
// if (IS_CLASS(ch, CLASS_ANGEL)) dam *= 0.75; /* trained to kill angels */
// dont need the angel one hybrids aint gonna be able to fight em
// }
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_HUMAN))
{
if (IS_ITEMAFF(victim, ITEMA_STEELSHIELD)) dam /= 1.8;
if (IS_ITEMAFF(victim, ITEMA_BEAST)) dam /= 1.8;
}
if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_UNDEAD_LYCAN) || IS_CLASS(victim, CLASS_HELL_SPAWN)
|| IS_CLASS(victim, CLASS_VAMPIRIC_MIST) || IS_CLASS(victim, CLASS_VAMPIRE)))
{
if (victim->power[DISC_VAMP_PROT] >= 10) dam /= 1.5;
if (victim->power[DISC_VAMP_FORT] > 0)
{
dam *= (100 - (victim->power[DISC_VAMP_FORT] * 5.5));
dam /= 100;
}
}
else dam = dam;
if (!IS_NPC(victim) && (IS_CLASS(ch, CLASS_DEMON) || IS_CLASS(ch, CLASS_SHADOW_DRAGON)
|| IS_CLASS(ch, CLASS_HELLS_SOLDIER) || IS_CLASS(ch, CLASS_SHADOW_FIEND)))
{
if (victim->power[DISC_DAEM_IMMU] > 0)
{
dam *= (100 - (victim->power[DISC_DAEM_IMMU] * 5));
dam /= 100;
}
if (IS_DEMPOWER( victim, DEM_TOUGH)) dam *= 0.8;
if (IS_SET(victim->warp, WARP_STAMINA)) dam *= 0.8;
if (IS_SET(victim->warp, WARP_SBODY)) dam *= 0.8;
if (IS_SET(victim->warp, WARP_CBODY)) dam *= 0.8;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_HYDRA)) dam *= 0.5;
if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_UNDEAD_KNIGHT) || IS_CLASS(victim, CLASS_UNDEAD_ASSASSIN)
|| IS_CLASS(victim, CLASS_NAZGUL) || IS_CLASS(victim, CLASS_NECROMANCER)
|| IS_CLASS(victim, CLASS_BLADE_MASTER)))
{
dam *= (100 - (victim->pcdata->powers[UNDEAD_SPIRIT] * 6));
dam /= 100;
}
if (!IS_NPC(victim) && (IS_CLASS(victim,CLASS_WEREWOLF) || IS_CLASS(victim, CLASS_UNDEAD_LYCAN)
|| IS_CLASS(victim, CLASS_GAIA_WOLF) || IS_CLASS(victim, CLASS_STALKER)))
{
if(victim->power[DISC_WERE_BOAR] > 2) dam /= 2;
if(IS_GAR1(victim, WOLF_COCOON)) dam /= 2;
}
if(IS_SET(ch->newbits2, NEW2_TOUGHSKIN)) dam /= 2;
// if(IS_SET(ch->newbits2, NEW2_TORRA)) dam /= 1.2;
if (dam >= 2000) dam = dam - (dam / number_range(3,10) + number_range(10,30));
if (!IS_NPC(victim))
{
dam = dam + (dam / number_range(2,5) + number_range(10,50));
dam *= (number_range(2,4) * number_range(2,3) / number_range(4,6));
}
if (dam <= 0) dam = 1;
if (dam > 1000000) dam = 1000000;
// if (dam > ch->damcap[DAM_CAP])
// dam = number_range( (ch->damcap[DAM_CAP] - 200), (ch->damcap[DAM_CAP] + 100) );
if ( IS_AFFECTED(victim, AFF_SANCTUARY ) ) dam *= 0.5;
if ( IS_AFFECTED(victim, AFF_HOLYAURA) && dam > 1) dam *= 0.5;
if (!IS_NPC(ch) && !IS_NPC(victim)) dam /= 0.8;
if (!IS_NPC(victim) && !IS_NPC(ch)) dam /= 0.8;
if (!IS_NPC(victim) && victim->pcRaceLevel == 200) dam *= 0.4;
return dam;
}
bool can_counter( CHAR_DATA *ch)
{
if (!IS_NPC(ch) && IS_STANCE(ch, STANCE_MONKEY)) return TRUE;
return FALSE;
}
bool can_bypass( CHAR_DATA *ch, CHAR_DATA *victim )
{
if (IS_NPC(ch) || IS_NPC(victim)) return FALSE;
else if (IS_STANCE(ch, STANCE_VIPER)) return TRUE;
else if (IS_STANCE(ch, STANCE_MANTIS)) return TRUE;
else if (IS_STANCE(ch, STANCE_TIGER)) return TRUE;
else if (IS_STANCE(ch, STANCE_WOLF)) return TRUE;
else if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_BYPASS)) return TRUE;
return FALSE;
}
void update_damcap( CHAR_DATA *ch, CHAR_DATA *victim )
{
int max_dam = 1000;
// int i = 0;
if (!IS_NPC(ch))
{
if (ch->generation == 1) max_dam += 250;
if (ch->generation == 2) max_dam += 200;
if (ch->generation == 3) max_dam += 150;
if (ch->generation == 4) max_dam += 100;
if (ch->generation == 5) max_dam += 50;
if (ch->tier > 0) max_dam += ch->tier * 300;
if (ch->pcdata->upgrade_level > 0) max_dam += ch->pcdata->upgrade_level * 500;
if (ch->pcdata->legend > 0) max_dam += (40 * ch->pcdata->legend);
if (victim->pResist > 0) max_dam -= (25 * victim->pResist);
switch( ch->pRank ) { // this will probably need lowered
case 0: max_dam += 50; break; // also thanks scorp-ice for permission.
case 1: max_dam += 100; break;
case 2: max_dam += 120; break;
case 3: max_dam += 140; break;
case 4: max_dam += 160; break;
case 5: max_dam += 180; break;
case 6: max_dam += 200; break;
case 7: max_dam += 220; break;
case 8: max_dam += 240; break;
case 9: max_dam += 260; break;
case 10: max_dam += 280; break;
case 11: max_dam += 300; break;
case 12: max_dam += 320; break;
case 13: max_dam += 340; break;
case 14: max_dam += 360; break;
case 15: max_dam += 380; break;
case 16: max_dam += 400; break;
case 17: max_dam += 420; break;
case 18: max_dam += 445; break;
case 19: max_dam += 460; break;
case 20: max_dam += 480; break;
case 21: max_dam += 500; break;
default: break;
}
if (!IS_NPC(victim))
{
if (IS_CLASS(ch, CLASS_SHADOW_DRAGON)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_HELLS_SOLDIER)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_SHADOW_FIEND)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_STALKER)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_GAIA_WOLF)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_SHADOWBORN)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_BLACK_ASSASSIN)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_HELL_SPAWN)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_VAMPIRIC_MIST)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_DEVA)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_BAATEZU)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_NAZGUL)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_UNDEAD_ASSASSIN)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_NECROMANCER)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_HEAVENS_SOLDIER)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_SILVER_DRAGON)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_TYPHON)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_GOLD_DRAGON)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_DRUID)) max_dam += 1000;
if (IS_CLASS(ch, CLASS_HYDRA)) max_dam += balance[11].damcap;
if (IS_CLASS(ch, CLASS_ZOMBIE)) max_dam += balance[13].damcap;
if (IS_CLASS(ch, CLASS_HUMAN)) max_dam += balance[15].damcap;
if (IS_CLASS(ch, CLASS_SKYBLADE)) max_dam += balance[18].damcap;
}
if (IS_CLASS(ch, CLASS_PRIEST)) max_dam += (balance[19].damcap - 1500);
if (IS_PRIPOWER(ch, PRI_PFORM)) max_dam += 1500;
}
if (IS_CLASS(ch, CLASS_DRAGON)) max_dam += balance[12].damcap;
if (!IS_NPC(ch) && IS_CLASS(victim, CLASS_DRAGON))
{
if(IS_SET(victim->pcdata->powers[DPOWER_FLAGS], DRA_LUCK )) max_dam -= 250;
if(IS_SET(victim->pcdata->powers[DPOWER_FLAGS], DRA_TERROR )) max_dam -= 250;
max_dam -= (victim->pcdata->powers[dragonage] * 30);
}
if (IS_CLASS(ch, CLASS_TANARRI)) max_dam += balance[4].damcap;
if (IS_CLASS(ch,CLASS_SHINOBI)) max_dam += balance[14].damcap;
if (IS_CLASS(ch, CLASS_ASSASSIN)) max_dam += balance[7].damcap;
if (IS_CLASS(ch, CLASS_UNDEAD_LYCAN)) max_dam += balance[21].damcap;
if (IS_CLASS(ch, CLASS_HELLS_SOLDIER)) max_dam += balance[22].damcap;
if (IS_CLASS(ch, CLASS_GAIA_WOLF)) max_dam += balance[23].damcap;
if (IS_CLASS(ch, CLASS_SHADOWBORN)) max_dam += balance[24].damcap;
if (IS_CLASS(ch, CLASS_BETRAYER)) max_dam += balance[25].damcap;
if (IS_CLASS(ch, CLASS_ELEMENTAL)) max_dam += balance[9].damcap;
if (IS_CLASS(ch, CLASS_WRAITH)) max_dam += balance[8].damcap;
if (IS_CLASS(ch, CLASS_ANTIPALADIN)) max_dam += balance[17].damcap;
if (IS_CLASS(ch, CLASS_GHOUL)) max_dam += balance[20].damcap;
if (IS_CLASS(ch, CLASS_GIANT)) max_dam += balance[16].damcap;
if (IS_CLASS(ch, CLASS_PALADIN)) max_dam += balance[10].damcap;
if ( IS_SET(ch->newbits, NEW_CUBEFORM) ) max_dam += 1000;
if (IS_CLASS(ch, CLASS_ANGEL)) max_dam += balance[5].damcap;
if (IS_CLASS(ch, CLASS_DROW)) max_dam += balance[2].damcap;
if (IS_CLASS(ch, CLASS_DEMON))
{
max_dam += balance[0].damcap;
if (ch->pcdata->souls > 0) max_dam += UMIN(350, 70 * ch->pcdata->souls);
if (ch->in_room->vnum >= 93420 && ch->in_room->vnum <= 93426) max_dam += 1000;
max_dam += (ch->pcdata->stats[DEMON_POWER] * 2);
}
if (IS_CLASS(ch, CLASS_VAMPIRE))
{
max_dam += (ch->rage * 5);
max_dam += balance[3].damcap;
}
if (IS_CLASS(ch,CLASS_WEREWOLF))
{
if (ch->rage > 99)
{
max_dam += ch->rage;
}
if (ch->power[DISC_WERE_PAIN]>9) max_dam += balance[1].damcap;
}
if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT)) max_dam += balance[6].damcap;
if (IS_ITEMAFF(ch, ITEMA_ARTIFACT)) max_dam += 500;
if (IS_NPC(victim) || victim->stance[0] != STANCE_MONKEY ) {
if (ch->stance[0] == STANCE_BULL) max_dam += 200;
else if (ch->stance[0] == STANCE_DRAGON) max_dam += 250;
else if (ch->stance[0] == STANCE_WOLF) max_dam += 250;
else if (ch->stance[0] == STANCE_TIGER) max_dam += 200;
else if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMCAP_3)) max_dam += 550;
else if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMCAP_2)) max_dam += 400;
else if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMCAP_1)) max_dam += 250;
}
if (!IS_NPC(victim) && ch->stance[0] != STANCE_MONKEY )
{
if (victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_REV_DAMCAP_3)) max_dam -= 550;
else if (victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_REV_DAMCAP_2)) max_dam -= 400;
else if (victim->stance[0] > 12 && IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_REV_DAMCAP_1)) max_dam -= 250;
}
/* Max Dam Reductions */ /* Werewolves */
/* Werewolves */
if (!IS_NPC(victim))
{
int silver_tol = (victim->siltol * 2.5);
if ((IS_CLASS(victim,CLASS_WEREWOLF) || IS_CLASS(victim, CLASS_UNDEAD_LYCAN)
|| IS_CLASS(victim, CLASS_GAIA_WOLF) || IS_CLASS(victim, CLASS_STALKER))
&& IS_ITEMAFF(ch, ITEMA_RIGHT_SILVER))
max_dam += (250 - silver_tol);
if ((IS_CLASS(victim,CLASS_WEREWOLF) || IS_CLASS(victim, CLASS_UNDEAD_LYCAN)
|| IS_CLASS(victim, CLASS_GAIA_WOLF) || IS_CLASS(victim, CLASS_STALKER))
&& IS_ITEMAFF(ch, ITEMA_LEFT_SILVER))
max_dam += (250 - silver_tol);
/* Vampies */
if (!IS_NPC(ch) && (IS_CLASS(victim, CLASS_UNDEAD_LYCAN) || IS_CLASS(victim, CLASS_HELL_SPAWN)
|| IS_CLASS(victim, CLASS_VAMPIRIC_MIST) || IS_CLASS(victim, CLASS_VAMPIRE)))
max_dam -= (victim->power[DISC_VAMP_FORT] * 50);
if (IS_NPC(ch) || ch->stance[0] != STANCE_MONKEY)
{
if (victim->stance[0] == STANCE_CRAB) max_dam -= 250;
else if (victim->stance[0] == STANCE_DRAGON) max_dam -= 250;
else if (victim->stance[0] == STANCE_SWALLOW) max_dam -= 250;
}
if ((IS_CLASS(victim, CLASS_DEMON) || IS_CLASS(victim, CLASS_SHADOW_DRAGON)
|| IS_CLASS(victim, CLASS_HELLS_SOLDIER) || IS_CLASS(victim, CLASS_SHADOW_FIEND))
&& (victim->in_room->vnum >= 93420 && victim->in_room->vnum <= 93426))
max_dam *= 0.8;
}
max_dam += get_curr_str(ch) * 5;
if (ch->level >= LEVEL_BUILDER) max_dam = 30000;
// if (ch->level >= LEVEL_BUILDER && !IS_NPC(ch)) max_dam = 100000; // Det er pisse irreterende Thomas.. jeg kan intet teste mod mobs, de doer automatisk. DIE!
ch->damcap[DAM_CAP] = max_dam;
ch->damcap[DAM_CHANGE] = 0;
return;
}
/*
* Inflict damage from a hit.
*/
void damage( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt )
{
CHAR_DATA *emb;
int hit_loc;
if ( victim->position == POS_DEAD ) return;
if ( ch->embracing != NULL )
{
if ( ( emb = ch->embracing ) != NULL ) stop_embrace(ch,emb);
else stop_embrace(ch,NULL);
}
/*
* Stop up any residual loopholes.
*/
if (ch->damcap[DAM_CHANGE] == 1) update_damcap(ch,victim);
if ( dam > ch->damcap[0] ) dam = ch->damcap[0];
/*
* Certain attacks are forbidden.
* Most other attacks are returned.
*/
if ( victim != ch )
{
if (is_safe( ch, victim )) return;
if ( victim->position > POS_STUNNED )
{
if ( victim->fighting == NULL ) set_fighting( victim, ch );
victim->position = POS_FIGHTING;
}
if ( victim->position > POS_STUNNED )
{
if ( ch->fighting == NULL )
set_fighting( ch, victim );
/*
* If victim is charmed, ch might attack victim's master.
*/
if ( IS_NPC(ch)
&& IS_NPC(victim)
&& IS_AFFECTED(victim, AFF_CHARM)
&& victim->master != NULL
&& victim->master->in_room == ch->in_room
&& number_bits( 3 ) == 0 )
{
stop_fighting( ch, FALSE );
multi_hit( ch, victim->master, TYPE_UNDEFINED );
return;
}
}
if ( victim->master == ch ) stop_follower( victim );
/*
* Damage modifiers.
*/
if ( IS_AFFECTED(ch, AFF_HIDE) )
{
if (!can_see(victim,ch))
{
dam *= 1.5;
send_to_char("You use your concealment to get a surprise attack!\n\r",ch);
}
REMOVE_BIT( ch->affected_by, AFF_HIDE );
act( "$n leaps from $s concealment.", ch, NULL, NULL, TO_ROOM );
}
if ( IS_AFFECTED(victim, AFF_PROTECT) && IS_EVIL(ch) && dam > 1 )
dam -= dam * 0.25;
if ( IS_AFFECTED(victim, AFF_PROTECT_GOOD) && IS_GOOD(ch) && dam > 1 )
dam -= dam * 0.25;
if ( dam < 0 ) dam = 0;
/*
* Check for disarm, trip, parry, and dodge.
*/
if ( dt >= TYPE_HIT )
{
if (IS_NPC(ch) && number_percent( ) < ch->level * 0.5)
disarm( ch, victim );
if (IS_NPC(ch) && number_percent( ) < ch->level * 0.5)
trip( ch, victim );
if (check_dodge( ch, victim, dt))
return;
if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_MONGOOSE) &&
victim->stance[STANCE_MONGOOSE] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
return;
else if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_SWALLOW) &&
victim->stance[STANCE_SWALLOW] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
return;
/* ------------ This is the part for superstances, Jobo ------------------- */
/* else if (!IS_NPC(victim) && victim->stance[0] > 12
&& IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_DODGE)
&& victim->stance[(victim->stance[0])] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
return; */
else if (!IS_NPC(victim) && victim->stance[0] > 12
&& IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_DODGE)
&& victim->stance[(victim->stance[0])] > 100
&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
return;
/* ------------ This is the end for superstances, Jobo ------------------- */
if (check_parry( ch, victim, dt)) return;
if (check_shieldblock(ch, victim, dt)) return;
if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_CRANE) &&
victim->stance[STANCE_CRANE] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
return;
else if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_MANTIS) &&
victim->stance[STANCE_MANTIS] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
return;
/* ------------ This is the part for superstances, Jobo ------------------- */
/* else if (!IS_NPC(victim) && victim->stance[0] > 12
&& IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_PARRY)
&& victim->stance[(victim->stance[0])] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
return; */
else if (!IS_NPC(victim) && victim->stance[0] > 12
&& IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_PARRY)
&& victim->stance[(victim->stance[0])] > 100
&& !can_Showing the first 100 KB of 272.5 KB. Download the archive for the full file.