fight.c
eod/src/fight.c · 228.9 KB
From the archive eod.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
/*
* Local functions.
*/
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));
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 ragnarokdecap args((CHAR_DATA *ch, CHAR_DATA *victim));
/*
* 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;
char buf[MAX_STRING_LENGTH];
// char buf1[MAX_STRING_LENGTH];
// char buf2[MAX_STRING_LENGTH];
// int thecounter = 0;
// int thecounter2 =0;
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);
if ( ch->pcdata->shit[MARCUS] < 3 ) multi_hit(ch, victim, gsn_blinky);
if (IS_SET(ch->newbits, THIRD_HAND) && get_eq_char(ch, WEAR_THIRD) != NULL)
if ( ch->pcdata->shit[MARCUS] < 4 ) multi_hit(ch, victim, gsn_blinky);
if (IS_SET(ch->newbits, FOURTH_HAND) && get_eq_char(ch, WEAR_FOURTH) != NULL)
if ( ch->pcdata->shit[MARCUS] < 5 ) multi_hit(ch, victim, gsn_blinky);
update_pos(victim);
}
}
}
} /*end of blink*/
ch_next = ch->next;
if (ch->fight_timer > 0) ch->fight_timer--;
if (!IS_NPC(ch))
{
if (ch->pcdata->lasthittimer > 0) ch->pcdata->lasthittimer--;
if (ch->pcdata->lasthittimer == 0) ch->pcdata->lasthit = str_dup("");
}
if (ch->arena_timer > 0)
ch->arena_timer--;
if (ch->arena_timer < 1)
{
if ( IS_SET(ch->flag2, AFF2_INARENA) || IS_SET(ch->flag2,
AFF2_CHALLENGED) || IS_SET(ch->flag2, AFF2_CHALLENGER))
{
REMOVE_BIT(ch->flag2, AFF2_CHALLENGED);
REMOVE_BIT(ch->flag2, AFF2_CHALLENGER);
REMOVE_BIT(ch->flag2, AFF2_INARENA );
undo_arena(ch);
arena = FIGHT_CLEAR;
sprintf(buf,"The arena is no longer busy!");
do_info(ch,buf);
stc("You waited to long, arena status cleared!\n\r", ch);
}
}
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 ( 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 < 10){ ch->fight_timer = 10; ch->pcdata->lasthittimer = 10; }
else if (ch->fight_timer < 25){ ch->fight_timer += 3; ch->pcdata->lasthittimer += 3; }
if (!IS_SET(ch->in_room->room_flags, ROOM_ARENA))
{
if (!IS_NPC(victim)) ch->pcdata->lasthit = str_dup(victim->pcdata->switchname);
}
}
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 (!IS_NPC(ch) && !IS_NPC(victim))
{
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 );
}
}
}
}
}
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;
if ( ch->position < POS_SLEEPING ) return;
if ( IS_CREATOR(ch) || IS_CLASS(ch, CLASS_MONK) )
{
if (!IS_NPC(ch) && wieldorig == 0 )
{
countup = number_range(1,1);
if (countup == 0) unarmed = number_range(0,3);
else if (countup == 1) unarmed = number_range(4,9);
else unarmed = number_range(3,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(3,4) != 2)
{
one_hit( ch, victim, dt, 1 );
one_hit( ch, victim, dt, 1 );
}
return;
}
if (dt == gsn_shiroken)
{
for(i = number_range(4,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 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 )
{
one_hit( ch, victim, dt, 1 );
return;
}
if ( dt== gsn_quills)
{
if ( (IS_CLASS(ch,CLASS_WEREWOLF)) && (ch->power[DISC_WERE_PAIN] > 9))
{
if (number_range(1,5) < 3)
{
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);
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);
return;
}
if ( dt == gsn_buffet )
{
one_hit( ch, victim, dt, 1 );
return;
}
if ( dt == gsn_sweep )
{
one_hit( ch, victim, dt, 1 );
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(3,3);
else
{
if (IS_CLASS(victim, CLASS_SAMURAI)) x = number_range(4,6); // angels don't like em samurais.
else x = number_range(3,4);
}
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);
if (ch->pcdata->upgrade_level >= 2)one_hit(ch,victim,dt,1);
if (ch->pcdata->upgrade_level >= 3)one_hit(ch,victim,dt,1);
}
return;
}
/*Wraith Shit*/
if ( dt == gsn_dblast)
{
x = number_range(2,5);
for (i=0; i < x; i++)
one_hit(ch,victim,dt,1);
return;
}
if (dt==gsn_marcuswrath)
{
if (!IS_NPC(ch) && (ch->pcdata->shit[MARCUS] > 0))
{
x = (ch->pcdata->shit[MARCUS] * 1 + ( 1 + ch->pcdata->upgrade_level) );
// if ( ch->pcdata->shit[MARCUS] == 5 ) x = 7;
for (i=0; i < x; i++)
one_hit(ch,victim,dt,1);
return;
}
}
if ( dt == gsn_sweepblow)
{
x=number_range(4,5);
for (i=0;i<x;i++)
{
one_hit(ch,victim,dt,1);
}
return;
}
if ( dt == gsn_grimtouch )
{
one_hit(ch,victim,dt,1);
one_hit(ch,victim,dt,1);
return;
}
if ( dt == gsn_pspit )
{
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_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_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_lightningslash,1);
if (number_range(1,2)==1) one_hit(ch,victim,gsn_lightningkick,1);
}
return;
}
wield1 = get_eq_char( ch, WEAR_WIELD );
wield2 = get_eq_char( ch, WEAR_HOLD );
wield3 = get_eq_char( ch, WEAR_THIRD );
wield4 = get_eq_char( ch, WEAR_FOURTH);
if ( wield1 != NULL && wield1->item_type == ITEM_WEAPON ) wieldorig = 1;
if ( wield2 != NULL && wield2->item_type == ITEM_WEAPON ) wieldorig += 2;
if ( wield3 != NULL && wield3->item_type == ITEM_WEAPON ) wieldorig += 4;
if ( wield4 != NULL && wield4->item_type == ITEM_WEAPON ) wieldorig += 8;
wieldtype = wieldorig;
wieldie = number_range(1,4);
if ( wieldorig == 15 )
{
if (wieldie == 2) wieldtype = 8;
else wieldtype = 4;
}
if ( wieldorig == 14 )
{
if (wieldie == 2) wieldtype = 8;
else if (wieldie == 1) wieldtype = 4;
else if (wieldie == 3) wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 13 )
{
if ( wieldie == 1) wieldtype = 8;
else if (wieldie == 2) wieldtype = 4;
else wieldtype = 1;
}
if ( wieldorig == 12 )
{
if ( wieldie == 1 ) wieldtype = 8;
else wieldtype = 4;
}
if ( wieldorig == 11 )
{
if ( wieldie == 1 ) wieldtype = 8;
if ( wieldie == 2 ) wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 10 )
{
if ( wieldie == 1 ) wieldtype = 8;
else wieldtype = 2;
}
if ( wieldorig == 9 )
{
if ( wieldie == 1 ) wieldtype = 8;
else wieldtype = 1;
}
if ( wieldorig == 8 ) wieldtype = 8;
if ( wieldorig == 7 )
{
if ( wieldie == 1 ) wieldtype = 4;
else if ( wieldie == 2 ) wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 6 )
{
if ( wieldie == 1 || wieldie == 2) wieldtype = 2;
else wieldtype = 4;
}
if ( wieldorig == 5 )
{
if ( wieldie == 1) wieldtype = 4;
else wieldtype = 1;
}
if ( wieldorig == 4 ) wieldtype = 4;
if ( wieldorig == 3 )
{
if ( wieldie == 2 || wieldie == 4) wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 2 ) wieldtype = 2;
if ( wieldorig == 1 ) wieldtype = 1;
if ( wieldtype == 8 ) wield = wield4;
else if ( wieldtype == 4 ) wield = wield3;
else if ( wieldtype == 2 ) wield = wield2;
else wield = wield1;
if (!IS_NPC(ch) && ch->stance[0] > 0 && number_percent() == 5)
{
int stance = ch->stance[0];
if (ch->stance[stance] >= 200)
{
special_move(ch,victim);
return;
}
}
unarmed = 0;
if (IS_SET( ch->flag2, VAMP_OBJMASK) )
{
act("You return to your normal form.",ch,NULL,NULL,TO_CHAR);
sprintf(buf,"%s reforms as %s.\n\r",ch->morph, ch->name );
act(buf,ch,NULL,NULL,TO_ROOM);
free_string(ch->morph);
free_string(ch->objdesc);
ch->long_descr = str_dup("");
REMOVE_BIT(ch->flag2, VAMP_OBJMASK);
REMOVE_BIT(ch->affected_by, AFF_POLYMORPH);
}
one_hit( ch, victim, dt, wieldtype );
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
/* Only want one spell per round from spell weapons...otherwise it's
* too powerful, and would unbalance player killing (as this is a PK mud).
*/
if ( dt == TYPE_UNDEFINED )
{
dt = TYPE_HIT;
if ( wield != NULL && wield->item_type == ITEM_WEAPON )
{
dt += wield->value[3];
if (wield->value[0] >= 1)
{
/* Look, just don't ask... KaVir */
if (wield->value[0] >= 1000) sn = wield->value[0] - ((wield->value[0] / 1000) * 1000);
else sn = wield->value[0];
if (sn != skill_lookup("gas breath") && sn != skill_lookup("desanct") && sn != skill_lookup("sleep") && sn != 0)
{
if (victim->position == POS_FIGHTING) (*skill_table[sn].spell_fun) (sn,wield->level,ch,victim);
}
}
}
}
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if ( 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_DEMON) && IS_SET(ch->warp, WARP_SPIKETAIL) && number_range(1,2) == 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);
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_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);
// one_hit( ch, victim, gsn_venomt, 0);
one_hit( ch, victim, gsn_venomt, 0);
}
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if (!IS_NPC(ch) && !IS_NPC(victim)) // pkpower
{
if (needed(ch) > 1999)
{
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_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] > 9)
{
one_hit(ch,victim,gsn_lightningslash,1);
one_hit(ch,victim,gsn_lightningslash,1);
one_hit(ch,victim,gsn_lightningslash,1);
one_hit(ch,victim,gsn_lightningslash,1);
}
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_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);
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_WRAITH))
{
if (IS_SET(ch->pcdata->powers[WRAITH_POWERS], WRAITH_AURA)) multi_hit(ch,victim,gsn_dblast);
}
if (!IS_NPC(ch) && ( ch->pcdata->shit[MARCUS] > 0 ))
{
multi_hit(ch,victim,gsn_marcuswrath);
}
if (!IS_NPC(ch) && IS_CLASS(ch,CLASS_TITAN))
{
if (ch->pcdata->powers[TITAN_SUPERMIGHT] == 1) multi_hit(ch,victim,gsn_sweepblow);
}
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( "web" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
break;
case 4 :
if ((sn = skill_lookup( "curse" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,50,ch,victim);
break;
case 5 :
if ((sn = skill_lookup( "web" ) ) > 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_DROID))
{
one_hit(ch,victim,gsn_stuntubes,1);
multi_hit(ch,victim,gsn_stinger);
one_hit(ch,victim,gsn_stuntubes,1);
}
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(10,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,10)),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() > 95)
{
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);
}
if (IS_SET(victim->pcdata->powers[AURAS], FEAR_AURA) && IS_CLASS(victim, CLASS_UNDEAD_KNIGHT))
{
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);
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->hitsizedice > 20) count += 20;
else count += ch->pIndexData->hitsizedice;
return count;
}
if (IS_NPC(victim))
{
if ( IS_STANCE(ch, STANCE_VIPER) && number_percent() < ch->stance[STANCE_VIPER] * 0.5) count += 1;
else if ( IS_STANCE(ch, STANCE_MANTIS) && number_percent() < ch->stance[STANCE_MANTIS] * 0.5) count += 1;
else if ( IS_STANCE(ch, STANCE_TIGER) && number_percent() < ch->stance[STANCE_TIGER] * 0.5) count += 1;
else if ( IS_STANCE(ch, STANCE_WOLF) && number_percent() < ch->stance[STANCE_WOLF] * 0.5) count += 2;
else if ( 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->pcdata->upgrade_level > 0) count += ( ch->pcdata->upgrade_level * 2 );
if ( IS_CLASS(ch, CLASS_VAMPIRE) && ch->power[DISC_VAMP_CELE] > 0)
{
count += 2;
if (ch->power[DISC_VAMP_CELE] > 5)
{
count += 2;
if ( ch->power[DISC_VAMP_CELE] > 7)
{
count += 2;
if ( ch->power[DISC_VAMP_CELE] > 9)
count += 2;
}
}
}
if (IS_CLASS(ch, CLASS_TANARRI)) count += ch->pcdata->rank;
if (IS_CLASS(ch, CLASS_DROID)) count += ch->pcdata->powers[CYBORG_LIMBS]/2;
if (IS_CLASS(ch, CLASS_WRAITH)) count += ch->pcdata->powers[WRAITH_WRATH]/2;
if (IS_CLASS(ch, CLASS_TITAN)) count += 9;
if (IS_CLASS(ch, CLASS_ANGEL)) count += ch->pcdata->powers[ANGEL_JUSTICE];
if (IS_CLASS(ch, CLASS_WEREWOLF))
if (IS_EXTRA(victim, PINNEDWALL)) count+=9;
{
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]/2;
if (IS_CLASS(ch, CLASS_LICH)) count += 5;
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]*2;
if (ch->pcdata->powers[SHAPE_FORM] == FAERIE_FORM) count += ch->pcdata->powers[FAERIE_LEVEL]*1.5;
if (ch->pcdata->powers[SHAPE_FORM] == HYDRA_FORM) count += ch->pcdata->powers[HYDRA_LEVEL];
}
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_DROW))
{
if (IS_SET(ch->special, SPC_DROW_WAR)) count += 4;
if (IS_SET(ch->pcdata->powers[1],DPOWER_SPEED)) count += 6;
}
}
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_MAGE) && IS_ITEMAFF(ch, ITEMA_BEAST)) count += 7;
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA) && ch->pcdata->powers[NPOWER_CHIKYU] >= 3)
count += 11;
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 += 8;
if ( IS_ITEMAFF(ch, ITEMA_SPEED) ) count += 2;
}
else
{
if (!IS_NPC(ch)) if (ch->pcdata->upgrade_level > 0) count += ( ch->pcdata->upgrade_level * 2 );
if ( IS_STANCE(ch, STANCE_VIPER) && number_percent() < ch->stance[STANCE_VIPER] * 0.5) count += 1;
else if ( IS_STANCE(ch, STANCE_MANTIS) && number_percent() < ch->stance[STANCE_MANTIS] * 0.5) count += 1;
else if ( IS_STANCE(ch, STANCE_TIGER) && number_percent() < ch->stance[STANCE_TIGER] * 0.5) count += 1;
else if ( ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_SPEED)
&& number_percent() < ch->stance[(ch->stance[0])] * 0.5 ) count += 2;
if (!IS_NPC(ch))
{
if (IS_CLASS(ch, CLASS_DROID)) count += ch->pcdata->powers[CYBORG_LIMBS]/2;
if ( IS_CLASS(ch, CLASS_VAMPIRE))
{
if (ch->power[DISC_VAMP_CELE] > 0) count += 2;
if (ch ->power[DISC_VAMP_CELE] > 5) count += 2;
if (ch->power[DISC_VAMP_CELE] > 7) count += 3;
if ( ch->power[DISC_VAMP_CELE] > 9) count += 3;
}
if ( IS_CLASS(ch, CLASS_MONK)) count += 7;;
if ( IS_CLASS(ch, CLASS_MAGE) && IS_ITEMAFF(ch, ITEMA_BEAST)) count += 4;
if (IS_CLASS(ch, CLASS_ANGEL)) count += 5;
if (IS_CLASS(ch, CLASS_WRAITH)) count += 5;
if (IS_CLASS(ch, CLASS_WEREWOLF))
if (IS_CLASS(ch, CLASS_TITAN)) count +=5;
{
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);
*/
count += 5;
}
}
if (IS_CLASS(ch, CLASS_LICH)) count += 5;
if (IS_CLASS(ch, CLASS_TANARRI))
{
count += ch->pcdata->rank;
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_SPEED)) count += 3;
}
if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT))
count += ch->pcdata->powers[WEAPONSKILL]/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_ITEMAFF(ch, ITEMA_SPEED) ) count += 1;
if (IS_CLASS(ch, CLASS_SAMURAI)) count +=5;
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];
}
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_CLASS(ch, CLASS_MONK)) dam*=15;
if (IS_CLASS(ch, CLASS_WEREWOLF)) dam*=15;
if (IS_CLASS(ch, CLASS_WEREWOLF)) dam*=4;
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( 20, 35 );
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));
if (!IS_NPC(ch) && (ch->pcdata->powers[TITAN_SUPERMIGHT] == 1) && IS_CLASS(ch, CLASS_TITAN)) dam *= 2;
/* Other Resistances */
if (IS_ITEMAFF(victim, ITEMA_RESISTANCE))
{
dam *= 3;
dam /= 4;
}
/* damage reduction */
if (!IS_NPC(ch) && !IS_NPC(victim)) dam /= 2; /* slow down pk */
if (IS_NPC(ch) && dam > 2000) dam = 2000 + (dam-2000)/2; /* mob damage >2000 halved */
if ( dam <= 0 ) dam = 5;
/* up that damage */
if (!IS_NPC(ch)) {
if (ch->pcdata->upgrade_level == 1)
dam *= 1.05;
else if (ch->pcdata->upgrade_level == 2)
dam *= 1.10;
else if (ch->pcdata->upgrade_level == 3)
dam *= 1.15;
else if (ch->pcdata->upgrade_level == 4)
dam *= 1.20;
else if (ch->pcdata->upgrade_level == 5)
dam *= 1.25;
else if (ch->pcdata->upgrade_level == 6)
dam *= 1.29;
else if (ch->pcdata->upgrade_level == 7)
dam *= 1.33;
else if (ch->pcdata->upgrade_level == 8)
dam *= 1.36;
else if (ch->pcdata->upgrade_level == 9)
dam *= 1.39;
else if (ch->pcdata->upgrade_level == 10)
dam *= 1.42;
/* screw you darren, its good */
}
/*
* 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]/5);
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_TANARRI))
{
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_MIGHT)) dam *= 1.5;
}
/*
* This one for angels have no effect, take a look and rebalance. Jobo
*/
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_ANGEL)) dam *= (1 + ch->pcdata->powers[ANGEL_JUSTICE] / 10);
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_WRAITH)) dam *= 2;
if (!IS_NPC(ch) && IS_CLASS(ch,CLASS_TITAN)) dam *=2;
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_DROID) && !IS_NPC(ch))
{
if (ch->pcdata->powers[CYBORG_LIMBS] > 0) dam *= 1.8;
if (ch->pcdata->powers[CYBORG_LIMBS] > 2) dam *= 2;
}
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_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_WRAITH) && 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_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 || ddodge == 1)
{
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))
{
if (ch->chi[CURRENT] > 0 && ch->chi[CURRENT] < 3 ) dam *= 1.3;
if (ch->chi[CURRENT] > 2 && ch->chi[CURRENT] < 7 ) dam *= ((ch->chi[CURRENT]) / 2);
dam *= 60;
}
if ( dt == gsn_garotte )
dam *= (number_range(3,5));
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_WEREWOLF)) dam *= 15;
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.5;
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 *= 4;
if (dt == gsn_heavenlyaura && IS_CLASS(ch, CLASS_ANGEL)) dam *= 4;
if (dt == gsn_deathaura) dam *= 3;
if (dt == gsn_quills) dam *= 4;
if (dt == gsn_stuntubes) dam *= 4;
if (dt == gsn_darktendrils) dam *= 2;
if (dt == gsn_potato) dam /= 2;
if (dt == gsn_marcuswrath) dam *= (ch->pcdata->upgrade_level + 3);
if (dt == gsn_shred) dam *= 2;
if (dt == gsn_pspit) dam *= 2;
if (dt == gsn_dblast) dam *= 2;
if (dt == gsn_wrathofgod) dam *= 4;
if (dt == gsn_grimtouch) dam *= 3;
if (dt == gsn_shiroken) dam *= 5;
if (dt == gsn_darktendrils) dam *= 4;
if (dt == gsn_blinky) dam *= 3;
if (dt == gsn_shards) dam *= 3;
if (dt == gsn_magma) dam *= 3;
if (dt == gsn_mageshield) dam *= 3;
if (dt == gsn_venomt) dam *= 3;
if (dt == gsn_supreme) dam *= 3;
if (dt == gsn_lightningslash) dam *= 3;
dam = cap_dam(ch,victim,dam);
if( IS_NPC(ch) && ch->pIndexData->hitplus > 3) dam *=3;
else if( IS_NPC(ch) && ch->pIndexData->hitplus > 0 ) dam *= ch->pIndexData->hitplus;
if( IS_NPC(victim) && !IS_NPC(ch))
{
if( victim->pIndexData->hitnodice > 100 ) victim->pIndexData->hitnodice = 0;
dam = dam * (100 - victim->pIndexData->hitnodice) / 100;
}
attack_modify = dice(1, 100);
randomize_damage(ch,dam,attack_modify);
if (dt == gsn_deathaura && dam >= victim->hit && IS_NPC(victim)) dam = victim->hit-1; /* trust me, Jobo */
damage( ch, victim, dam, dt );
tail_chain( );
if (!is_safe(ch,victim))
{
improve_wpn(ch,dt,right_hand);
improve_stance(ch);
}
}
int randomize_damage( CHAR_DATA *ch, int dam, int am )
{
dam = dam * (am + 50) / 100;
return dam;
}
int cap_dam(CHAR_DATA *ch, CHAR_DATA *victim, int dam)
{
if (is_safe(ch, victim)) return 0;
if (!IS_NPC(victim)) {
if (victim->pcdata->upgrade_level == 1)
dam *= 0.95;
else if (victim->pcdata->upgrade_level == 2)
dam *= 0.90;
else if (victim->pcdata->upgrade_level == 3)
dam *= 0.85;
else if (victim->pcdata->upgrade_level == 4)
dam *= 0.80;
else if (victim->pcdata->upgrade_level == 5)
dam *= 0.75;
/* 5% less damage per level */
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_DROW))
{
if (IS_SET(victim->pcdata->powers[1], DPOWER_TOUGHSKIN))
dam /= 3;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_LICH))
{
dam /=5;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_WRAITH))
{
dam /=2;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_TITAN))
{
dam /=2;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_ANGEL))
{
dam *= (100 - (victim->pcdata->powers[ANGEL_HARMONY] * 12));
dam /= 100;
}
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_DROID)) dam *= 0.8;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_DROID))
{
if (IS_CLASS(ch, CLASS_SHAPESHIFTER)) dam *= 0.95;
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 /= 3.5;
// if (victim->power[DISC_VAMP_FORT] > 0)
// {
// dam *= (100 - (victim->power[DISC_VAMP_FORT] * 5.5));
// 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_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));
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;
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))
{
max_dam += (ch->pcdata->shit[MAXSTATUS]) * 50;
max_dam += (ch->status) * 50;
if (ch->pcdata->upgrade_level > 0) max_dam += ch->pcdata->upgrade_level * 500;
if (ch->pcdata->shit[MARCUS] > 0) max_dam += ch->pcdata->shit[MARCUS] * 500;
if (ch->pcdata->shit[DARRENS] > 0) max_dam += ch->pcdata->shit[DARRENS] * 500;
if (ch->pcdata->shit[SPAWN] > 0) max_dam += ch->pcdata->shit[SPAWN] * 500;
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;
max_dam += (ch->pcdata->legend *100);
if (IS_CLASS(ch, CLASS_MAGE))
{
if (IS_ITEMAFF(ch, ITEMA_BEAST)) max_dam += 750;
max_dam += 1000;
}
if (IS_CLASS(ch, CLASS_WRAITH))
{
max_dam += ch->pcdata->powers[WRAITH_HATE] * 240;
}
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_LICH))
{
max_dam += 450;
if (ch->pcdata->powers[CON_LORE] > 4) max_dam += 350;
if (ch->pcdata->powers[DEATH_LORE] > 4) max_dam += 350;
if (ch->pcdata->powers[LIFE_LORE] > 4) max_dam += 350;
if (ch->pcdata->powers[NECROMANTIC] > 4) max_dam += 350;
if (ch->pcdata->powers[CHAOS_MAGIC] > 4) max_dam += 350;
}
if (IS_CLASS(ch, CLASS_ANGEL))
{
max_dam += ch->pcdata->powers[ANGEL_JUSTICE]*125;
max_dam += ch->pcdata->powers[ANGEL_PEACE]*125;
max_dam += ch->pcdata->powers[ANGEL_HARMONY]*125;
max_dam += ch->pcdata->powers[ANGEL_LOVE]*125;
}
if (IS_CLASS(ch, CLASS_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 += 500;
if (IS_SET(ch->newbits, NEW_DROWHATE)) max_dam += 1150;
if (IS_SET(ch->newbits,NEW_DFORM)) max_dam += 1150;
}
if (IS_CLASS(ch, CLASS_ARCHER)) max_dam += (ch->pcdata->powers[ARCHERY] * 20);
if (IS_CLASS(ch, CLASS_DEMON) && ch->in_room != NULL)
{
max_dam += ch->power[DISC_DAEM_ATTA] * 70;
max_dam += 1000;
if (ch->pcdata->souls > 0) max_dam += UMIN(350, 700 * 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_DROID))
{
if (ch->pcdata->powers[CYBORG_LIMBS] > 0) max_dam += 400;
if (ch->pcdata->powers[CYBORG_LIMBS] > 1) max_dam += 400;
if (ch->pcdata->powers[CYBORG_LIMBS] > 2) max_dam += 400;
if (ch->pcdata->powers[CYBORG_LIMBS] > 3) max_dam += 400;
if (ch->pcdata->powers[CYBORG_LIMBS] > 4) max_dam += 400;
}
if (IS_CLASS(ch, CLASS_MONK)) {
// max_dam += 1000;
max_dam += (ch->monkab[COMBAT] * 100);
if (ch->chi[CURRENT] > 0) max_dam += ch->chi[CURRENT] * 200;
}
if (IS_CLASS(ch, CLASS_VAMPIRE))
{
max_dam += (ch->rage * 9);
if (ch->power[DISC_VAMP_POTE] > 0)
max_dam += (ch->power[DISC_VAMP_POTE] * 90);
if( ch->pcdata->rank == AGE_TRUEBLOOD) max_dam += 1100;
else if( ch->pcdata->rank == AGE_LA_MAGRA) max_dam += 500;
else if (ch->pcdata->rank == AGE_METHUSELAH) max_dam += 400;
else if (ch->pcdata->rank == AGE_ELDER) max_dam += 250;
else if (ch->pcdata->rank == AGE_ANCILLA) max_dam += 100;
}
if (IS_CLASS(ch, CLASS_NINJA))
{
max_dam += (ch->rage * 4);
if(ch->pcdata->powers[NPOWER_CHIKYU] >=6 && ch->pcdata->powers[HARA_KIRI] > 0)
max_dam += 700;
if(ch->pcdata->powers[NPOWER_CHIKYU] >=2)
max_dam += 800;
}
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 += 750;
}
if (IS_CLASS(ch,CLASS_TITAN))
max_dam += ch->pcdata->powers[TITAN_POWER] * 275;
if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT))
max_dam += ch->pcdata->powers[WEAPONSKILL] * 245;
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 += 175;
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 += 900;
else if (ch->stance[0] > 12 && IS_SET(ch->stance[(ch->stance[0]+6)], STANCEPOWER_DAMCAP_2)) max_dam += 500;
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] * 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) && (victim->in_room->vnum >= 93420 && victim->in_room->vnum <= 93426))
max_dam *= 0.5;
}
if (ch->level >= LEVEL_BUILDER) max_dam = 30000;
// if (ch->level >= LEVEL_BUILDER && !IS_NPC(ch)) max_dam = 100000; // Det er pisse irreterende Thomas.. jeg kan intet teste mod mobs, de doer automatisk. DIE!
ch->damcap[DAM_CAP] = max_dam;
ch->damcap[DAM_CHANGE] = 0;
return;
}
/*
* Inflict damage from a hit.
*/
void damage( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt )
{
CHAR_DATA *emb;
if ( victim->position == POS_DEAD ) return;
if ( ch->embracing != NULL )
{
if ( ( emb = ch->embracing ) != NULL ) stop_embrace(ch,emb);
else stop_embrace(ch,NULL);
}
/*
* Stop up any residual loopholes.
*/
if (ch->damcap[DAM_CHANGE] == 1) update_damcap(ch,victim);
if ( dam > ch->damcap[0] ) dam = ch->damcap[0];
/*
* Certain attacks are forbidden.
* Most other attacks are returned.
*/
if ( victim != ch )
{
if (is_safe( ch, victim )) return;
if ( victim->position > POS_STUNNED )
{
if ( victim->fighting == NULL ) set_fighting( victim, ch );
victim->position = POS_FIGHTING;
}
if ( victim->position > POS_STUNNED )
{
if ( ch->fighting == NULL )
set_fighting( ch, victim );
/*
* If victim is charmed, ch might attack victim's master.
*/
if ( IS_NPC(ch)
&& IS_NPC(victim)
&& IS_AFFECTED(victim, AFF_CHARM)
&& victim->master != NULL
&& victim->master->in_room == ch->in_room
&& number_bits( 3 ) == 0 )
{
stop_fighting( ch, FALSE );
multi_hit( ch, victim->master, TYPE_UNDEFINED );
return;
}
}
if ( victim->master == ch ) stop_follower( victim );
/*
* Damage modifiers.
*/
if ( IS_AFFECTED(ch, AFF_HIDE) )
{
if (!can_see(victim,ch))
{
dam *= 1.5;
send_to_char("You use your concealment to get a surprise attack!\n\r",ch);
}
REMOVE_BIT( ch->affected_by, AFF_HIDE );
act( "$n leaps from $s concealment.", ch, NULL, NULL, TO_ROOM );
}
if ( IS_AFFECTED(victim, AFF_PROTECT) && IS_EVIL(ch) && dam > 1 )
dam -= dam * 0.25;
if ( IS_AFFECTED(victim, AFF_PROTECT_GOOD) && IS_GOOD(ch) && dam > 1 )
dam -= dam * 0.25;
if ( dam < 0 ) dam = 0;
/*
* Check for disarm, trip, parry, and dodge.
*/
if ( dt >= TYPE_HIT )
{
if (IS_NPC(ch) && number_percent( ) < ch->level * 0.5)
disarm( ch, victim );
if (IS_NPC(ch) && number_percent( ) < ch->level * 0.5)
trip( ch, victim );
if (check_dodge( ch, victim, dt))
return;
if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_MONGOOSE) &&
victim->stance[STANCE_MONGOOSE] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
return;
else if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_SWALLOW) &&
victim->stance[STANCE_SWALLOW] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
return;
/* ------------ This is the part for superstances, Jobo ------------------- */
else if (!IS_NPC(victim) && victim->stance[0] > 12
&& IS_SET(victim->stance[(victim->stance[0]+6)], STANCEPOWER_DODGE)
&& victim->stance[(victim->stance[0])] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
return;
/* ------------ This is the end for superstances, Jobo ------------------- */
if (check_parry( ch, victim, dt)) return;
if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_CRANE) &&
victim->stance[STANCE_CRANE] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
return;
else if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_MANTIS) &&
victim->stance[STANCE_MANTIS] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
return;
/* ------------ This is the part for superstances, Jobo ------------------- */
else if (!IS_NPC(victim) && 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;
/* ------------ This is the end for superstances, Jobo ------------------- */
}
dam_message( ch, victim, dam, dt );
}
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;
}
hurt_person(ch,victim,dam);
dropinvis(ch);
dropinvis(victim);
return;
}
void angel_eye( CHAR_DATA *ch, CHAR_DATA *victim, int dam )
{
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int new_dam;
if (IS_SET(victim->pcdata->powers[ANGEL_POWERS], ANGEL_EYE) && dam > 100)
{
new_dam = number_range(dam/4,dam/5);
if (new_dam > 300) new_dam = number_range(275,325);
if (new_dam >= victim->hit) new_dam = victim->hit -1;
if (new_dam < 10) new_dam = 10;
hurt_person(victim, ch, new_dam);
sprintf(buf, "God's justice strikes you HARD [#C%d#n]",new_dam);
sprintf(buf2, "The sinner dares to lay hands on you, God's wrath on the sinner [#C%d#n]", new_dam);
act(buf, victim, NULL, ch, TO_VICT);
act(buf2, victim, NULL, ch, TO_CHAR);
}
return;
}
void hurt_person( CHAR_DATA *ch, CHAR_DATA *victim, int dam )
{
char buf[MAX_STRING_LENGTH];
victim->hit -= dam;
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_ANGEL) && !IS_CLASS(ch, CLASS_ANGEL))
angel_eye(ch,victim,dam); // check for that eye for an eye.
if (!IS_NPC(victim) && 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( "$n is DEAD!!", victim, 0, 0, TO_ROOM );
send_to_char( "You have been KILLED!!\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->hit < victim->max_hit / 4 && dam > 0 )
{
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_VAMPIRE) && number_percent() < victim->beast)
vamp_rage(victim);
else
send_to_char( "You sure are BLEEDING!\n\r", victim );
}
break;
}
/*
* Sleep spells and extremely wounded folks.
*/
if (!IS_AWAKE(victim)) stop_fighting( victim, FALSE );
/*
* Payoff for killing things.
*/
if (victim->hit <= 0 && IS_NPC(victim))
{
group_gain( ch, victim );
victim->position = POS_DEAD;
}
if ( victim->position == POS_DEAD )
{
if (IS_NPC(victim) && !IS_NPC(ch))
{
ch->mkill += 1;
if (IS_CLASS(ch, CLASS_DEMON)
|| IS_CLASS(ch, CLASS_DROW) || IS_CLASS(ch,CLASS_DROID) || IS_CLASS(ch, CLASS_TANARRI))
{
if (IS_NPC(victim) && !IS_SET(victim->act, ACT_NOEXP))
{
if (IS_CLASS(ch, CLASS_DEMON))
{
ch->pcdata->stats[DEMON_CURRENT] += victim->level*7;
ch->pcdata->stats[DEMON_TOTAL] += victim->level*7;
}
else
ch->pcdata->stats[DROW_POWER] += victim->level*7;
sprintf(buf,"You gain #y(#C%d#y)#n class points.\n\r", victim->level*7);
if (!IS_SET(ch->act, PLR_BRIEF4)) send_to_char(buf,ch);
}
}
if (ch->level == 1 && ch->mkill > 4)
{
ch->level = 2;
do_save(ch,"");
}
}
if (!IS_NPC(victim) && IS_NPC(ch))
{
victim->mdeath = victim->mdeath + 1;
}
raw_kill( victim );
if (!IS_NPC(ch) && !IS_NPC(victim) && victim->pcdata->bounty > 0)
{
sprintf(buf,"You recive a %d QP bounty, for killing %s.\n\r",
victim->pcdata->bounty, victim->name);
send_to_char(buf, ch);
ch->pcdata->quest += victim->pcdata->bounty;
victim->pcdata->bounty =0;
}
if (IS_SET(ch->act, PLR_AUTOLOOT) )
do_get( ch, "all corpse" );
else
do_look( ch, "in corpse" );
if ( !IS_NPC(ch) && IS_NPC(victim) )
{
if ( IS_SET(ch->act, PLR_AUTOSAC) )
do_sacrifice( ch, "corpse" );
}
return;
}
if ( victim == ch ) return;
tail_chain( );
return;
}
bool is_safe( CHAR_DATA *ch, CHAR_DATA *victim )
{
char buf[MAX_STRING_LENGTH];
if (!ch->in_room) return TRUE; // when someone calls a one_hit or similar on something/someone who COULD be dead/gone.
if (!victim->in_room) return TRUE;
if (!IS_NPC(victim) && !IS_NPC(ch))
{
if ( !CAN_PK(ch) || !CAN_PK(victim) )
{
send_to_char( "Both players must be avatars to fight.\n\r", ch );
return TRUE;
}
}
if (!IS_NPC(ch) && !IS_NPC(victim))
{
if(ch->pcdata->safe_counter > 0)
{
send_to_char("Your are safe for 10 ticks after training avatar.\n\r",ch);
return TRUE;
}
if (ch->pcdata->shit[CAPTIMER] > 0)
{
send_to_char("You are safe for 5 ticks after capping.\n\r",ch);
return TRUE;
}
if (victim->pcdata->shit[CAPTIMER] > 0)
{
send_to_char("They are safe for 5 ticks after capping.\n\r",ch);
return TRUE;
}
if (victim->desc)
{
if(victim->pcdata->safe_counter > 0)
{
send_to_char("They are safe for 10 ticks after training avatar.\n\r",ch);
return TRUE;
}
}
//if (IS_SET(ch->pcdata->shit[3], GANGABLE)) return FALSE;
if (str_cmp(victim->pcdata->lasthit,"") && (str_cmp(ch->pcdata->switchname,victim->pcdata->lasthit)))
{
sprintf(buf,"They are last in battle with %s.\n\r",victim->pcdata->lasthit);
send_to_char(buf,ch);
return TRUE;
}
if ((str_cmp(ch->pcdata->lasthit,"") && str_cmp(ch->pcdata->lasthit,victim->pcdata->switchname)))
{
sprintf(buf,"You are currently in battle with %s.\n\r",ch->pcdata->lasthit);
send_to_char(buf,ch);
return TRUE;
}
if (victim->desc)
{
if (victim->desc->connected >= CON_NOTE_TO && victim->desc->connected <= CON_NOTE_FINISH)
{
send_to_char("That player is writing a note, be nice.\n\r",ch);
return TRUE;
}
}
}
if (IS_AFFECTED(ch, AFF_ETHEREAL))
{
send_to_char( "You cannot while ethereal.\n\r", ch );
return TRUE;
}
if (IS_AFFECTED(victim, AFF_ETHEREAL))
{
send_to_char( "You cannot fight an ethereal person.\n\r", ch );
return TRUE;
}
if (IS_AFFECTED(ch, AFF_SHADOWPLANE))
{
act( "You are too insubstantial!", ch, NULL, victim, TO_CHAR );
return TRUE;
}
if (IS_AFFECTED(victim, AFF_SHADOWPLANE))
{
act( "$E is too insubstantial!", ch, NULL, victim, TO_CHAR );
return TRUE;
}
if ( IS_HEAD(ch,LOST_HEAD) || IS_EXTRA(ch,EXTRA_OSWITCH) )
{
send_to_char( "Objects cannot fight!\n\r", ch );
return TRUE;
}
if ( IS_HEAD(victim,LOST_HEAD) || IS_EXTRA(victim,EXTRA_OSWITCH))
{
send_to_char( "You cannot attack an object.\n\r", ch );
return TRUE;
}
if (IS_SET(victim->extra, EXTRA_AFK))
{
send_to_char("They are AFK!\n\r",ch);
return TRUE;
}
if (!IS_NPC(victim) && victim->desc == NULL && victim->timer > 1 && victim->fight_timer == 0)
{
// Timer check to avoid people going ld in the first round.
send_to_char("Nooo, they are linkdead.\n\r",ch);
return TRUE;
}
/*
if (ragnarok && is_upgrade(ch) && !is_upgrade(victim) && !IS_NPC(ch) && !IS_NPC(victim))
{
send_to_char("You cannot attack non-upgrades doing ragnarok.\n\r",ch);
return TRUE;
}
if (ragnarok && !is_upgrade(ch) && is_upgrade(victim) && !IS_NPC(ch) && !IS_NPC(victim))
{
send_to_char("You cannot attack upgrades doing ragnarok.\n\r",ch);
return TRUE;
}
*/
if (victim->fight_timer > 0) return FALSE;
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);
if ( IS_SET(ch->in_room->room_flags,ROOM_SAFE) && !ragnarok)
{
send_to_char( "You cannot fight in a safe room.\n\r", ch );
return TRUE;
}
if (IS_NPC(ch) || IS_NPC(victim)) return FALSE;
if (victim->fighting == ch) return FALSE;
if (IS_AFFECTED(ch, AFF_PEACE))
{
send_to_char( "You are unable to attack them.\n\r", ch );
return TRUE;
}
if (IS_AFFECTED(victim, AFF_PEACE))
{
send_to_char( "You can't seem to attack them.\n\r", ch );
return TRUE;
}
if (IS_ITEMAFF(ch, ITEMA_PEACE))
{
send_to_char( "You are unable to attack them.\n\r", ch );
return TRUE;
}
if (IS_ITEMAFF(victim, ITEMA_PEACE))
{
send_to_char( "You can't seem to attack them.\n\r", ch );
return TRUE;
}
if (!IS_SET(victim->extra, EXTRA_PKREADY))
{
send_to_char("Do not attack a newbie.\n\r", ch);
return TRUE;
}
return FALSE;
}
/*
* Check for parry.
*/
bool check_parry( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
{
OBJ_DATA *obj = NULL;
int chance = 0;
bool claws = FALSE;
if (!IS_AWAKE(victim)) return FALSE;
if (IS_NPC(victim)) obj = NULL;
else if (IS_CLASS(victim, CLASS_WEREWOLF) && victim->power[DISC_WERE_BEAR] > 2
&& IS_VAMPAFF(victim, VAM_CLAWS) && get_eq_char(victim, WEAR_WIELD) == NULL
&& get_eq_char(victim, WEAR_HOLD) == NULL)
{
obj = NULL;
claws = TRUE;
}
else if ( IS_CLASS(victim, CLASS_MONK) && IS_SET(victim->newbits, NEW_MONKADAM)
&& get_eq_char(victim, WEAR_WIELD) == NULL && get_eq_char(victim, WEAR_HOLD) == NULL)
{
obj = NULL;
claws = TRUE;
}
else if( IS_CLASS(victim, CLASS_SHAPESHIFTER) && get_eq_char(victim, WEAR_WIELD) == NULL
&& get_eq_char(victim, WEAR_HOLD) == NULL)
{
obj = NULL;
claws = TRUE;
}
else
{
if ((obj = get_eq_char(victim, WEAR_WIELD)) == NULL || obj->item_type != ITEM_WEAPON)
{
if ((obj = get_eq_char(victim, WEAR_HOLD)) == NULL || obj->item_type != ITEM_WEAPON)
return FALSE;
}
}
if ( ( dt < 1000 || dt > 1012) && !IS_CLASS(ch, CLASS_MONK) ) return FALSE;
if ( dt >= 1000 && dt <= 1012 )
{
if (!IS_NPC(ch)) chance -= (ch->wpn[dt-1000] * 0.1);
else chance -= (ch->level * 0.2);
if (!IS_NPC(victim)) chance += (victim->wpn[dt-1000] * 0.5);
else chance += victim->level;
}
else
{
if (!IS_NPC(ch)) chance -= (ch->wpn[0] * 0.1);
else chance -= (ch->level * 0.2);
if (!IS_NPC(victim)) chance += (victim->wpn[0] * 0.5);
else chance += victim->level;
}
if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_CRANE) && victim->stance[STANCE_CRANE] > 0
&& !can_counter(ch) && !can_bypass(ch,victim))
chance += (victim->stance[STANCE_CRANE] * 0.25);
else if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_MANTIS) && victim->stance[STANCE_MANTIS] > 0
&& !can_counter(ch) && !can_bypass(ch,victim))
chance += (victim->stance[STANCE_MANTIS] * 0.25);
/* ------------ This is the part for superstances, Jobo ------------------- */
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))
chance += victim->stance[(victim->stance[0])] * 0.25;
/* ------------ This is the end for superstances, Jobo ------------------- */
chance -= (char_hitroll(ch) * 0.1);
if (claws)
{
if (victim->power[DISC_WERE_LYNX] > 3) chance += (char_hitroll(victim) * 0.1);
else chance += (char_hitroll(victim) * 0.075);
}
if (!IS_NPC(ch))
{
if (IS_CLASS(ch,CLASS_DROID)) chance -= ch->pcdata->powers[CYBORG_LIMBS]*10;
if (ch->pcdata->upgrade_level > 0) chance -= ch->pcdata->upgrade_level*10;
if (IS_CLASS(ch, CLASS_LICH)) chance -= 25;
if (IS_CLASS(ch, CLASS_SHAPESHIFTER))
{
if (ch->pcdata->powers[SHAPE_FORM] == TIGER_FORM) chance -= ch->pcdata->powers[TIGER_LEVEL]*11;
else if (ch->pcdata->powers[SHAPE_FORM] == BULL_FORM) chance -= ch->pcdata->powers[BULL_LEVEL]*7.5;
else if (ch->pcdata->powers[SHAPE_FORM] == HYDRA_FORM) chance -= ch->pcdata->powers[HYDRA_LEVEL]*7;
else if (ch->pcdata->powers[SHAPE_FORM] == FAERIE_FORM) chance -= ch->pcdata->powers[FAERIE_LEVEL]*6;
else chance -= 10;
}
if (IS_CLASS(ch, CLASS_TANARRI))
{
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_HEAD)) chance -= 15;
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_SPEED)) chance -= 17;
if (ch->pcdata->powers[TANARRI_FURY_ON] == 1) chance -= 17;
}
if (IS_CLASS(ch, CLASS_ANGEL)) chance -= ch->pcdata->powers[ANGEL_JUSTICE]*9;
if (IS_CLASS(ch, CLASS_WRAITH)) chance -= ch->pcdata->powers[WRAITH_HATE]*5;
if (IS_CLASS(ch, CLASS_VAMPIRE) && ch->power[DISC_VAMP_CELE] > 0) chance -= (ch->power[DISC_VAMP_CELE]*3);
if (IS_CLASS(ch, CLASS_NINJA) && ch->pcdata->powers[NPOWER_CHIKYU] >= 6 && ch->pcdata->powers[HARA_KIRI] > 0) chance -= 25;
if (ch->pcdata->powers[NPOWER_CHIKYU] >= 5 && IS_CLASS(ch, CLASS_NINJA)) chance -= 20;
if (IS_CLASS(ch, CLASS_DEMON) && IS_DEMPOWER(ch, DEM_SPEED)) chance -= 25;
if (IS_CLASS(ch, CLASS_MONK) && ch->chi[CURRENT] > 0) chance -= (ch->chi[CURRENT] * 7);
if (IS_CLASS(ch, CLASS_UNDEAD_KNIGHT)) chance -= ch->pcdata->powers[WEAPONSKILL]*3.5;
if (IS_CLASS(ch, CLASS_MAGE) && IS_ITEMAFF(ch, ITEMA_BEAST)) chance -= 30;
if (IS_CLASS(ch, CLASS_TITAN)) chance -= ch->pcdata->powers[TITAN_COMBAT]*8;
if (IS_CLASS(ch, CLASS_DROW) && IS_SET(ch->pcdata->powers[1], DPOWER_ARMS)) chance -= 30;
if (IS_SET(ch->newbits, NEW_MONKFLAME)) chance -= 3;
if (IS_CLASS(ch, CLASS_WEREWOLF)) chance -= (ch->power[DISC_WERE_MANT] * 3);
if (IS_CLASS(ch, CLASS_SAMURAI)) chance -= 25;
if (IS_ITEMAFF(ch, ITEMA_AFFMANTIS)) chance -= 12;
}
if (!IS_NPC(victim))
{
if (IS_CLASS(victim,CLASS_DROID)) chance += victim->pcdata->powers[CYBORG_LIMBS]*10;
if (victim->pcdata->upgrade_level > 0) chance += victim->pcdata->upgrade_level*10;
if (IS_CLASS(victim, CLASS_LICH)) chance += 40;
if (IS_CLASS(victim, CLASS_SHAPESHIFTER))
{
if (victim->pcdata->powers[SHAPE_FORM] == TIGER_FORM) chance += victim->pcdata->powers[TIGER_LEVEL]*6;
else if (victim->pcdata->powers[SHAPE_FORM] == BULL_FORM) chance += victim->pcdata->powers[BULL_LEVEL]*7;
else if (victim->pcdata->powers[SHAPE_FORM] == HYDRA_FORM) chance += victim->pcdata->powers[HYDRA_LEVEL]*6;
else if (victim->pcdata->powers[SHAPE_FORM] == FAERIE_FORM) chance += victim->pcdata->powers[FAERIE_LEVEL]*11;
else chance += 10;
}
if (IS_CLASS(victim, CLASS_TANARRI))
{
if (IS_SET(victim->pcdata->powers[TANARRI_POWER], TANARRI_HEAD)) chance += 15;
if (IS_SET(victim->pcdata->powers[TANARRI_POWER], TANARRI_SPEED)) chance += 17;
if (victim->pcdata->powers[TANARRI_FURY_ON] == 1) chance += 12;
}
if (IS_CLASS(victim, CLASS_ANGEL)) chance += victim->pcdata->powers[ANGEL_PEACE]*9;
if (IS_CLASS(victim, CLASS_WRAITH)) chance += victim->pcdata->powers[WRAITH_HATE]*5;
if (victim->pcdata->powers[NPOWER_CHIKYU] >= 5 && IS_CLASS(victim, CLASS_NINJA)) chance += 20;
if (IS_CLASS(victim, CLASS_NINJA) && victim->pcdata->powers[NPOWER_CHIKYU] >= 6 && victim->pcdata->powers[HARA_KIRI] > 0) chance += 25;
if (victim->power[DISC_VAMP_CELE] > 0 && IS_CLASS(victim, CLASS_VAMPIRE)) chance += (victim->power[DISC_VAMP_CELE]*3);
if (IS_CLASS(victim, CLASS_DROW) && IS_SET(victim->pcdata->powers[1], DPOWER_ARMS)) chance += 30;
if (IS_CLASS(victim, CLASS_MONK) && ch->chi[CURRENT] > 0 ) chance += (ch->chi[CURRENT] * 8);
if (IS_SET(victim->newbits, NEW_MONKFLAME)) chance += 4;
if (IS_CLASS(victim, CLASS_SAMURAI)) chance +=25;
if (IS_CLASS(victim, CLASS_UNDEAD_KNIGHT)) chance += victim->pcdata->powers[WEAPONSKILL]*4;
if (IS_CLASS(victim, CLASS_TITAN)) chance += victim->pcdata->powers[TITAN_COMBAT]*8;
if (IS_CLASS(victim, CLASS_MAGE) && IS_ITEMAFF(victim, ITEMA_DEFLECTOR)) chance += 40;
if (IS_CLASS(victim, CLASS_DEMON) && IS_DEMPOWER(victim, DEM_SPEED)) chance += 25;
}
if (chance > 80) chance = 80;
else if (chance < 20) chance = 20;
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_LICH)) chance -= 15;
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_LICH)) chance += 15;
if (!IS_NPC(ch) && ch->power[DISC_VAMP_CELE] > 0 && IS_CLASS(ch, CLASS_VAMPIRE))
{
if( ch->pcdata->rank == AGE_TRUEBLOOD) chance -= 20;
else if( ch->pcdata->rank == AGE_LA_MAGRA) chance -= 17;
else if (ch->pcdata->rank == AGE_METHUSELAH) chance -= 15;
else if (ch->pcdata->rank == AGE_ELDER) chance -= 10;
else if (ch->pcdata->rank == AGE_ANCILLA) chance -= 5;
}
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_SHAPESHIFTER))
{
if (ch->pcdata->powers[SHAPE_FORM] == TIGER_FORM) chance -= ch->pcdata->powers[TIGER_LEVEL]*4;
else if (ch->pcdata->powers[SHAPE_FORM] == BULL_FORM) chance -= ch->pcdata->powers[BULL_LEVEL]*3;
else if (ch->pcdata->powers[SHAPE_FORM] == HYDRA_FORM) chance -= ch->pcdata->powers[HYDRA_LEVEL]*3;
else if (ch->pcdata->powers[SHAPE_FORM] == FAERIE_FORM) chance -= ch->pcdata->powers[FAERIE_LEVEL]*2;
else chance -= 2;
}
if (IS_CLASS(ch, CLASS_TANARRI) && !IS_NPC(ch))
{
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_HEAD)) chance -= 5;
if (IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_SPEED)) chance -= 6;
if (ch->pcdata->powers[TANARRI_FURY_ON] == 1) chance -= 5;
}
if (IS_CLASS(victim, CLASS_TANARRI) && !IS_NPC(victim))
{
if (IS_SET(victim->pcdata->powers[TANARRI_POWER], TANARRI_HEAD)) chance += 5;
if (IS_SET(victim->pcdata->powers[TANARRI_POWER], TANARRI_SPEED)) chance += 6;
if (victim->pcdata->powers[TANARRI_FURY_ON] == 1) chance += 5;
}
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_TITAN)) chance -= ch->pcdata->powers[TITAN_KNOWLEDGE]*3;
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_ANGEL)) chance -= ch->pcdata->powers[ANGEL_JUSTICE]*3;
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_WRAITH)) chance -= ch->pcdata->powers[WRAITH_HATE]*2;
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_ANGEL)) chance += victim->pcdata->powers[ANGEL_PEACE]*3;
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_WRAITH)) chance += victim->pcdata->powers[WRAITH_HATE]*2;
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_TITAN)) chance += victim->pcdata->powers[TITAN_KNOWLEDGE]*3;
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_SHAPESHIFTER))
{
if (victim->pcdata->powers[SHAPE_FORM] == TIGER_FORM) chance += victim->pcdata->powers[TIGER_LEVEL]*2;
else if (victim->pcdata->powers[SHAPE_FORM] == BULL_FORM) chance += victim->pcdata->powers[BULL_LEVEL]*3;
else if (victim->pcdata->powers[SHAPE_FORM] == HYDRA_FORM) chance += victim->pcdata->powers[HYDRA_LEVEL]*3;
else if (victim->pcdata->powers[SHAPE_FORM] == FAERIE_FORM) chance += victim->pcdata->powers[FAERIE_LEVEL]*6;
else chance += 2;
}
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_MAGE) && IS_ITEMAFF(ch, ITEMA_BEAST)) chance -= 10;
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_UNDEAD_KNIGHT)) chance -= ch->pcdata->powers[WEAPONSKILL];
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_UNDEAD_KNIGHT)) chance += victim->pcdata->powers[WEAPONSKILL]*1.5;
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA))
{
if( ch->pcdata->rank == BELT_TEN) chance -= 20;
else if( ch->pcdata->rank == BELT_NINE) chance -= 18;
else if (ch->pcdata->rank == BELT_EIGHT) chance -= 16;
else if (ch->pcdata->rank == BELT_SEVEN) chance -= 13;
else if (ch->pcdata->rank == BELT_SIX) chance -= 10;
else if (ch->pcdata->rank == BELT_FIVE) chance -= 7;
else if (ch->pcdata->rank == BELT_FOUR) chance -= 4;
else if (ch->pcdata->rank == BELT_THREE) chance -= 2;
}
if(!IS_NPC(ch) && IS_CLASS(ch, CLASS_DEMON)) chance -= (ch->power[DISC_DAEM_ATTA]);
if(!IS_NPC(victim) && IS_CLASS(victim, CLASS_DEMON)) chance += (victim->power[DISC_DAEM_ATTA]);
if (!IS_NPC(victim) && victim->power[DISC_VAMP_CELE] > 0 && IS_CLASS(victim, CLASS_VAMPIRE))
{
if( victim->pcdata->rank == AGE_TRUEBLOOD) chance += 20;
else if( victim->pcdata->rank == AGE_LA_MAGRA) chance += 17;
else if (victim->pcdata->rank == AGE_METHUSELAH) chance += 15;
else if (victim->pcdata->rank == AGE_ELDER) chance += 10;
else if (victim->pcdata->rank == AGE_ANCILLA) chance += 5;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_NINJA))
{
if( victim->pcdata->rank == BELT_TEN) chance += 20;
else if( victim->pcdata->rank == BELT_NINE) chance += 18;
else if (victim->pcdata->rank == BELT_EIGHT) chance += 16;
else if (victim->pcdata->rank == BELT_SEVEN) chance += 13;
else if (victim->pcdata->rank == BELT_SIX) chance += 12;
else if (victim->pcdata->rank == BELT_FIVE) chance += 10;
else if (victim->pcdata->rank == BELT_FOUR) chance += 9;
else if (victim->pcdata->rank == BELT_THREE) chance += 6;
else if (victim->pcdata->rank == BELT_TWO) chance += 4;
else if (victim->pcdata->rank == BELT_ONE) chance += 2;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_SAMURAI)) chance += 15;
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_SAMURAI)) chance -=15;
if (!IS_NPC(ch) && IS_CLASS(ch,CLASS_DROID)) chance -= ch->pcdata->powers[CYBORG_LIMBS]*4;
if (!IS_NPC(victim) && IS_CLASS(victim,CLASS_DROID)) chance += victim->pcdata->powers[CYBORG_LIMBS]*4;
if (victim->monkblock / 4 > 0 ) chance += victim->monkblock / 4;
if (number_percent( ) < 100 && number_percent( ) >= chance)
return FALSE;
if (!IS_NPC(victim))
{
if (IS_SET(victim->pcdata->jflags, JFLAG_BULLY) && number_range(1,3) != 2) return FALSE;
}
if (!IS_NPC(ch) && IS_NPC(victim)
&& IS_SET(ch->newbits, NEW_FIGHTDANCE)
&& IS_CLASS(ch, CLASS_DROW)
&& number_percent() >=50
&& ((( obj = get_eq_char(ch, WEAR_WIELD )) != NULL && ( obj->value[3] == 4 || obj->value[3] == 11))
|| ((obj = get_eq_char (ch, WEAR_HOLD))!= NULL &&( obj->value[3] == 4 || obj->value[3] == 11))))
{
act( "$n's dark weapon dances around your defences, making a strange sound.", ch, NULL, victim, TO_VICT );
act( "Your sacrificial weapon hums in the air as it dances $N's defences.", ch, obj, victim, TO_CHAR );
return FALSE;
}
if (claws)
{
if (IS_NPC(victim) || !IS_SET(victim->act, PLR_BRIEF3))
{
if (IS_CLASS(victim, CLASS_WEREWOLF))
act( "You parry $n's blow with your claws.", ch, NULL, victim, TO_VICT );
else
act( "You parry $n's blow with your Adamantium hands.", ch,NULL,victim, TO_VICT);
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_MONK) && victim->monkblock < 150 && number_range(1,1)==1)
victim->monkblock++;
if (IS_NPC(ch) || !IS_SET(ch->act, PLR_BRIEF3))
{
if (IS_CLASS(victim, CLASS_WEREWOLF))
act( "$N parries your blow with $S claws.", ch, NULL, victim, TO_CHAR );
else
act( "$N parries your blow with $S Adamantium claws.", ch,NULL,victim, TO_CHAR);
}
return TRUE;
}
if (!IS_NPC(victim) && obj != NULL && obj->item_type == ITEM_WEAPON && obj->value[3] >= 0 && obj->value[3] <= 12)
{
if (IS_NPC(victim) || !IS_SET(victim->act, PLR_BRIEF3))
act( "You parry $n's blow with $p.", ch, obj, victim, TO_VICT );
if (IS_NPC(ch) || !IS_SET(ch->act, PLR_BRIEF3))
act( "$N parries your blow with $p.", ch, obj, victim, TO_CHAR );
return TRUE;
}
if (IS_NPC(victim) || !IS_SET(victim->act, PLR_BRIEF3))
act( "You parry $n's attack.", ch, NULL, victim, TO_VICT );
if (IS_NPC(ch) || !IS_SET(ch->act, PLR_BRIEF3))
act( "$N parries your attack.", ch, NULL, victim, TO_CHAR );
return TRUE;
}
/*
* Check for dodge.
*/
bool check_dodge( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
{
int chance = 0;
if (!IS_AWAKE(victim)) return FALSE;
if (!IS_NPC(ch)) chance -= (ch->wpn[dt-1000] * 0.1);
else chance -= (ch->level * 0.2);
if (!IS_NPC(victim)) chance += (victim->wpn[0] * 0.5);
else chance += victim->level;
if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_MONGOOSE) && victim->stance[STANCE_MONGOOSE] > 0
&& !can_counter(ch) &&!can_bypass(ch,victim))
chance += victim->stance[STANCE_MONGOOSE] * 0.25;
if (!IS_NPC(victim) && IS_STANCE(victim,Showing the first 100 KB of 228.9 KB. Download the archive for the full file.