fight.c
mc25b/src/fight.c · 258.0 KB
From the archive mc25b.tgz
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"
#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));
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->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;
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)
{
int xx;
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);
xx = number_range(2, 5);
while (--xx >= 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);
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;
}
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);
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;
}
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_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);
one_hit(ch, victim, gsn_knifespin, 1);
}
if (IS_SET(ch->pcdata->powers[SHADOW_BITS], NPOWER_BLOODRAGE))
one_hit(ch, victim, gsn_gutcutter, 1);
}
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);
}
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
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);
}
}
//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);
}
}
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 && (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);
}
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);
}
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_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);
}
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);
}
}
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);
}
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,victim);
break;
case 4 :
if ((sn = skill_lookup( "imp fireball" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
break;
case 5 :
if ((sn = skill_lookup( "godbless" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
break;
}
}
}
if (!IS_NPC(ch) && IS_SET(ch->newbits, NEW_CUBEFORM) && IS_CLASS(ch, CLASS_CYBORG))
{
one_hit(ch,victim,gsn_stuntubes,1);
multi_hit(ch,victim,gsn_stinger);
}
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);
}
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 = -50;
af.bitvector = 0;
affect_to_char(ch, &af );
af.type = skill_lookup("reserved");
af.duration = 20;
af.location = APPLY_HITROLL;
af.modifier = -50;
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;
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 (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 += 1;
if (IS_CLASS(ch, CLASS_JEDI) && (ch->pcdata->powers[JPOWER_MIND] >= 4))
count += 1;
if (IS_CLASS(ch, CLASS_JEDI) && (ch->pcdata->powers[JPOWER_BODY] >= 6))
count += 2;
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/1.5;
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_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)
{
if( ch->move > 40000 ) count += 5;
else count += ch->move/8000;
}
}
if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT))
count += ch->pcdata->powers[WEAPONSKILL]/1.2;
if (IS_CLASS(ch, CLASS_LICH)) count += 4;
if (IS_CLASS(ch, CLASS_SHAPESHIFTER))
{
count +=2;
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 += 2;
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 += 2;
if (IS_SET(ch->pcdata->powers[1],DPOWER_SPEED)) count += 4;
}
}
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->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/1.5;
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_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] / 3;
if (IS_CLASS(ch, CLASS_JEDI) && (ch->pcdata->powers[JPOWER_SPIRIT] >= 5)) count += 1;
if (IS_CLASS(ch, CLASS_JEDI) && (ch->pcdata->powers[JPOWER_MIND] >= 4)) count += 1;
if (IS_CLASS(ch, CLASS_JEDI) && (ch->pcdata->powers[JPOWER_BODY] >= 6)) count += 2;
if (IS_CLASS(ch, CLASS_JEDI) && (ch->pcdata->powers[JPOWER_TECHNIQUE] >= 9)) count += 3;
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 += 1;
if ( ch->power[DISC_WERE_BOAR] > 6)
{
if (ch->move > 15000)
count +=10;
else count += (ch->move/1500);
}
}
/* 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.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] / 2;
if (IS_CLASS(ch, CLASS_DROW))
{
if (IS_SET(ch->special, SPC_DROW_WAR)) count += 3;
if (IS_SET(ch->pcdata->powers[1],DPOWER_SPEED)) count += 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_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];
else if (IS_NPC(ch))
dt += ch->pIndexData->natural_attack;
}
if (ch->wpn[dt-1000] > 5) level = (ch->wpn[dt-1000] / 5);
else level = 1;
if (level > 40) level = 40;
/*
* Calculate to-hit-armor-class-0 versus armor.
*/
if ( IS_NPC(ch) )
{
thac0_00 = 20;
thac0_32 = 0;
}
else
{
thac0_00 = SKILL_THAC0_00;
thac0_32 = SKILL_THAC0_32;
}
thac0 = interpolate( level, thac0_00, thac0_32 ) - char_hitroll(ch);
victim_ac = UMAX( -100, char_ac(victim) / 10 );
if (!can_see( ch, victim ))
victim_ac -= 4;
if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_3))
victim_ac += 300;
if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_2))
victim_ac += 200;
if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMAGE_1))
victim_ac += 100;
/*
* The moment of excitement!
*/
while ((diceroll = number_bits( 5 ) ) >= 20)
;
if ( diceroll == 0 || ( diceroll != 19 && diceroll < thac0 - victim_ac ) )
{ /* Miss. */
damage( ch, victim, 0, dt );
tail_chain( );
if (!is_safe(ch,victim))
{
improve_wpn(ch,dt,right_hand);
improve_stance(ch);
}
return;
}
/*
* Hit.
* Calc damage.
*/
if ( IS_NPC(ch) )
{
dam = number_range( ch->level / 2, ch->level * 3 / 2 );
if ( 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 if ( IS_SET(ch->newbits, NEW_MONKADAM))
dam = dice( 10, 25 );
else
dam = dice( 4, 10 );
if (IS_CLASS(ch, CLASS_NINJA) && ch->pcdata->rank == BELT_SEVEN)
dam += dice( 1, 5 );
if (IS_CLASS(ch, CLASS_NINJA) && ch->pcdata->rank == BELT_EIGHT)
dam += dice( 6, 10 );
if (IS_CLASS(ch, CLASS_NINJA) && ch->pcdata->rank == BELT_NINE)
dam += dice( 11, 15 );
if (IS_CLASS(ch, CLASS_NINJA) && ch->pcdata->rank == BELT_TEN)
dam += dice( 16, 20 );
}
/*
* 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));
dam = up_dam(ch, victim, dam);
/* Other Resistances */
if (IS_ITEMAFF(victim, ITEMA_RESISTANCE))
{
dam *= 3;
dam /= 4;
}
/* damage reduction */
if (!IS_NPC(ch) && !IS_NPC(victim)) dam /= 2; /* slow down pk */
if (IS_NPC(ch) && dam > 2000) dam = 2000 + (dam-2000)/2; /* mob damage >2000 halved */
if ( dam <= 0 ) dam = 5;
/*
* I doubt this has much effect - Jobo
*/
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_VAMPIRE) && IS_NPC(victim))
dam *= (1 + ch->power[DISC_VAMP_POTE]/15);
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_TANARRI))
{
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_MIGHT)) dam *= 1.5;
}
if (IS_CLASS(victim, CLASS_SKYBLADE) && victim->pcdata->powers[SKYBLADE_MAGIC] > 6)
dam -= dam*.3;
/*
* This one for angels have no effect, take a look and rebalance. Jobo
*/
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_ANGEL)) dam *= (1 + ch->pcdata->powers[ANGEL_JUSTICE] / 10);
if ( !IS_NPC(ch) && IS_CLASS(ch, CLASS_DEMON) && IS_DEMPOWER(ch, DEM_MIGHT) )
dam *= 1.1;
if (!IS_NPC(ch) && !IS_NPC(victim) && IS_CLASS(ch, CLASS_UNDEAD_KNIGHT) && IS_CLASS(victim, CLASS_SHAPESHIFTER)) dam *= 1.2;
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_MAGE))
{
if (dt==gsn_mageshield && ch->pcdata->powers[PINVOKE]>6) dam *=1.4;
if (dt==gsn_mageshield && ch->pcdata->powers[PINVOKE]>9) dam *=1.4;
}
if ( !IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA))
{
if (ch->pcdata->rank == BELT_ONE) dam *= 1.1;
else if (ch->pcdata->rank == BELT_TWO) dam *= 1.2;
else if (ch->pcdata->rank == BELT_THREE) dam *= 1.3;
else if (ch->pcdata->rank == BELT_FOUR) dam *= 1.4;
else if (ch->pcdata->rank == BELT_FIVE) dam *= 1.5;
else if (ch->pcdata->rank == BELT_SIX) dam *= 1.6;
else if (ch->pcdata->rank == BELT_SEVEN) dam *= 1.7;
else if (ch->pcdata->rank == BELT_EIGHT) dam *= 1.8;
else if (ch->pcdata->rank == BELT_NINE) dam *= 1.9;
else if (ch->pcdata->rank == BELT_TEN) dam *= 2.0;
}
if ( !IS_NPC(ch) && IS_CLASS(ch, CLASS_DEMON) && IS_SET(ch->warp, WARP_STRONGARMS))
dam *= 1.2;
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(ch) && IS_CLASS(ch, CLASS_SHAPESHIFTER))
{
dam *= 1.4;
if (ch->pcdata->powers[SHAPE_FORM] == TIGER_FORM && ch->pcdata->powers[TIGER_LEVEL] > 1) dam *= 1.5;
else if (ch->pcdata->powers[SHAPE_FORM] == FAERIE_FORM && ch->pcdata->powers[FAERIE_LEVEL] > 1) dam *= 1.2;
else if (ch->pcdata->powers[SHAPE_FORM] == HYDRA_FORM && ch->pcdata->powers[HYDRA_LEVEL] > 1) dam *= 1.6;
else if (ch->pcdata->powers[SHAPE_FORM] == BULL_FORM && ch->pcdata->powers[BULL_LEVEL] > 1) dam *= 1.7;
else dam = dam;
}
if (IS_CLASS(ch,CLASS_CYBORG) && !IS_NPC(ch))
{
if (ch->pcdata->powers[CYBORG_LIMBS] > 0) dam *= 1.3;
if (ch->pcdata->powers[CYBORG_LIMBS] > 2) dam *= 1.5;
}
if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT))
{
if (ch->pcdata->powers[WEAPONSKILL] > 4) dam *=1.4;
if (ch->pcdata->powers[WEAPONSKILL] > 8) dam *=1.6;
}
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_WEREWOLF) && ch->power[DISC_WERE_BEAR] > 5)
dam *= 1.2;
if (!IS_NPC(victim) && (IS_CLASS(victim, CLASS_SHAPESHIFTER)))
{
if (victim->pcdata->powers[SHAPE_FORM] == FAERIE_FORM &&
victim->pcdata->powers[FAERIE_LEVEL]>0)
{
int growl = number_range(1,50);
if (growl == 10 || growl == 20 || growl == 30 || growl == 40 || growl == 50)
{
stc("#3You dodge your opponents attack#n.\n\r",victim);
stc("#3Your opponent dodges your attack#n.\n\r",ch);
dam = 0;
}
}
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_DROW) && 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_MAGE) && 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 ( !IS_NPC(ch) && IS_CLASS(ch, CLASS_MONK) && dt != gsn_heavenlyaura )
{
if (ch->chi[CURRENT] > 0 && ch->chi[CURRENT] < 3 ) dam *= 1.5;
if (ch->chi[CURRENT] > 2 && ch->chi[CURRENT] < 7 ) dam *= ((ch->chi[CURRENT]) / 2);
}
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_MAGE) && dt == gsn_mageshield)
{
if (ch->pcdata->powers[PINVOKE] > 6) dam *=1.4;
if (ch->pcdata->powers[PINVOKE] > 9) dam *=1.4;
}
if ( dt == gsn_garotte )
dam *= (number_range(3,5));
if ( dt == gsn_soulseeker )
dam *= (number_range(4,9));
if ( dt == gsn_backstab )
{
if (IS_CLASS(ch, CLASS_NINJA) && !IS_NPC(ch) && ch->pcdata->powers[NPOWER_NINGENNO] >=2)
dam *= number_range(50,60);
else if( IS_CLASS(ch, CLASS_DROW))
{
dam += number_range(100,1000);
dam *= number_range(7,10);
}
else dam *= number_range(2,4);
}
/*
* Damage type modifiers.
*/
if (dt == gsn_magma && IS_CLASS(ch, CLASS_TANARRI)) dam *= 1.7;
if (dt == gsn_booming && !IS_NPC(ch)) dam *= ch->pcdata->rank/2;
if (dt == gsn_circle && ch->pcdata->rank == BELT_EIGHT) dam *= 2;
if (dt == gsn_circle && ch->pcdata->rank == BELT_NINE) dam *= 2.5;
if (dt == gsn_circle && ch->pcdata->rank == BELT_TEN) dam *= 3.0;
if (dt == gsn_heavenlyaura && IS_CLASS(ch, CLASS_MONK)) dam /= 10;
if (dt == gsn_deathaura) dam /= 1.2;
if (dt == gsn_potato) dam /= 1.2;
if (dt == gsn_shred) dam *= 3;
if (!IS_NPC(victim))
{
if (IS_CLASS(victim, CLASS_SHADOW) && IS_SET(victim->pcdata->powers[SHADOW_BITS], NPOWER_BLUR))
{
int ddodge = number_range(1, 50);
if (ddodge == 5 || ddodge == 20 || ddodge == 35 || ddodge == 50)
{
stc("#0You feel the strike pass through your shadow body#n.\n\r", victim);
stc("#0You hit nothing but shadows#n.\n\r", ch);
dam = 0;
}
}
}
dam = cap_dam(ch,victim,dam);
if( IS_NPC(ch) && ch->pIndexData->dam_modifier > 3) dam *=3;
else if( IS_NPC(ch) && ch->pIndexData->dam_modifier > 0 ) dam *= ch->pIndexData->dam_modifier;
if( IS_NPC(victim) && !IS_NPC(ch))
{
if( victim->pIndexData->toughness > 100 ) victim->pIndexData->toughness = 99;
dam = dam * (100 - victim->pIndexData->toughness) / 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 up_dam(CHAR_DATA *ch, CHAR_DATA *victim, int dam)
{
if (!IS_NPC(ch))
{
/* class vs class stuff */
if (IS_CLASS(ch, CLASS_VAMPIRE))
{
dam *= 12;
dam /= 10;
}
if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT) && IS_CLASS(victim, CLASS_SHAPESHIFTER)) dam *= 1.2;
if (IS_CLASS(ch, CLASS_MAGE) && IS_CLASS(victim, CLASS_NINJA)) dam *= 1.25;
/* class modifiers */
if (IS_CLASS(ch, CLASS_TANARRI))
{
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_MIGHT))
{
dam *= 15;
dam /= 10;
}
}
if (IS_CLASS(ch, CLASS_DRONE))
{
if (ch->pcdata->powers[DRONE_FOCUS] > 0) dam *= 1.2;
if (ch->pcdata->powers[DRONE_FOCUS] > 1) dam *= 1.2;
if (ch->pcdata->powers[DRONE_FOCUS] > 2) dam *= 1.2;
}
if (IS_CLASS(ch, CLASS_DEMON))
{
if (IS_DEMPOWER(ch, DEM_MIGHT)) dam *= 1.1;
if (IS_SET(ch->warp, WARP_STRONGARMS)) dam *= 1.2;
}
if (IS_CLASS(ch, CLASS_GIANT))
dam *= (1 + (2 * ch->pcdata->rank) / 5); // 3 x multiplier max.
if (IS_CLASS(ch, CLASS_SHADOW))
{
if (IS_SET(ch->pcdata->powers[SHADOW_POWERS], NSHADOWS_DPACT)) dam *= 1.9;
if (IS_SET(ch->pcdata->powers[SHADOW_BITS], NPOWER_SHADOWFORM)) dam /= 2.5;
}
if (IS_CLASS(ch, CLASS_SHAPESHIFTER))
{
dam *= 1.4;
if (ch->pcdata->powers[SHAPE_FORM] == TIGER_FORM && ch->pcdata->powers[TIGER_LEVEL] > 1) dam *= 1.5;
else if (ch->pcdata->powers[SHAPE_FORM] == FAERIE_FORM && ch->pcdata->powers[FAERIE_LEVEL] > 1) dam *= 1.2;
else if (ch->pcdata->powers[SHAPE_FORM] == HYDRA_FORM && ch->pcdata->powers[HYDRA_LEVEL] > 1) dam *= 1.6;
else if (ch->pcdata->powers[SHAPE_FORM] == BULL_FORM && ch->pcdata->powers[BULL_LEVEL] > 1) dam *= 1.7;
}
if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT))
{
if (ch->pcdata->powers[WEAPONSKILL] > 4) dam *= 1.2;
if (ch->pcdata->powers[WEAPONSKILL] > 8) dam *= 1.3;
}
if (IS_CLASS(ch, CLASS_WEREWOLF) && ch->power[DISC_WERE_BEAR] > 5)
dam *= 1.2;
}
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(ch) && !IS_NPC(victim)) dam /= 2;
if (IS_NPC(ch) && dam > 2000) dam = 2000 + (dam - 2000)/2;
if (IS_ITEMAFF(victim, ITEMA_RESISTANCE))
{
dam *= 75;
dam /= 100;
}
if (IS_AFFECTED(victim, AFF_PROTECT) && IS_EVIL(ch))
{
dam *= 75;
dam /= 100;
}
if (IS_AFFECTED(victim, AFF_PROTECT_GOOD) && IS_GOOD(ch))
{
dam *= 75;
dam /= 100;
}
if (IS_AFF2(victim, AFF2_DARMOR) && rel_oppose(ch, victim))
{
dam *= 85;
dam /= 100;
}
/*
* Any special religion modifiers
*/
if (rel_oppose(ch, victim))
{
if (IS_AFF2(victim, AFF2_DARMOR))
{
dam *= 85;
dam /= 100;
}
if (victim->in_room)
{
if (has_area_affect(victim->in_room->area, AREA_AFF_GZONE, victim->pcdata->religion))
{
dam *= 90;
dam /= 100;
}
}
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_DROW))
{
if (IS_SET(victim->pcdata->powers[1], DPOWER_TOUGHSKIN))
dam /= 3;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_SHADOW))
{
if (IS_SET(victim->pcdata->powers[SHADOW_POWERS], NSHADOWS_TPACT))
{
dam *= 40;
dam /= 100;
}
if (IS_CLASS(ch, CLASS_GIANT)) dam *= 0.85; // evil giants
if (IS_SET(victim->pcdata->powers[SHADOW_BITS], NPOWER_SHADOWFORM)) dam /= 2;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_THIEF))
{
if (IS_SET(victim->pcdata->powers[1], THIEF_TOUGHSKIN))
dam /= 1.2;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_LICH))
{
dam /=5;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_DRONE))
{
dam *= 100 - victim->pcdata->powers[DRONE_FORTITUDE] * 25;
dam /= 100;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_FAE))
{
dam /= 3;
}
if (!IS_NPC(victim) & IS_CLASS(victim, CLASS_GIANT))
{
if (IS_SET(victim->pcdata->powers[GIANT_GIFTS], GGIFT_LEATHERSKIN)) dam *= 0.70;
if (victim->pcdata->powers[GIANT_STANDFIRM] == 1)
{
if (victim->pcdata->stats[GIANT_POINTS] < dam/10) do_standfirm(victim,"");
else
{
victim->pcdata->stats[GIANT_POINTS] -= dam/10;
dam *= 0.65;
}
}
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_ANGEL))
{
dam *= (100 - (victim->pcdata->powers[ANGEL_HARMONY] * 12));
dam /= 100;
}
if (IS_CLASS(ch, CLASS_JEDI))
{
if ((ch->generation == 1) && IS_SET(ch->special, SPC_PRINCE))
dam *= 3.5;
else if (ch->generation == 1)
dam *= 2.7;
else
dam *= 2.3;
if (ch->pcdata->powers[JPOWER_SPIRIT] > 4)
dam *= 1.5;
if (ch->pcdata->powers[JEDI_STATE] > 0)
dam *= 1 + ((ch->pcdata->powers[JEDI_STATE] )*.15);
}
if (IS_CLASS(victim, CLASS_JEDI))
{
if (victim->pcdata->powers[JEDI_STATE] > 5)
dam *= .75;
}
if (IS_CLASS(victim,CLASS_DRACONIAN) && IS_SET(victim->newbits2, NEW2_SCALES)) dam *= 0.8;
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_TANARRI))
{
if (IS_SET(victim->pcdata->powers[TANARRI_POWER], TANARRI_EXOSKELETON)) dam *= 0.20;
if (IS_CLASS(ch, CLASS_ANGEL)) dam *= 0.75; /* trained to kill angels */
if (IS_CLASS(ch, CLASS_CYBORG)) dam *= 0.8;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_CYBORG))
{
if (IS_CLASS(ch, CLASS_SHAPESHIFTER)) dam *= 0.85;
if (IS_CLASS(ch, CLASS_SAMURAI)) dam *= 0.9;
if (victim->pcdata->powers[CYBORG_BODY] > 0) dam /= 1.75;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_VAMPIRE))
{
if (victim->power[DISC_VAMP_PROT] >= 10) dam /= 2;
if (victim->power[DISC_VAMP_FORT] > 0)
{
dam *= (100 - (victim->power[DISC_VAMP_FORT] * 6));
dam /= 100;
}
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_SAMURAI))
{
if (IS_CLASS(ch, CLASS_SHAPESHIFTER)) dam /= 1.6; /* damn shapies */
dam /= 1.75;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_MAGE))
{
if (IS_ITEMAFF(victim, ITEMA_STEELSHIELD)) dam /= 1.8;
if (IS_ITEMAFF(victim, ITEMA_BEAST)) dam /= 1.8;
if (IS_CLASS(ch, CLASS_GIANT)) dam /= 1.5; // giants fear magic
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_SHAPESHIFTER))
{
dam /= 2.5;
if (victim->pcdata->powers[SHAPE_FORM] == FAERIE_FORM)
{
dam *= (100 - victim->pcdata->powers[FAERIE_LEVEL]*9);
dam /= 100;
}
else if (victim->pcdata->powers[SHAPE_FORM] == TIGER_FORM)
{
dam *= (100 - victim->pcdata->powers[TIGER_LEVEL]*8);
dam /= 100;
if (victim->pcdata->powers[PHASE_COUNTER] > 0)
{
dam *= (100 - victim->pcdata->powers[PHASE_COUNTER] * 2.5);
dam /= 100;
}
}
else if (victim->pcdata->powers[SHAPE_FORM] == HYDRA_FORM)
{
dam *= (100 - victim->pcdata->powers[HYDRA_LEVEL]*10);
dam /= 100;
}
else if (victim->pcdata->powers[SHAPE_FORM] == BULL_FORM)
{
dam *= (100 - victim->pcdata->powers[BULL_LEVEL]*12);
dam /= 100;
}
else dam = dam;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_MONK))
{
if (victim->monkab[BODY] >= 2) dam /= 1.5;
if (victim->chi[CURRENT] > 0 )
{
dam *= (100 - (victim->chi[CURRENT] * 7) );
dam /= 100;
}
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_DEMON))
{
if (victim->power[DISC_DAEM_IMMU] > 0)
{
dam *= (100 - (victim->power[DISC_DAEM_IMMU] * 4));
dam /= 100;
}
if (IS_DEMPOWER( victim, DEM_TOUGH)) dam *= 0.8;
if (IS_SET(victim->warp, WARP_STAMINA)) dam *= 0.8;
if (IS_SET(victim->warp, WARP_SBODY)) dam *= 0.8;
if (IS_SET(victim->warp, WARP_CBODY)) dam *= 0.8;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_UNDEAD_KNIGHT))
{
if (IS_CLASS(ch, CLASS_SHAPESHIFTER)) dam *= 0.75;
if (IS_CLASS(ch, CLASS_SAMURAI)) dam *= 0.7;
dam *= (100 - (victim->pcdata->powers[UNDEAD_SPIRIT] * 6.3));
dam /= 100;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_NINJA))
{
if (victim->pcdata->powers[NPOWER_CHIKYU] >= 1) dam /= 2.2;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_WEREWOLF))
{
if(victim->power[DISC_WERE_BOAR] > 2) dam /= 2;
if(IS_GAR1(victim, WOLF_COCOON)) dam /= 2;
}
if (dam >= 2000) dam = dam - (dam / number_range(3,10) + number_range(10,30));
if (!IS_NPC(victim))
{
dam = dam + (dam / number_range(2,5) + number_range(10,50));
dam *= (number_range(2,4) * number_range(2,3) / number_range(4,6));
}
if (dam <= 0) dam = 1;
if (dam > 1000000) dam = 1000000;
if (dam > ch->damcap[DAM_CAP]) dam = number_range( (ch->damcap[DAM_CAP] - 200), (ch->damcap[DAM_CAP] + 100) );
if ( IS_AFFECTED(victim, AFF_SANCTUARY ) ) dam *= 0.5;
if ( IS_AFFECTED(victim, AFF_HOLYAURA) && dam > 1 )
dam *= 0.5;
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->pcdata->relrank > 0 ) max_dam += ch->pcdata->relrank * 100;
if (ch->generation == 1) max_dam += 350;
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 (IS_CLASS(ch, CLASS_GIANT))
{
max_dam += 900;
max_dam += ch->pcdata->rank * 210;
}
if (IS_CLASS(ch, CLASS_DRONE))
{
max_dam += ch->pcdata->powers[DRONE_HORRID_REALITY] * 110;
max_dam += ch->pcdata->powers[DRONE_DISTORTED_REALITY] * 110;
max_dam += ch->pcdata->powers[DRONE_ALTERNATE_REALITY] * 110;
max_dam += ch->pcdata->powers[DRONE_EVASION] * 100;
max_dam += ch->pcdata->powers[DRONE_FORTITUDE] * 100;
max_dam += ch->pcdata->powers[DRONE_FOCUS] * 100;
max_dam += ch->pcdata->powers[DRONE_WILLPOWER] * 110;
max_dam += ch->pcdata->powers[DRONE_MINDCONTROL] * 110;
max_dam += ch->pcdata->powers[DRONE_PSIONICS] * 110;
}
if (IS_CLASS(ch, CLASS_MAGE))
{
if (IS_ITEMAFF(ch, ITEMA_BEAST)) max_dam += 750;
max_dam += 500;
}
if( IS_CLASS(ch, CLASS_PRIEST ) )
{
max_dam += 1600;
if( IS_PRIPOWER(ch,PRI_PFORM) )
max_dam += 1500;
}
else if (IS_CLASS(ch, CLASS_JEDI))
{
if ((ch->generation == 1) && IS_SET(ch->special, SPC_PRINCE))
max_dam = 3600;
else if (ch->generation == 1)
max_dam = 3300;
else
max_dam = 2800;
max_dam += ((ch->pcdata->powers[JPOWER_BODY] + ch->pcdata->powers[JPOWER_MIND] +
ch->pcdata->powers[JPOWER_SPIRIT] + ch->pcdata->powers[JPOWER_TECHNIQUE]) * 50);
}
if (IS_CLASS(ch, CLASS_TANARRI))
{
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_MIGHT)) max_dam += 500;
max_dam += ch->pcdata->rank*375; /* max rank is 6 btw */
}
if (IS_CLASS(ch, CLASS_FAE))
{
max_dam += 500;
if (ch->pcdata->powers[FAE_PLASMA] > 7) max_dam += 270;
if (ch->pcdata->powers[FAE_MATTER] > 7) max_dam += 270;
if (ch->pcdata->powers[FAE_ENERGY] > 7) max_dam += 270;
if (ch->pcdata->powers[FAE_WILL] > 7) max_dam += 270;
if (ch->pcdata->powers[FAE_PLASMA] > 3) max_dam += 270;
if (ch->pcdata->powers[FAE_MATTER] > 3) max_dam += 270;
if (ch->pcdata->powers[FAE_ENERGY] > 3) max_dam += 270;
if (ch->pcdata->powers[FAE_WILL] > 3) max_dam += 270;
}
if (IS_CLASS(ch, CLASS_LICH))
{
max_dam += 450;
if (ch->pcdata->powers[CON_LORE] > 4) max_dam += 320;
if (ch->pcdata->powers[DEATH_LORE] > 4) max_dam += 320;
if (ch->pcdata->powers[LIFE_LORE] > 4) max_dam += 320;
if (ch->pcdata->powers[NECROMANTIC] > 4) max_dam += 320;
if (ch->pcdata->powers[CHAOS_MAGIC] > 4) max_dam += 320;
}
if (IS_CLASS(ch, CLASS_SHADOW))
max_dam += ch->pcdata->powers[SHADOW_MARTIAL] * 150;
//Ghouls
if (IS_CLASS(ch, CLASS_GHOUL))
{
if (ch->pcdata->powers[GPOWER_UNDEADMIGHT] > 0)
max_dam += 400;
if (ch->pcdata->powers[GPOWER_UNDEADMIGHT] > 2)
max_dam += 400;
if (ch->pcdata->powers[GPOWER_UNDEADMIGHT] > 3)
max_dam += 800;
if (ch->pcdata->powers[GPOWER_UNDEADMIGHT] > 4)
max_dam += 1800;
}
if (IS_CLASS(ch,CLASS_DRACONIAN))
{
if (ch->pcdata->powers[ORB_GREEN] >= 3) max_dam += 900;
if (IS_POLYAFF(ch, POLY_LIZARDFORM)) max_dam += 1700;
if (ch->pcdata->stats[DRACONIAN_SPIKES] > 0) max_dam += ch->pcdata->stats[DRACONIAN_SPIKES] * 2;
}
if (IS_CLASS(ch, CLASS_THIEF) && IS_SET(ch->pcdata->powers[1], THIEF_MIGHT))
{
max_dam += 2750;
}
if (IS_CLASS(ch, CLASS_SKYBLADE))
{
if (ch->pcdata->powers[SKYBLADE_POWER] >= 1) max_dam += 50;
if (ch->pcdata->powers[SKYBLADE_POWER] >= 2) max_dam += 75;
if (ch->pcdata->powers[SKYBLADE_POWER] >= 3) max_dam += 100;
if (ch->pcdata->powers[SKYBLADE_POWER] >= 4) max_dam += 100;
if (ch->pcdata->powers[SKYBLADE_POWER] >= 5) max_dam += 150;
if (ch->pcdata->powers[SKYBLADE_POWER] >= 6) max_dam += 250;
if (ch->pcdata->powers[SKYBLADE_POWER] >= 7) max_dam += 400;
if (ch->pcdata->powers[SKYBLADE_POWER] >= 8) max_dam += 500;
if (ch->pcdata->powers[SKYBLADE_POWER] >= 9) max_dam += 600;
if (ch->pcdata->powers[SKYBLADE_POWER] == 10) max_dam += 900;
}
if (IS_CLASS(ch, CLASS_ANGEL))
{
max_dam += ch->pcdata->powers[ANGEL_JUSTICE]*155;
max_dam += ch->pcdata->powers[ANGEL_PEACE]*155;
max_dam += ch->pcdata->powers[ANGEL_HARMONY]*165;
max_dam += ch->pcdata->powers[ANGEL_LOVE]*165;
}
if (IS_CLASS(ch, CLASS_SHAPESHIFTER))
{
max_dam += 800;
if (ch->pcdata->powers[SHAPE_FORM] == TIGER_FORM) max_dam += ch->pcdata->powers[TIGER_LEVEL] * 325;
else if (ch->pcdata->powers[SHAPE_FORM] == HYDRA_FORM) max_dam += ch->pcdata->powers[HYDRA_LEVEL] * 350;
else if (ch->pcdata->powers[SHAPE_FORM] == BULL_FORM) max_dam += ch->pcdata->powers[BULL_LEVEL] * 300;
else if (ch->pcdata->powers[SHAPE_FORM] == FAERIE_FORM) max_dam += ch->pcdata->powers[FAERIE_LEVEL] * 275;
}
if (IS_CLASS(ch, CLASS_DROW))
{
max_dam += 1200;
if (IS_SET(ch->newbits, NEW_DROWHATE)) max_dam += 950;
if (IS_SET(ch->newbits,NEW_DFORM)) max_dam += 950;
}
if (IS_CLASS(ch, CLASS_DEMON) && ch->in_room != NULL)
{
max_dam += ch->power[DISC_DAEM_ATTA] * 60;
max_dam += 1300;
if (ch->pcdata->souls > 0) max_dam += UMIN(350, 70 * ch->pcdata->souls);
if (ch->in_room->vnum >= 93420 && ch->in_room->vnum <= 93426) max_dam += 6000;
max_dam += (ch->pcdata->stats[DEMON_POWER] * 2);
}
if (IS_CLASS(ch, CLASS_CYBORG))
{
if (ch->pcdata->powers[CYBORG_LIMBS] > 0) max_dam += 450;
if (ch->pcdata->powers[CYBORG_LIMBS] > 1) max_dam += 450;
if (ch->pcdata->powers[CYBORG_LIMBS] > 2) max_dam += 450;
if (ch->pcdata->powers[CYBORG_LIMBS] > 3) max_dam += 450;
if (ch->pcdata->powers[CYBORG_LIMBS] > 4) max_dam += 500;
}
if (IS_CLASS(ch, CLASS_MONK)) {
max_dam += (ch->monkab[COMBAT] * 250);
if (ch->chi[CURRENT] > 0) max_dam += ch->chi[CURRENT] * 250;
}
if (IS_CLASS(ch, CLASS_VAMPIRE))
{
max_dam += (ch->rage * 11);
if (ch->power[DISC_VAMP_POTE] > 0)
max_dam += (ch->power[DISC_VAMP_POTE] * 150);
if( ch->pcdata->rank == AGE_TRUEBLOOD) max_dam += 1150;
else if( ch->pcdata->rank == AGE_LA_MAGRA) max_dam += 950;
else if (ch->pcdata->rank == AGE_METHUSELAH) max_dam += 650;
else if (ch->pcdata->rank == AGE_ELDER) max_dam += 250;
else if (ch->pcdata->rank == AGE_ANCILLA) max_dam += 170;
if(ch->played > 0)
{
if((ch->played / 3600) < 100)
{
max_dam += ((ch->played / 3600) * 10);
}
else
{
max_dam += 1000;
}
}
}
if (IS_CLASS(ch, CLASS_NINJA))
{
max_dam += (ch->rage * 4);
if(ch->pcdata->powers[NPOWER_CHIKYU] >=6 && ch->pcdata->powers[HARA_KIRI] > 0)
max_dam += 900;
if(ch->pcdata->powers[NPOWER_CHIKYU] >=2)
max_dam += 900;
}
if (IS_CLASS(ch, CLASS_WEREWOLF))
{
if (ch->rage > 99)
{
max_dam += ch->rage;
max_dam += 1300;
}
if (ch->power[DISC_WERE_PAIN]>9) max_dam += 850;
}
if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT))
max_dam += ch->pcdata->powers[WEAPONSKILL] * 300;
if (IS_CLASS(ch, CLASS_SAMURAI) && (get_eq_char(ch, WEAR_WIELD) != NULL))
{
for (i=0; i < 13 ; i++)
if (ch->wpn[i] >= 1000) max_dam += 275;
max_dam += 375;
}
}
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 */
if (!IS_NPC(victim))
{
int silver_tol = (victim->siltol * 2.5);
if (IS_CLASS(victim, CLASS_WEREWOLF) && IS_ITEMAFF(ch, ITEMA_RIGHT_SILVER))
max_dam += (250 - silver_tol);
if (IS_CLASS(victim, CLASS_WEREWOLF) && IS_ITEMAFF(ch, ITEMA_LEFT_SILVER))
max_dam += (250 - silver_tol);
/* Vampies */
if (!IS_NPC(ch) && (IS_CLASS(victim, CLASS_VAMPIRE)))
max_dam -= (victim->power[DISC_VAMP_FORT] * 75);
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) && (victim->in_room->vnum >= 93420 && victim->in_room->vnum <= 93426))
max_dam *= 0.5;
}
max_dam += get_curr_str(ch) * 5;
max_dam += (ch->race / 5 ) * 250; /* This might be too much */
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;
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, FALSE );
if ( IS_NPC( victim ) && HAS_TRIGGER_MOB( victim, TRIG_KILL ) )
p_percent_trigger( victim, NULL, NULL, ch, NULL, NULL, TRIG_KILL );
}
victim->position = POS_FIGHTING;
}
if ( victim->position > POS_STUNNED )
{
if ( ch->fighting == NULL )
set_fighting( ch, victim, TRUE );
/*
* 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)
{
if (IS_NPC(victim))
{
if (!(victim->pIndexData->vnum >= MOB_VNUM_FIRE && victim->pIndexData->vnum <= MOB_VNUM_CLAY))
stop_follower(victim, FALSE);
}
else stop_follower( victim, FALSE );
}
/*
* 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;
if (IS_NPC(victim) && IS_SET(victim->act, ACT_NODAMAGE))
{
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 ( !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_bypass(ch,victim) && check_parry( ch, victim, dt ))
return;
/* ------------ This is the end for superstances, Jobo ------------------- */
}
dam_message( ch, victim, dam, dt );
/*
* Brief 5 System - Jobo
*/
if (!IS_NPC(ch) && IS_SET(ch->act, PLR_BRIEF5))
{
ch->amount_damage_dealt += dam;
ch->amount_attacks_dealt++;
}
if (!IS_NPC(victim) && IS_SET(victim->act, PLR_BRIEF5))
{
victim->amount_damage_recieved += dam;
victim->amount_attacks_recieved++;
}
}
if ( IS_CLASS(victim, CLASS_MONK ) && victim->monkab[SPIRIT] >= 2 )
{
if (IS_SET(victim->newbits, NEW_NATURAL))
{
stc("You absorb the natural imbalances of your opponent.\n\r",victim);
act("$n absorbs the natural imbalances of you attack.",victim,NULL,ch,TO_VICT);
if ( dam > 2000 ) dam /= 2;
victim->hit += dam;
REMOVE_BIT(victim->newbits, NEW_NATURAL);
return;
}
}
if (IS_SET(victim->newbits, NEW_IRONMIND))
{
REMOVE_BIT(victim->newbits, NEW_IRONMIND);
send_to_char("Your focus your full concentration on the attack,\n\r", victim);
send_to_char("and absorb the full impact into your system, channeling it into a healing force.\n\r",victim);
victim->hit += dam;
dam = 0;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_DRONE))
{
if (IS_SET(victim->pcdata->jflags, JFLAG_DRONE_DISTORT) && number_range(1,3) != 2)
{
act("$N seems healed by your attack, as if reality was suddenly turned upside down.", ch, NULL, victim, TO_CHAR);
act("$n's attack was reversed by your shift in reality, healing you instead.", ch, NULL, victim, TO_VICT);
act("$n's attack seems to have no effect on $N, actually healing $M instead.", ch, NULL, victim, TO_NOTVICT);
victim->hit += dam;
dam = 0;
}
}
hurt_person(ch,victim,dam);
dropinvis(ch);
dropinvis(victim);
return;
}
void fae_shield( CHAR_DATA *ch, CHAR_DATA *victim, int dam )
{
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int new_dam;
if (victim->pcdata->powers[FAE_SHIELD] > 0)
{
if (--victim->pcdata->powers[FAE_SHIELD] == 0) send_to_char("#pYour shield of matter flickers and dies.#n\n\r",victim);
new_dam = number_range(dam/4,dam/5);
if (new_dam > 300) new_dam = number_range(275,325);
if (new_dam >= victim->hit) new_dam = victim->hit -1;
if (new_dam < 10) new_dam = 10;
hurt_person(victim, ch, new_dam);
xprintf(buf, "#pA flickering shield of matter strikes you hard#n [#C%d#n]",new_dam);
xprintf(buf2, "#pYour mattershield returns some of the damage#n [#C%d#n]", new_dam);
/*
* Brief 5 System - Jobo
*/
if (!IS_NPC(victim) && IS_SET(victim->act, PLR_BRIEF5))
{
victim->amount_damage_dealt += new_dam;
victim->amount_attacks_dealt++;
}
if (!IS_NPC(ch) && IS_SET(ch->act, PLR_BRIEF5))
{
ch->amount_damage_recieved += dam;
ch->amount_attacks_recieved++;
}
if (!IS_SET(ch->act, PLR_BRIEF5))
act(buf, victim, NULL, ch, TO_VICT);
if (!IS_SET(victim->act, PLR_BRIEF5))
act(buf2, victim, NULL, ch, TO_CHAR);
}
return;
}
void angel_eye( CHAR_DATA *ch, CHAR_DATA *victim, int dam )
{
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int new_dam;
if (IS_SET(victim->pcdata->powers[ANGEL_POWERS], ANGEL_EYE) && dam > 100)
{
new_dam = number_range(dam/4,dam/5);
if (new_dam > 300) new_dam = number_range(275,325);
if (new_dam >= victim->hit) new_dam = victim->hit -1;
if (new_dam < 10) new_dam = 10;
hurt_person(victim, ch, new_dam);
xprintf(buf, "God's justice strikes you HARD [#C%d#n]",new_dam);
xprintf(buf2, "The sinner dares to lay hands on you, God's wrath on the sinner [#C%d#n]", new_dam);
/*
* Brief 5 System - Jobo
*/
if (!IS_NPC(victim) && IS_SET(victim->act, PLR_BRIEF5))
{
victim->amount_damage_dealt += new_dam;
victim->amount_attacks_dealt++;
}
if (!IS_NPC(ch) && IS_SET(ch->act, PLR_BRIEF5))
{
ch->amount_damage_recieved += dam;
ch->amount_attacks_recieved++;
}
if (!IS_SET(ch->act, PLR_BRIEF5))
act(buf, victim, NULL, ch, TO_VICT);
if (!IS_SET(victim->act, PLR_BRIEF5))
act(buf2, victim, NULL, ch, TO_CHAR);
}
return;
}
void hurt_person( CHAR_DATA *ch, CHAR_DATA *victim, int dam )
{
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int newdam;
if (victim->position == POS_DEAD) return;
if(IS_NPC(victim) && IS_SET(victim->act, ACT_NODAMAGE)) dam = 0;
victim->hit -= dam;
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_SKYBLADE) && victim->pcdata->powers[SKYBLADE_SKILLS] >= 5)
{
if (dam >= 2000)
newdam = number_range(dam, dam*2);
else newdam = number_range( dam/2, dam);
if (number_range(1,50) > 48){
hurt_person(ch,victim,newdam);
do_say(victim,"#sEnguarde you swine!#n");
xprintf(buf, "#Y%s retorts and hits you hard! #0[#R%d#0]#n",victim->name,newdam);
xprintf(buf2, "#YYou retort the attack harshly! #0[#R%d#0]#n",newdam);
act(buf,victim,NULL,ch, TO_VICT);
act(buf2,victim,NULL,ch,TO_CHAR);}
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_ANGEL) && !IS_CLASS(ch, CLASS_ANGEL))
angel_eye(ch,victim,dam); // check for that eye for an eye.
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_FAE) && !IS_CLASS(ch, CLASS_FAE))
fae_shield(ch,victim,dam);
if (!IS_NPC(victim) && victim->level >= LEVEL_IMMORTAL && victim->hit < 1)
victim->hit = 1;
if (!IS_NPC(victim) && IS_SET(victim->newbits, NEW_CLOAK) &&victim->hit < 1 )
{
victim->hit += UMIN((victim->max_hit * .1), 4000);
if (IS_CLASS(victim, CLASS_MONK)) send_to_char("your cloak of life saves your from certain death.\n\r",victim);
else send_to_char("your cloak of death prevents the destruction of your body.\n\r",victim);
send_to_char("#0They escape your final blow.#n\n\r",ch);
REMOVE_BIT(victim->newbits, NEW_CLOAK);
}
update_pos( victim );
switch( victim->position )
{
case POS_MORTAL:
act( "$n is mortally wounded, and spraying blood everywhere.", victim, NULL, NULL, TO_ROOM );
send_to_char("You are mortally wounded, and spraying blood everywhere.\n\r", victim );
break;
case POS_INCAP:
act( "$n is incapacitated, and bleeding badly.",victim, NULL, NULL, TO_ROOM );
send_to_char("You are incapacitated, and bleeding badly.\n\r",victim );
break;
case POS_STUNNED:
act( "$n is stunned, but will soon recover.",victim, NULL, NULL, TO_ROOM );
send_to_char("You are stunned, but will soon recover.\n\r", victim );
break;
case POS_DEAD:
act( "#0$n is #RDEAD!!#n", victim, 0, 0, TO_ROOM );
send_to_char( "#RYou have been KILLED!!#n\n\r\n\r", victim );
break;
default:
if ( dam > victim->max_hit / 4 )
send_to_char( "That really did HURT!\n\r", victim );
if ( victim-Showing the first 100 KB of 258.0 KB. Download the archive for the full file.