fight.c
./distorted/src/fight.c · 365.4 KB
From the archive Dist_Illusions.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. *
***************************************************************************/
/***************************************************************************
* ROM 2.4 is copyright 1993-1995 Russ Taylor *
* ROM has been brought to you by the ROM consortium *
* Russ Taylor (rtaylor@pacinfo.com) *
* Gabrielle Taylor (gtaylor@pacinfo.com) *
* Brian Moore (rom@rom.efn.org) *
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************/
/***************************************************************************
* ROT 1.4 is copyright 1996-1997 by Russ Walsh *
* By using this code, you have agreed to follow the terms of the *
* ROT license, in the file doc/rot.license *
***************************************************************************/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "merc.h"
#include "clan.h"
#include "tables.h"
#include <math.h>
double pow( double x, double y );
/* command procedures needed */
DECLARE_DO_FUN (do_backstab);
DECLARE_DO_FUN (do_strangle);
DECLARE_DO_FUN (do_layhands);
DECLARE_DO_FUN (do_smokebomb);
DECLARE_DO_FUN (do_emote);
DECLARE_DO_FUN (do_berserk);
DECLARE_DO_FUN (do_bash);
DECLARE_DO_FUN (do_trip);
DECLARE_DO_FUN (do_dirt);
DECLARE_DO_FUN (do_flee);
DECLARE_DO_FUN (do_kick);
DECLARE_DO_FUN (do_side_kick);
DECLARE_DO_FUN (do_disarm);
DECLARE_DO_FUN (do_get);
DECLARE_DO_FUN (do_recall);
DECLARE_DO_FUN (do_yell);
DECLARE_DO_FUN (do_sacrifice);
DECLARE_DO_FUN (do_circle);
DECLARE_DO_FUN (do_feed);
DECLARE_DO_FUN (do_gouge);
DECLARE_DO_FUN (do_vdpi);
DECLARE_DO_FUN (do_vdtr);
DECLARE_DO_FUN (do_vdth);
DECLARE_DO_FUN (do_look);
DECLARE_DO_FUN (do_announce);
DECLARE_DO_FUN (do_clantalk);
DECLARE_DO_FUN (do_twirl);
DECLARE_DO_FUN (do_rank);
DECLARE_DO_FUN (do_lead);
const int vam_str[] =
{
6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5,
6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5
};
/*
* Local functions.
*/
void check_assist args ((CHAR_DATA * ch, CHAR_DATA * victim));
bool check_dodge args ((CHAR_DATA * ch, CHAR_DATA * victim));
bool check_dodge_real args ((CHAR_DATA * ch, CHAR_DATA * victim, bool silent));
bool check_parry args ((CHAR_DATA * ch, CHAR_DATA * victim));
bool check_phase args ((CHAR_DATA * ch, CHAR_DATA * victim));
bool check_blood args ((CHAR_DATA * ch, CHAR_DATA * victim, bool silent));
bool check_phase_real args ((CHAR_DATA * ch, CHAR_DATA * victim, bool silent));
bool check_shield_block args ((CHAR_DATA * ch, CHAR_DATA * victim));
bool check_shield_wall args ((CHAR_DATA * ch, CHAR_DATA * victim));
bool check_barrier args ((CHAR_DATA * ch, CHAR_DATA * victim));
void dam_message args ((CHAR_DATA * ch, CHAR_DATA * victim, int dam,
int dt, bool immune));
void dam_message_new args ((CHAR_DATA * ch, CHAR_DATA * victim, int dam,
int dt, bool immune, int dam_flags));
void death_cry args ((CHAR_DATA * ch));
void group_gain args ((CHAR_DATA * ch, CHAR_DATA * victim));
bool is_safe args ((CHAR_DATA * ch, CHAR_DATA * victim));
bool is_safe_quiet args ((CHAR_DATA * ch, CHAR_DATA * victim));
int xp_compute args((CHAR_DATA * gch, CHAR_DATA * victim, int total_levels, int members));
int align_compute args((CHAR_DATA * gch, CHAR_DATA * victim, int total_levels, int members));
bool is_safe_mock args ((CHAR_DATA * ch, CHAR_DATA * victim));
bool is_voodood args ((CHAR_DATA * ch, CHAR_DATA * victim));
void make_corpse args ((CHAR_DATA * ch, CHAR_DATA * killer));
void one_hit args ((CHAR_DATA * ch, CHAR_DATA * victim, int dt, bool secondary));
void one_hit_mock args ((CHAR_DATA * ch, CHAR_DATA * victim, int dt, bool secondary));
void mob_hit args ((CHAR_DATA * ch, CHAR_DATA * victim, int dt));
void raw_kill args ((CHAR_DATA * victim, CHAR_DATA * killer));
void set_fighting args ((CHAR_DATA * ch, CHAR_DATA * victim));
void disarm args ((CHAR_DATA * ch, CHAR_DATA * victim));
void check_arena args ((CHAR_DATA * ch, CHAR_DATA * victim));
int dambonus args ((CHAR_DATA * ch, CHAR_DATA * victim,int dam, int stance));
bool can_counter args ((CHAR_DATA * ch));
bool can_bypass args ((CHAR_DATA * ch, CHAR_DATA * victim));
static int edam_bonus args ((CHAR_DATA *ch, int damage));
void update_power args((CHAR_DATA *highlander));
void falcon_load args((CHAR_DATA *ch, CHAR_DATA *victim));
void woodsman_twirl args((CHAR_DATA * ch, char *argument));
void part_create args((CHAR_DATA *ch, char *argument));
int add_bonuses args(( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, int dam_type ));
char debugbuf[MSL];
int add_damroll args((CHAR_DATA *ch, int diceside));
void death_message args((CHAR_DATA *killer, CHAR_DATA *victim));
int check_martial_arts args((CHAR_DATA *ch, CHAR_DATA *victim));
bool check_open_palming args((CHAR_DATA *ch));
void clear_stance_affects args((CHAR_DATA *ch));
bool check_block args ((CHAR_DATA * ch, CHAR_DATA * victim));
bool check_roll args ((CHAR_DATA * ch, CHAR_DATA * victim));
bool check_acrobatics args ((CHAR_DATA * ch, CHAR_DATA * victim));
OBJ_DATA * rand_obj args( ( CHAR_DATA *ch, int mob_level ));
int focus_ac args ((CHAR_DATA *ch));
int focus_hit args ((CHAR_DATA *ch));
int focus_sorc args ((CHAR_DATA *ch));
int focus_dam args ((CHAR_DATA *ch));
void improve_toughness args((CHAR_DATA * ch));
bool check_tumble args ((CHAR_DATA *ch, CHAR_DATA *victim, int dt));
void special_move args (( CHAR_DATA *ch, CHAR_DATA *victim ));
bool check_deflect args((CHAR_DATA *ch, CHAR_DATA *victim, int dt,int dam));
bool check_counter_defense args((CHAR_DATA *ch,CHAR_DATA *victim,int dt));
char * get_descr_form args((CHAR_DATA *ch,CHAR_DATA *looker, bool get_long));
void do_mutilate args((CHAR_DATA *ch, CHAR_DATA *victim));
int rank_pk args ((CHAR_DATA * ch, CHAR_DATA * victim));
int rank_arena args ((CHAR_DATA * ch, CHAR_DATA * victim));
int chance_pk args ((CHAR_DATA * ch, CHAR_DATA * victim));
int chance_arena args ((CHAR_DATA * ch, CHAR_DATA * victim));
int sorcery_dam args( ( int num, int dice, CHAR_DATA *ch) );
bool check_sorcery args( (CHAR_DATA *ch, int sn) );
void clan_entry_trigger args((CHAR_DATA *ch, sh_int clan));
void show_damage_short args((CHAR_DATA *ch, CHAR_DATA *victim));
void do_fear (CHAR_DATA * ch, CHAR_DATA * victim);
bool check_quick_step args((CHAR_DATA *ch, CHAR_DATA *victim));
void check_follow_through args((CHAR_DATA *ch, CHAR_DATA *victim, int dam));
int rounddam = 0;
/*
* Control the fights going on.
* Called periodically by update_handler.
*/
void violence_update (void)
{
CHAR_DATA *ch;
CHAR_DATA *ch_next;
CHAR_DATA *victim;
int regenerate=0;
for (ch = char_list; ch != NULL; ch = ch_next)
{
ch_next = ch->next;
// Regeneration
if( ch->regen_rate != 0 )
{
if(ch->regen_rate > 0)
{
if(is_affected(ch,gsn_target))
regenerate = number_range(ch->regen_rate/2, ch->regen_rate);
else
regenerate = number_range(1, ch->regen_rate);
}
else if(ch->regen_rate < 0)
regenerate = number_range(1, -ch->regen_rate);
if(ch->hit < ch->max_hit)
{
if(ch->regen_rate > 0)
ch->hit = UMIN(ch->hit + regenerate, ch->max_hit);
else if(ch->regen_rate < 0)
ch->hit = UMIN(ch->hit - regenerate, ch->max_hit);
}
}
// Mana Regeneration
if ( ch->mana_regen_rate != 0 )
{
if (ch->mana_regen_rate > 0)
regenerate = number_range(1, ch->mana_regen_rate*2)/2;
else if(ch->mana_regen_rate < 0)
regenerate = number_range(1, -ch->mana_regen_rate*2)/2;
if (ch->mana < ch->max_mana)
{
if (ch->mana_regen_rate > 0)
ch->mana = UMIN(ch->mana + regenerate, ch->max_mana);
else if(ch->mana_regen_rate < 0 )
{
ch->mana = UMIN(ch->mana - regenerate, ch->max_mana);
ch->mana = ( ch->mana < 0 ? 0 : ch->mana );
}
}
}
/* For subdued players */
if(ch->position <= POS_STUNNED)
{
ch->hit += number_range(1,2);
update_pos( ch );
}
/* if(ch->position == POS_DEAD && IS_NPC(ch))
extract_char(ch,TRUE); */
if (ch->fight_timer > 0)
ch->fight_timer--;
if(ch->shd_aura_timer > 0) {
ch->shd_aura_timer--;
if(ch->shd_aura_timer == 0) {
REMOVE_BIT(ch->shielded_by,SHD_PROTECT_AURA);
if (skill_table[gsn_protective_aura].msg_off ) {
send_to_char( skill_table[gsn_protective_aura].msg_off, ch );
send_to_char( "\n\r", ch );
}
}
}
if ( IS_NPC(ch) && (ch->pIndexData->vnum == MOB_VNUM_FALCON)
&& ch->leader != NULL && ch->leader->fighting == NULL)
{
act( "$n flies upward and out of sight.", ch, NULL, NULL, TO_ROOM);
extract_char(ch,TRUE);
continue;
}
if (ch->stunned)
{
ch->stunned--;
if (!ch->stunned)
{
send_to_char ("You regain your equilibrium.\n\r", ch);
act ("$n regains $s equilibrium.", ch, NULL, NULL, TO_ROOM);
}
continue;
}
if ((victim = ch->fighting) == NULL || ch->in_room == NULL)
continue;
if (IS_AWAKE (ch) && ch->in_room == victim->in_room)
multi_hit (ch, victim, TYPE_UNDEFINED);
else
stop_fighting (ch, FALSE);
if ((victim = ch->fighting) == NULL)
continue;
if (IS_NPC (ch))
{
if (HAS_TRIGGER (ch, TRIG_FIGHT))
mp_percent_trigger (ch, victim, NULL, NULL, TRIG_FIGHT);
if (HAS_TRIGGER (ch, TRIG_HPCNT))
mp_hprct_trigger (ch, victim);
}
/*
* Fun for the whole family!
*/
check_assist(ch,victim);
}
return;
}
/* for auto assisting */
void check_assist (CHAR_DATA * ch, CHAR_DATA * victim)
{
CHAR_DATA *rch, *rch_next;
for (rch = ch->in_room->people; rch != NULL; rch = rch_next)
{
rch_next = rch->next_in_room;
if (!IS_NPC(rch) && rch->ghost_timer > 0)
continue;
// no more abusing meditation and healing trance!
if ((IS_AWAKE (rch) && (rch->position >= POS_STANDING)) && rch->fighting == NULL)
{
if (IS_NPC(rch) && (IS_AFFECTED(rch,AFF_CHARM))
&& is_same_group(rch,ch) )
{
multi_hit(rch,victim,TYPE_UNDEFINED);
continue;
}
/* quick check for ASSIST_PLAYER */
if (!IS_NPC (ch) && IS_NPC (rch)
&& IS_SET (rch->off_flags, ASSIST_PLAYERS)
&& rch->level + 6 > victim->level)
{
do_emote (rch, "{Rscreams and attacks!{x");
multi_hit (rch, victim, TYPE_UNDEFINED);
continue;
}
/* PCs next */
if (!IS_NPC (ch) || IS_AFFECTED (ch, AFF_CHARM))
{
/* This should be taken care of in is_safe()
if (!IS_NPC (rch) && !IS_NPC (victim)
&& (!is_pkill (rch) || !is_pkill (victim))
&& !IS_SET (victim->act, PLR_TWIT))
continue; */
if (((!IS_NPC (rch) && IS_SET (rch->act, PLR_AUTOASSIST))
|| IS_AFFECTED (rch, AFF_CHARM))
&& is_same_group (ch, rch)
&& !is_safe (rch, victim))
multi_hit (rch, victim, TYPE_UNDEFINED);
continue;
}
/* now check the NPC cases */
if (IS_NPC (ch) && !IS_AFFECTED (ch, AFF_CHARM))
{
if ((IS_NPC (rch) && IS_SET (rch->off_flags, ASSIST_ALL))
|| (IS_NPC (rch) && rch->group && rch->group == ch->group)
|| (IS_NPC (rch) && rch->race == ch->race
&& IS_SET (rch->off_flags, ASSIST_RACE))
|| (IS_NPC (rch) && IS_SET (rch->off_flags, ASSIST_ALIGN)
&& ((IS_GOOD (rch) && IS_GOOD (ch))
|| (IS_EVIL (rch) && IS_EVIL (ch))
|| (IS_NEUTRAL (rch) && IS_NEUTRAL (ch))))
|| (rch->pIndexData == ch->pIndexData
&& IS_SET (rch->off_flags, ASSIST_VNUM)))
{
CHAR_DATA *vch;
CHAR_DATA *target;
int number;
if (number_bits (1) == 0)
continue;
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)
{
do_emote (rch, "{Rscreams and attacks!{x");
multi_hit (rch, target, TYPE_UNDEFINED);
}
}
}
}
}
}
/*
* Do one group of attacks.
*/
void multi_hit (CHAR_DATA * ch, CHAR_DATA * victim, int dt)
{
OBJ_DATA *wield;
int chance; /*,dam;*/
bool falcon_here = FALSE;
bool quick_step;
COOLDOWN_DATA *pcd = NULL;
/* decrement the wait */
if (ch->desc == NULL)
ch->wait = UMAX (0, ch->wait - PULSE_VIOLENCE);
/* decrement the cooldowns */
for ( pcd = ch->cooldowns; pcd != NULL; pcd = pcd->next )
{
if ( pcd->duration > 1 )
pcd->duration--;
else
{
char buf[MSL];
sprintf( buf, "{W%s is no longer on cooldown.{x\n\r",
skill_table[pcd->type].name );
send_to_char( buf , ch );
cooldown_remove( ch, pcd );
}
}
if (ch->desc == NULL)
ch->daze = UMAX (0, ch->daze - PULSE_VIOLENCE);
if (ch == victim)
{
send_to_char("Illegal Target.",ch);
return;
}
quick_step = check_quick_step(ch,victim);
/* no attacks for stunnies -- just a check */
if (ch->position < POS_RESTING)
return;
if (!IS_NPC(ch)
&& (!str_cmp(class_table[ch->class].name,"hunter"))
&& ch->fighting == NULL
&& !IS_SET (ch->plyr, PLAYER_NOFALCON))
{
falcon_load (ch, victim);
falcon_here = TRUE;
}
if (IS_NPC (ch))
{
mob_hit (ch, victim, dt);
return;
}
// RE-init as Zero
ch->pcdata->round_dam = 0;
/* Stance Special Moves */
if (!IS_NPC(ch) && ch->stance[0] > 0 && number_percent() == 1)
{
int stance = ch->stance[0];
if (ch->stance[stance] >= 200 && is_warrior_class(ch->class))
{
special_move(ch,victim);
return;
}
}
if(!IS_NPC(ch) && ch->class == CLASS_MONK && is_affected(ch,gsn_multistrike) && (number_percent()*9 < ch->pcdata->learned[gsn_multistrike] ))
{
check_improve(ch,gsn_multistrike,TRUE,2);
act("$n goes into a {RLIGHTNING{x fury of attacks!\n\r",ch,NULL,victim,TO_ROOM);
send_to_char("You go into a {RLIGHTNING{x fury of attacks!\n\r",ch);
one_hit(ch,victim,gsn_multistrike,FALSE);
if (number_percent() < 90)
{
one_hit(ch,victim,gsn_multistrike,FALSE);
}
if (number_percent() < 70)
{
one_hit(ch,victim,gsn_multistrike,FALSE);
}
if (number_percent() < 50)
{
one_hit(ch,victim,gsn_multistrike,FALSE);
}
}
/* ---------- THE LINE ------ GOING BACK TO REAL COMBAT --BEGIN----- */
// First Hit -- Everyone Gets One
one_hit( ch, victim, dt, FALSE );
if(quick_step) // For normal attack
one_hit(ch,victim,dt, FALSE);
if (ch->fighting != victim)
return;
if (IS_AFFECTED(ch,AFF_HASTE))
one_hit(ch,victim,dt, FALSE);
if (ch->fighting != victim)
return;
do_fear(ch,victim);
// Second Hit
chance = get_skill(ch,gsn_second_attack);
chance -= chance/3;
if (IS_AFFECTED(ch,AFF_SLOW))
chance /= 2;
if(is_affected(ch, gsn_concentration))
{
chance += 5;
}
if (IS_SET(ch->stance_aff,STANCE_AFF_SPEED) && number_percent() <
ch->stance[ch->stance[0]] * 0.5)
{
if (IS_SET(ch->stance_aff,STANCE_AFF_DOUBLE_SPEED))
chance += 25;
else
chance += 15;
}
if ( number_percent( ) < chance )
{
one_hit( ch, victim, dt, FALSE);
if(quick_step) // For 2nd Attack
one_hit(ch,victim,dt, FALSE);
check_improve(ch,gsn_second_attack,TRUE,5);
if ( ch->fighting != victim )
return;
do_fear(ch,victim);
}
if ( ch->fighting != victim || dt == gsn_backstab || dt == gsn_ambush
|| dt == gsn_circle || dt == gsn_twirl || dt == gsn_garrote || dt == gsn_bladedance )
{
//show_damage_short(ch, victim);
return;
}
// Second Dual
chance = get_skill(ch,gsn_dual_wield)/2; //65% with mastery 50% without
if (IS_AFFECTED(ch,AFF_SLOW))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE))
chance *= 2;
if(is_affected(ch, gsn_concentration))
chance += 5;
if (IS_SET(ch->stance_aff,STANCE_AFF_SPEED) && number_percent() <
ch->stance[ch->stance[0]] * 0.5)
{
if (IS_SET(ch->stance_aff,STANCE_AFF_DOUBLE_SPEED))
chance += 25;
else
chance += 15;
}
if (get_eq_char(ch,WEAR_SECONDARY) != NULL
&& ch->pcdata->learned[gsn_second_attack] > 10)
{
if (number_percent( ) < chance)
{
one_hit(ch,victim,dt,TRUE);
check_improve(ch,gsn_dual_wield,TRUE,3);
if (ch->fighting != victim)
return;
do_fear(ch,victim);
}
else
check_improve(ch,gsn_dual_wield,FALSE,3);
}
// Third
chance = get_skill(ch,gsn_third_attack)/2;
if (IS_AFFECTED(ch,AFF_SLOW))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE))
chance *= 2;
if(is_affected(ch, gsn_concentration))
chance += 5;
if (IS_SET(ch->stance_aff,STANCE_AFF_SPEED) && number_percent() <
ch->stance[ch->stance[0]] * 0.5)
{
if (IS_SET(ch->stance_aff,STANCE_AFF_DOUBLE_SPEED))
chance += 25;
else
chance += 15;
}
if ( number_percent( ) < chance )
{
one_hit( ch, victim, dt, FALSE );
if(quick_step) // For 3rd attack
one_hit(ch,victim,dt, FALSE);
check_improve(ch,gsn_third_attack,TRUE,6);
if ( ch->fighting != victim )
return;
do_fear(ch,victim);
}
// Third Dual
chance = get_skill(ch,gsn_dual_wield)/3; //43% with mastery 33% without
if (IS_AFFECTED(ch,AFF_SLOW))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE))
chance *= 2;
if(is_affected(ch, gsn_concentration))
chance += 5;
if (IS_SET(ch->stance_aff,STANCE_AFF_SPEED) && number_percent() <
ch->stance[ch->stance[0]] * 0.5)
{
if (IS_SET(ch->stance_aff,STANCE_AFF_DOUBLE_SPEED))
chance += 25;
else
chance += 15;
}
if (get_eq_char(ch,WEAR_SECONDARY) != NULL
&& ch->pcdata->learned[gsn_third_attack] > 10)
{
if (number_percent( ) < chance)
{
one_hit(ch,victim,dt,TRUE);
check_improve(ch,gsn_dual_wield,TRUE,3);
if (ch->fighting != victim)
return;
do_fear(ch,victim);
}
else
check_improve(ch,gsn_dual_wield,FALSE,3);
}
/* Martial Arts Placed after third attack for more affect */
wield = get_eq_char(ch,WEAR_WIELD);
if( wield == NULL && ch->class == CLASS_MONK
&& is_affected(ch,gsn_martial_arts))
{
int dam = 0;
dam = check_martial_arts(ch,victim);
if (dam != 0)
{
damage ( ch, victim, dam, gsn_martial_arts, DAM_BASH, TRUE, 0 );
check_improve(ch,gsn_martial_arts,TRUE,2);
}
}
if( ch->class == CLASS_NINJA && is_affected(ch,gsn_martial_arts))
{
int dam = 0;
dam = check_martial_arts(ch,victim);
if (dam != 0)
{
damage ( ch, victim, dam*2, gsn_martial_arts, DAM_BASH, TRUE, 0 );
check_improve(ch,gsn_martial_arts,TRUE,2);
}
}
/* Renshai Concentration */
/* if(is_affected(ch, gsn_concentration))
{
chance = get_skill(ch,gsn_concentration)/9;
if (IS_AFFECTED(ch,AFF_SLOW))
chance /= 2;
if (number_percent( ) < chance)
{
if( ch->move > 35 )
{
act("$n skillfully strikes again!",ch,NULL,victim,TO_ROOM);
one_hit(ch,victim,gsn_concentration,TRUE);
check_improve(ch,gsn_concentration,TRUE,6);
ch->move -= 35;
if (ch->fighting != victim)
return;
}
}
else
check_improve(ch,gsn_concentration,FALSE,2);
} */
// Fourth
chance = get_skill(ch,gsn_fourth_attack)/2;
if (IS_AFFECTED(ch,AFF_SLOW))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE))
chance *= 1.75;
if(is_affected(ch, gsn_concentration))
chance -= 5;
if (IS_SET(ch->stance_aff,STANCE_AFF_SPEED) && number_percent() <
ch->stance[ch->stance[0]] * 0.5)
{
if (IS_SET(ch->stance_aff,STANCE_AFF_DOUBLE_SPEED))
chance += 25;
else
chance += 15;
}
if(quick_step)
chance += 10;
if ( number_percent() < chance )
{
one_hit( ch, victim, dt, FALSE );
if(quick_step) // For 4rd attack
one_hit(ch,victim,dt, FALSE);
check_improve(ch,gsn_fourth_attack,TRUE,6);
if (ch->fighting != victim )
return;
do_fear(ch,victim);
}
// Fourth Dual
chance = get_skill(ch,gsn_dual_wield);
if(chance <= 100)
chance /= 5; // 25% without
else
chance /= 4; //32% with mastery
if (IS_AFFECTED(ch,AFF_SLOW))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE))
chance *= 1.5;
if(is_affected(ch, gsn_concentration))
chance += 5;
if (IS_SET(ch->stance_aff,STANCE_AFF_SPEED) && number_percent() <
ch->stance[ch->stance[0]] * 0.5)
{
if (IS_SET(ch->stance_aff,STANCE_AFF_DOUBLE_SPEED))
chance += 25;
else
chance += 15;
}
if (get_eq_char(ch,WEAR_SECONDARY) != NULL
&& ch->pcdata->learned[gsn_fourth_attack] > 10)
{
if (number_percent( ) < chance)
{
one_hit(ch,victim,dt,TRUE);
check_improve(ch,gsn_dual_wield,TRUE,6);
if (ch->fighting != victim)
return;
do_fear(ch,victim);
}
else
check_improve(ch,gsn_dual_wield,FALSE,5);
}
// Fifth Hit
chance = get_skill(ch,gsn_fifth_attack)/2;
if (IS_AFFECTED(ch,AFF_SLOW))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE))
chance *= 1.75;
if (IS_SET(ch->stance_aff,STANCE_AFF_SPEED) && number_percent() <
ch->stance[ch->stance[0]] * 0.5)
{
if (IS_SET(ch->stance_aff,STANCE_AFF_DOUBLE_SPEED))
chance += 25;
else
chance += 15;
}
if ( number_percent() < chance )
{
one_hit( ch, victim, dt, FALSE );
check_improve(ch,gsn_fifth_attack,TRUE,6);
if (ch->fighting != victim )
return;
do_fear(ch,victim);
}
// Fourth Dual
chance = get_skill(ch,gsn_dual_wield);
if(chance <= 100)
chance /= 9; // 12% without
else
chance /= 6; //20% with mastery
if (IS_AFFECTED(ch,AFF_SLOW))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE))
chance *= 1.5;
if (IS_SET(ch->stance_aff,STANCE_AFF_SPEED) && number_percent() <
ch->stance[ch->stance[0]] * 0.5)
{
if (IS_SET(ch->stance_aff,STANCE_AFF_DOUBLE_SPEED))
chance += 25;
else
chance += 15;
}
if (get_eq_char(ch,WEAR_SECONDARY) != NULL
&& ch->pcdata->learned[gsn_fifth_attack] > 10)
{
if (number_percent( ) < chance)
{
one_hit(ch,victim,dt,TRUE);
check_improve(ch,gsn_dual_wield,TRUE,6);
if (ch->fighting != victim)
return;
do_fear(ch,victim);
}
else
check_improve(ch,gsn_dual_wield,FALSE,5);
}
// Sixth Hit
chance = get_skill(ch,gsn_sixth_attack)/2;
if (IS_AFFECTED(ch,AFF_SLOW))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE))
chance *= 1.75;
if (IS_SET(ch->stance_aff,STANCE_AFF_SPEED) && number_percent() <
ch->stance[ch->stance[0]] * 0.5)
{
if (IS_SET(ch->stance_aff,STANCE_AFF_DOUBLE_SPEED))
chance += 25;
else
chance += 15;
}
if ( number_percent() < chance )
{
one_hit( ch, victim, dt, FALSE );
check_improve(ch,gsn_sixth_attack,TRUE,6);
if (ch->fighting != victim )
return;
do_fear(ch,victim);
}
// Fifth Dual
chance = get_skill(ch,gsn_dual_wield);
if(chance <= 100)
chance = 0; // 0 without
else
chance /= 9; //18% with mastery
if (chance != 0)
{
if (IS_AFFECTED(ch,AFF_SLOW))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE))
chance *= 1.5;
if (IS_SET(ch->stance_aff,STANCE_AFF_SPEED) && number_percent() <
ch->stance[ch->stance[0]] * 0.5)
{
if (IS_SET(ch->stance_aff,STANCE_AFF_DOUBLE_SPEED))
chance += 25;
else
chance += 15;
}
if (get_eq_char(ch,WEAR_SECONDARY) != NULL
&& ch->pcdata->learned[gsn_sixth_attack] > 10)
{
if (number_percent( ) < chance)
{
one_hit(ch,victim,dt,TRUE);
check_improve(ch,gsn_dual_wield,TRUE,6);
if (ch->fighting != victim)
return;
do_fear(ch,victim);
}
else
check_improve(ch,gsn_dual_wield,FALSE,5);
}
}
if (falcon_here == TRUE)
multi_hit( ch->pet, victim, TYPE_UNDEFINED );
/* ---------- THE LINE ------ GOING BACK TO REAL COMBAT --END----- */
/* Damage show
if(wield != NULL)
{
sprintf(buf,"{BYou attack $N with $p {W[%d]{B times for {y[%d]{B damage!{x", count, ch->pcdata->round_dam);
sprintf(buf2,"{B$n attacks you with $p {W[%d]{B times for {y[%d]{B damage!{x", count, ch->pcdata->round_dam);
}
else
{
sprintf(buf,"{BYou attack $N with your fists {W[%d]{B times for {y[%d]{B damage!{x", count, ch->pcdata->round_dam);
sprintf(buf2,"{B$n attacks you with your fists {W[%d]{B times for {y[%d]{B damage!{x", count, ch->pcdata->round_dam);
}
if (!IS_NPC(ch) && IS_SET(ch->act, PLR_SHORT_COMBAT))
act( buf, ch, wield, victim, TO_CHAR );
if (!IS_NPC(victim) && IS_SET(victim->act, PLR_SHORT_COMBAT))
act( buf2, ch, wield, victim, TO_VICT );
*/
show_damage_short(ch, victim);
/*
if (!IS_NPC(ch) && IS_SET(ch->act, PLR_SHORT_COMBAT))
{
rounddam = 0;
rounddam = ch->pcdata->round_dam;
sprintf(buf,"{BAttacking: {W$N {BDamage Done: {W%d{x{x",rounddam);
act( buf, ch, NULL, victim, TO_CHAR );
}
if (!IS_NPC(victim) && IS_SET(victim->act, PLR_SHORT_COMBAT))
{
rounddam = 0;
rounddam = victim->pcdata->round_dam;
sprintf(buf2,"{BAttacked by: {W$n {BDamage Taken: {W%d{x{x",rounddam);
act( buf2, ch, NULL, victim, TO_CHAR );
}
*/
return;
}
void show_damage_short(CHAR_DATA *ch, CHAR_DATA *victim)
{
char buf[MSL];
char buf2[MSL];
if (!IS_NPC(ch) && IS_SET(ch->act, PLR_SHORT_COMBAT))
{
rounddam = 0;
rounddam = ch->pcdata->round_dam;
sprintf(buf,"{BAttacking: {W$N {BDamage Done: {W%d{x{x",rounddam);
act( buf, ch, NULL, victim, TO_CHAR );
}
if (!IS_NPC(victim) && IS_SET(victim->act, PLR_SHORT_COMBAT))
{
rounddam = 0;
rounddam = ch->pcdata->round_dam;
sprintf(buf2,"{BAttacked by: {W$n {BDamage Taken: {W%d{x{x",rounddam);
act( buf2, ch, NULL, victim, TO_VICT );
}
}
/* procedure for all mobile attacks */
void mob_hit (CHAR_DATA * ch, CHAR_DATA * victim, int dt)
{
int chance, number;
CHAR_DATA *vch, *vch_next;
char buf[MSL];
char buf2[MSL];
int rounddam = 0;
if (ch->stunned)
return;
// RE-init as Zero
ch->pIndexData->round_dam = 0;
// First Hit -- Everyone Gets One
one_hit( ch, victim, dt, FALSE );
if (ch->fighting != victim)
return;
/* Area attack -- BALLS nasty! */
if (IS_SET (ch->off_flags, OFF_AREA_ATTACK))
{
for (vch = ch->in_room->people; vch != NULL; vch = vch_next)
{
vch_next = vch->next;
if ((vch != victim && vch->fighting == ch))
one_hit (ch, vch, dt, FALSE);
}
}
if (IS_AFFECTED(ch,AFF_HASTE) || (IS_SET (ch->off_flags, OFF_FAST) && !IS_AFFECTED (ch, AFF_SLOW)))
one_hit(ch,victim,dt, FALSE);
if (ch->fighting != victim)
return;
chance = get_skill(ch,gsn_second_attack)/2;
if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET (ch->off_flags, OFF_FAST))
chance /= 2;
if ( number_percent( ) < chance )
{
one_hit( ch, victim, dt, FALSE );
if ( ch->fighting != victim )
return;
}
if ( ch->fighting != victim || dt == gsn_backstab || dt == gsn_ambush
|| dt == gsn_circle || dt == gsn_twirl || dt == gsn_bladedance)
return;
chance = get_skill(ch,gsn_dual_wield)/2;
if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET (ch->off_flags, OFF_FAST))
chance /= 2;
if (get_eq_char(ch,WEAR_SECONDARY) != NULL)
{
if (number_percent( ) < chance)
{
one_hit(ch,victim,dt,TRUE);
if (ch->fighting != victim)
return;
}
}
chance = get_skill(ch,gsn_third_attack)/4;
if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET (ch->off_flags, OFF_FAST))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE) || (IS_SET (ch->off_flags, OFF_FAST) && !IS_AFFECTED (ch, AFF_SLOW)))
chance *= 2;
if ( number_percent( ) < chance )
{
one_hit( ch, victim, dt, FALSE );
if ( ch->fighting != victim )
return;
}
chance = get_skill(ch,gsn_dual_wield)/4;
if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET (ch->off_flags, OFF_FAST))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE)|| (IS_SET (ch->off_flags, OFF_FAST) && !IS_AFFECTED (ch, AFF_SLOW)))
chance *= 2;
if (get_eq_char(ch,WEAR_SECONDARY) != NULL)
{
if (number_percent( ) < chance)
{
one_hit(ch,victim,dt,TRUE);
if (ch->fighting != victim)
return;
}
}
chance = get_skill(ch,gsn_fourth_attack)/5;
if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET (ch->off_flags, OFF_FAST))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE) || (IS_SET (ch->off_flags, OFF_FAST) && !IS_AFFECTED (ch, AFF_SLOW)))
chance *= 2;
if ( number_percent() < chance )
{
one_hit( ch, victim, dt, FALSE );
if (ch->fighting != victim )
return;
}
chance = get_skill(ch,gsn_dual_wield)/5;
if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET (ch->off_flags, OFF_FAST))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE) || (IS_SET (ch->off_flags, OFF_FAST) && !IS_AFFECTED (ch, AFF_SLOW)))
chance *= 2;
if (get_eq_char(ch,WEAR_SECONDARY) != NULL)
{
if (number_percent( ) < chance)
{
one_hit(ch,victim,dt,TRUE);
if (ch->fighting != victim)
return;
}
}
chance = get_skill(ch,gsn_fifth_attack)/5;
if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET (ch->off_flags, OFF_FAST))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE) || (IS_SET (ch->off_flags, OFF_FAST) && !IS_AFFECTED (ch, AFF_SLOW)))
chance *= 2;
if ( number_percent() < chance )
{
one_hit( ch, victim, dt, FALSE );
if (ch->fighting != victim )
return;
}
chance = get_skill(ch,gsn_dual_wield)/5;
if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET (ch->off_flags, OFF_FAST))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE) || (IS_SET (ch->off_flags, OFF_FAST) && !IS_AFFECTED (ch, AFF_SLOW)))
chance *= 2;
if (get_eq_char(ch,WEAR_SECONDARY) != NULL)
{
if (number_percent( ) < chance)
{
one_hit(ch,victim,dt,TRUE);
if (ch->fighting != victim)
return;
}
}
chance = get_skill(ch,gsn_sixth_attack)/5;
if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET (ch->off_flags, OFF_FAST))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE) || (IS_SET (ch->off_flags, OFF_FAST) && !IS_AFFECTED (ch, AFF_SLOW)))
chance *= 2;
if ( number_percent() < chance )
{
one_hit( ch, victim, dt, FALSE );
if (ch->fighting != victim )
return;
}
chance = get_skill(ch,gsn_dual_wield)/6;
if (IS_AFFECTED(ch,AFF_SLOW) && !IS_SET (ch->off_flags, OFF_FAST))
chance /= 2;
if(IS_AFFECTED(ch,AFF_HASTE) || (IS_SET (ch->off_flags, OFF_FAST) && !IS_AFFECTED (ch, AFF_SLOW)))
chance *= 2;
if (get_eq_char(ch,WEAR_SECONDARY) != NULL)
{
if (number_percent( ) < chance)
{
one_hit(ch,victim,dt,TRUE);
if (ch->fighting != victim)
return;
}
}
rounddam = 0;
if (!IS_NPC(ch))
rounddam = ch->pcdata->round_dam;
else
rounddam = ch->pIndexData->round_dam;
rounddam = 0;
sprintf(buf,"{BAttacking: {W$N {BDamage Done: {W%d{x{x",rounddam);
if (!IS_NPC(ch))
rounddam = ch->pcdata->round_dam;
else
rounddam = ch->pIndexData->round_dam;
sprintf(buf2,"{BAttacked by: {W$n {BDamage Taken: {W%d{x{x",rounddam);
if (!IS_NPC(ch) && IS_SET(ch->act, PLR_SHORT_COMBAT))
{
act( buf, ch, NULL, victim, TO_CHAR );
}
if (!IS_NPC(victim) && IS_SET(victim->act, PLR_SHORT_COMBAT))
{
act( buf2, ch, NULL, victim, TO_VICT );
}
/* oh boy! Fun stuff! */
if (ch->wait > 0)
return;
number = number_range (0, 2);
/* if (number == 1 && IS_SET (ch->act, ACT_MAGE))
{
{ mob_cast_mage(ch,victim); return; } ;
}
if (number == 2 && IS_SET (ch->act, ACT_CLERIC))
{
{ mob_cast_cleric(ch,victim); return; } ;
} */
/* now for the skills */
number = number_range (0, 8);
switch (number)
{
case (0):
if (IS_SET (ch->off_flags, OFF_BASH))
do_bash (ch, "");
break;
case (1):
if (IS_SET (ch->off_flags, OFF_BERSERK) && !IS_AFFECTED (ch, AFF_BERSERK))
do_berserk (ch, "");
break;
case (2):
if (IS_SET (ch->off_flags, OFF_DISARM)
|| (get_weapon_sn (ch) != gsn_hand_to_hand
&& (IS_SET (ch->act, ACT_WARRIOR)
|| IS_SET (ch->act, ACT_VAMPIRE)
|| IS_SET (ch->act, ACT_THIEF))))
do_disarm (ch, "");
break;
case (3):
if (IS_SET (ch->off_flags, OFF_KICK))
do_kick (ch, "");
break;
case (4):
if (IS_SET (ch->off_flags, OFF_KICK_DIRT))
do_dirt (ch, "");
break;
case (5):
if (IS_SET (ch->off_flags, OFF_TAIL))
{
/* do_tail(ch,"") */ ;
}
break;
case (6):
if (IS_SET (ch->off_flags, OFF_TRIP))
do_trip (ch, "");
break;
case (7):
if (IS_SET (ch->off_flags, OFF_CRUSH))
{
/* do_crush(ch,"") */ ;
}
break;
case (8):
if (IS_SET (ch->off_flags, OFF_BACKSTAB))
{
do_backstab (ch, "");
}
}
}
/*
* Hit one guy once.
*/
void one_hit (CHAR_DATA * ch, CHAR_DATA * victim, int dt, bool secondary)
{
OBJ_DATA *wield,*second;
int victim_ac;
int thac0;
int thac0_00;
int thac0_32;
int dam = 0;
int diceroll;
int sn, skill;
int dam_type,wdam;
bool result;
bool show = TRUE;
int adice,bdice;
//char buf [MAX_STRING_LENGTH];
sn = -1;
/* just in case */
if (victim == ch || ch == NULL || victim == NULL)
return;
if (!IS_NPC(ch) && !IS_NPC(victim) && !is_safe(ch, victim) && !is_safe(victim,ch)
&& ch != victim) {
if(!IN_ARENA(ch) && !IN_ARENA(victim))
{
ch->fight_timer = pktimer;
victim->fight_timer = pktimer;
}
}
/*
* Can't beat a dead char!
* Guard against weird room-leavings.
*/
if (victim->position == POS_DEAD || (IS_SET(victim->plyr,PLAYER_GHOST) && !IS_NPC(ch)) || ch->in_room != victim->in_room)
return;
ch->fighting = victim;
/*
* Figure out the type of `damage message.
* if secondary == true, use the second weapon.
*/
if (!secondary)
wield = get_eq_char (ch, WEAR_WIELD);
else
wield = get_eq_char (ch, WEAR_SECONDARY);
if (dt == TYPE_UNDEFINED)
{
dt = TYPE_HIT;
if (wield != NULL && wield->item_type == ITEM_WEAPON)
dt += wield->value[3];
else
dt += ch->dam_type;
}
if (dt < TYPE_HIT)
if (wield != NULL)
dam_type = attack_table[wield->value[3]].damage;
else
dam_type = attack_table[ch->dam_type].damage;
else
dam_type = attack_table[dt - TYPE_HIT].damage;
if (dam_type == -1 || dt == gsn_kick)
dam_type = DAM_BASH;
/* get the weapon skill */
sn = get_weapon_sn (ch);
skill = 20 + get_weapon_skill (ch, sn);
/*
* Calculate to-hit-armor-class-0 versus armor.
*/
if (IS_NPC (ch))
{
thac0_00 = 20;
thac0_32 = -4; /* as good as a thief */
if (IS_SET (ch->act, ACT_VAMPIRE))
thac0_32 = -20;
else if (IS_SET (ch->act, ACT_DRUID))
thac0_32 = 0;
else if (IS_SET (ch->act, ACT_RANGER))
thac0_32 = -4;
else if (IS_SET (ch->act, ACT_WARRIOR))
thac0_32 = -10;
else if (IS_SET (ch->act, ACT_THIEF))
thac0_32 = -4;
else if (IS_SET (ch->act, ACT_CLERIC))
thac0_32 = 2;
else if (IS_SET (ch->act, ACT_MAGE))
thac0_32 = 6;
}
else
{
thac0_00 = class_table[ch->class].thac0_00;
thac0_32 = class_table[ch->class].thac0_32;
}
thac0 = interpolate (ch->level, thac0_00, thac0_32);
if (thac0 < 0)
thac0 = thac0 / 2;
if (thac0 < -5)
thac0 = -5 + (thac0 + 5) / 2;
thac0 -= GET_HITROLL(ch) * skill / 100;
thac0 += 5 * (100 - skill) / 100;
if (dt == gsn_backstab)
thac0 -= 10 * (100 - get_skill (ch, gsn_backstab));
if (dt == gsn_garrote)
thac0 -= 10 * (100 - get_skill (ch, gsn_garrote));
if (dt == gsn_ambush)
thac0 -= 10 * (100 - get_skill (ch, gsn_ambush));
if (dt == gsn_bladedance)
thac0 -= 10* (100 - get_skill (ch, gsn_bladedance));
if (dt == gsn_circle)
thac0 -= 10 * (100 - get_skill (ch, gsn_circle));
if (dt == gsn_twirl)
thac0 -= 10 * (100 - get_skill (ch, gsn_twirl));
if (dt == gsn_vital_hit)
thac0 -= 15 * (100 - get_skill (ch, gsn_vital_hit));
switch (dam_type)
{
case (DAM_PIERCE): victim_ac = GET_AC (victim, AC_PIERCE) / 10; break;
case (DAM_BASH): victim_ac = GET_AC (victim, AC_BASH) / 10; break;
case (DAM_SLASH): victim_ac = GET_AC (victim, AC_SLASH) / 10; break;
default: victim_ac = GET_AC (victim, AC_EXOTIC) / 10; break;
};
/*
************* Hit Chance affected by AC *************
*/
if (victim_ac < -15 && victim_ac > -31)
victim_ac = (victim_ac + 15) / 5 - 15;
else if (victim_ac < -30 && victim_ac > -41)
victim_ac = (victim_ac + 15) / 5 - 20;
else if (victim_ac < -40 && victim_ac > -51)
victim_ac = (victim_ac + 15) / 5 - 25;
else if (victim_ac < -50 && victim_ac > -61)
victim_ac = (victim_ac + 15) / 5 - 30;
else if (victim_ac < -60 && victim_ac > -71)
victim_ac = (victim_ac + 15) / 5 - 35;
else if (victim_ac < -70 && victim_ac > -81)
victim_ac = (victim_ac + 15) / 5 - 40;
else if (victim_ac < -80 && victim_ac > -91)
victim_ac = (victim_ac + 15) / 5 - 45;
else if (victim_ac < -90 && victim_ac > -101)
victim_ac = (victim_ac + 15) / 5 - 50;
else if (victim_ac < -100 && victim_ac > -111)
victim_ac = (victim_ac + 15) / 5 - 55;
else if (victim_ac < -110 && victim_ac > -121)
victim_ac = (victim_ac + 15) / 5 - 60;
else if (victim_ac < -120 && victim_ac > -131)
victim_ac = (victim_ac + 15) / 5 - 65;
else if (victim_ac < -130 && victim_ac > -141)
victim_ac = (victim_ac + 15) / 5 - 70;
else if (victim_ac < -140)
victim_ac = (victim_ac + 15) / 5 - 75;
/*
*************** Added in, 1/12/05 **************
*/
/* NIGHTSTALKER ABILITY added by Dusk */
if ( IS_SET( ch->ability_lich, ABILITY_LICH_NIGHTSTALKER)
&& (vam_str[time_info.hour] != 0) )
{
// Day time
if ((time_info.hour > 6) && (time_info.hour < 18))
{
victim_ac += ((victim_ac * vam_str[time_info.hour]) / 10);
}
else // Night time
{
victim_ac -= ((victim_ac * vam_str[time_info.hour]) / 10);
}
}
/* END OF NIGHTSTALKER ABILITY BY DUSK */
if (!can_see (ch, victim))
victim_ac -= 10;
if (victim->position < POS_FIGHTING)
victim_ac += 4;
if (victim->position < POS_RESTING)
victim_ac += 6;
/* Lets try this... */
/* Damage show
if(IS_NPC(ch) && !IS_NPC(victim) && IS_SET(victim->act,PLR_SHORT_COMBAT))
show = FALSE;
else if(!IS_NPC(ch) && IS_SET(ch->act, PLR_SHORT_COMBAT))
show = FALSE;
else
*/
show = TRUE;
/*
* 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, dam_type, show, 0);
tail_chain ();
if (!is_safe(ch,victim)) {
improve_stance(ch);
}
return;
}
/*
* Hit.
* Calc damage.
*/
if (IS_NPC (ch) && (!ch->pIndexData->new_format || wield == NULL))
if (!ch->pIndexData->new_format)
{
dam = number_range (ch->level / 2, ch->level * 3 / 2);
if (wield != NULL)
dam += dam / 2;
}
else
{
dam = dice (ch->damage[DICE_NUMBER], ch->damage[DICE_TYPE]);
}
else
{
if (sn != -1)
check_improve (ch, sn, TRUE, 5);
if (wield != NULL)
{
if (wield->clan)
{
float adlev, inclev;
int cntr;
adlev = 8;
inclev = .01;
for (cntr = 0; cntr <= ch->level; cntr++)
{
adlev += .57;
adlev += inclev;
inclev += .005;
}
cntr = (int) adlev;
dam = dice (cntr / 3, 3) * skill / 100;
}
else
{
adice = wield->value[1];
bdice = wield->value[2];
if (wield->pIndexData->new_format)
bdice *= (skill/100);
else
{
adice *= (skill/100);
bdice *= (skill/100);
}
switch (wield->value[0])
{
case(WEAPON_SWORD):
adice += number_range(-2,2);
bdice += number_range(-2,2);
break;
case(WEAPON_DAGGER):
adice += number_range(-3,2);
bdice += number_range(-3,2);
break;
case(WEAPON_SPEAR):
adice += number_range(-4,4);
bdice += number_range(-4,4);
break;
case(WEAPON_MACE):
adice += number_range(-2,2);
bdice += number_range(-2,2);
break;
case(WEAPON_AXE):
adice += number_range(-3,3);
bdice += number_range(-3,3);
break;
case(WEAPON_FLAIL):
adice += number_range(-2,2);
bdice += number_range(-2,2);
break;
case(WEAPON_WHIP):
adice += number_range(-2,1);
bdice += number_range(-2,1);
break;
case(WEAPON_POLEARM):
adice += number_range(-2,2);
bdice += number_range(-2,2);
break;
case(WEAPON_EXOTIC):
adice += number_range(-3,1);
bdice += number_range(-3,1);
break;
default: break;
}
dam = dice(adice,bdice);
}
if (get_eq_char (ch, WEAR_SHIELD) == NULL) /* no shield = more */
dam = dam * 11 / 10;
/* If weapon is 15 levels or more higher than ch */
if (wield->level - ch->level >= 15)
dam = (dam*8)/10;
else if (wield->level - ch->level >= 5)
dam = (dam*9)/10;
// Vorpal Weapons
/* Chance for Vorpal hit, if miss, then sharp */
if (IS_WEAPON_STAT (wield, WEAPON_VORPAL)) {
int percent;
if ((percent = number_percent ()) <= (skill / 10))
dam = 2 * dam + (dam * 2 * percent / 50);
else if ((percent = number_percent ()) <= (skill / 8))
dam = 2 * dam + (dam * 2 * percent / 100);
}
// Sharp Weapons
else if (IS_WEAPON_STAT (wield, WEAPON_SHARP)) {
int percent;
if ((percent = number_percent ()) <= (skill / 8))
dam = 2 * dam + (dam * 2 * percent / 100);
}
if(IS_WEAPON_STAT(wield,WEAPON_TWO_HANDS)) {
int percent;
percent = number_percent()/2;
if(number_percent() < 15)
{
act("You swing $p in a high arc and come down on $N!",ch,wield,victim,TO_CHAR);
act("$n swings $p in a high arc and comes down on $N!",ch,wield,victim,TO_NOTVICT);
dam = 1.5 * dam + (dam * 5 * percent / 75);
}
else
{
dam = 1.5 * dam + (dam * 1.5 * percent / 90);
}
}
}
else
{
if(((ch->class != CLASS_MONK) && (ch->class != CLASS_NINJA)) || (!is_affected(ch,gsn_martial_arts)))
dam = number_range (1 + 4 * skill / 100, 2 * ch->level / 3 * skill / 100);
else
{
int sides, ndice;
ndice = 4; //12.5
sides = 5;
if (ch->class == CLASS_MONK && ch->level > 100) {
ndice = 8; //100
sides = 16;
}
else if (ch->class == CLASS_MONK && ch->level > 80) {
ndice = 8; //90
sides = 15;
}
else if (ch->class == CLASS_NINJA && ch->level > 100) {
ndice = 8; //90
sides = 14;
}
else if (ch->level > 70) {
ndice = 7; //70
sides = 14;
}
else if (ch->level > 60) {
ndice = 7; //63
sides = 11;
}
else if (ch->level > 40) {
ndice = 6; //44
sides = 8;
}
else if (ch->level > 20) {
ndice = 5; //22.5
sides = 7;
}
dam = number_range (ndice, ndice*sides);
// dam = dam - 75;
/* New Vital Hit By Dusk */
if(has_skill(ch,gsn_vital_hit) && (is_affected(ch,gsn_martial_arts)))
{
if((get_skill(ch,gsn_vital_hit) / 10) > number_percent( ))
{
check_improve(ch,gsn_vital_hit,TRUE, 3);
int location;
location = number_range(0,6);
dt = gsn_vital_hit;
AFFECT_DATA af;
if ( location == 0 || location == 2 || location == 4 || location == 6 )
{
send_to_char("{MYour precise movements have granted a vital hit!{x\n\r",ch);
send_to_char("{CTheir precise movements targeted a vital area!{x\n\r",victim);
if (location == 0)
dam *= 1.10;
if (location == 2)
dam *= 1.20;
if (location == 4)
dam *= 1.30;
if (location == 6)
dam *= 1.40;
}
else if ( location == 1 && !IS_AFFECTED(victim,AFF_BLIND) )
{
if ( !IS_NPC(victim) )
{
if ( ( number_percent() + get_curr_stat(victim,STAT_DEX)*3 + victim->pcdata->focus[COMBAT_AGILITY] )
< ( number_percent() + get_skill(ch,gsn_vital_hit) ) )
{
send_to_char("{MYour precise movements target their eyes!{x\n\r",ch);
send_to_char("{CTheir precise movements targeted your eyes!{x\n\r",victim);
af.where = TO_AFFECTS;
af.type = gsn_vital_hit;
af.level = ch->level;
af.duration = 1;
af.location = APPLY_HITROLL;
af.modifier = ch->level/2 * -1;
af.bitvector = AFF_BLIND;
affect_to_char (victim, &af);
one_hit(ch,victim,gsn_vital_hit,FALSE);
}
}
else if ( ( number_percent() < ( number_percent() + get_skill(ch,gsn_vital_hit) ) ) && IS_NPC(victim) )
{
af.where = TO_AFFECTS;
af.type = gsn_vital_hit;
af.level = ch->level;
af.duration = 2;
af.location = APPLY_HITROLL;
af.modifier = ch->level;
af.bitvector = AFF_BLIND;
affect_to_char (victim, &af);
one_hit(ch,victim,gsn_vital_hit, FALSE);
}
else
{
send_to_char("{mThey were able to dodge your vital eye strike!{x\n\r",ch);
send_to_char("{mYou dodged their vital eye strike!{x\n\r",victim);
dam *= .75;
}
}
else if ( location == 1 && IS_AFFECTED(victim,AFF_BLIND) )
{
send_to_char("{MTheir eyes have already been blinded!{x\n\r",ch);
send_to_char("{CTheir precise movements inflict pain upon your eyes!{x\n\r",victim);
dam *= 1.1;
}
else if ( location == 3 )
{
if ( !IS_NPC(victim) )
{
if ( ( number_percent() + get_curr_stat(victim,STAT_CON)*2 + get_curr_stat(victim,STAT_DEX)*2 +
( victim->pcdata->focus[COMBAT_TOUGHNESS] + victim->pcdata->focus[COMBAT_AGILITY] ) /2 ) <
( number_percent() + get_skill(ch,gsn_vital_hit) ) )
{
send_to_char("{MYour precise movements targets their hamstrings!{x\n\r",ch);
send_to_char("{CTheir precise movements targeted your hamstrings!{x\n\r",victim);
dam *= 1.15;
DAZE_STATE (victim, PULSE_VIOLENCE);
}
}
else if ( IS_NPC(victim) )
{
send_to_char("{MYour precise movements targets their hamstrings!{x\n\r",ch);
dam *= 1.15;
DAZE_STATE (victim, 2 *PULSE_VIOLENCE);
}
else
{
send_to_char("{mYour movements did not cause enough pain on their hamstrings!{x\n\r",ch);
send_to_char("{mYour agility and toughness prevailed over their hamstring attempt!{x\n\r",ch);
dam *= .75;
}
}
else if ( location == 5 )
{
if ( !IS_NPC(victim) )
{
if ( ( ( number_percent() + get_curr_stat(victim,STAT_CON)*3 + victim->pcdata->focus[COMBAT_TOUGHNESS] )
< ( number_percent() + get_skill(ch,gsn_vital_hit) ) ) && !IS_NPC(victim) )
{
send_to_char("{MYour precise movements targets their solarplexis!{x\n\r",ch);
send_to_char("{CTheir precise movements targeted your solarplexis!{x\n\r",victim);
dam *= .75;
victim->stunned = 1;
act("{(You are stunned, and have trouble getting back up!{x",ch,NULL,victim,TO_VICT);
act("{.$N is stunned by your vital hit!{x",ch,NULL,victim,TO_CHAR);
}
}
else if ( IS_NPC(victim) )
{
send_to_char("{MYour precise movements targets their solarplexis{x\n\r",ch);
dam *= 1.50;
victim->stunned = 1;
act("{.$N is stunned by your vital hit!{x",ch,NULL,victim,TO_CHAR);
}
else
{
send_to_char("{mYour vital strike hits their solarplexis but has no effect!{x\n\r",ch);
send_to_char("{mTheir vital strike hits your solarplexis but bounces off!{x\n\r",ch);
dam *= .75;
}
}
}
else
check_improve(ch,gsn_vital_hit,FALSE,1);
}
}
}
}
/*
Crusader Sunder Armor Class Ability by Dusk Added 10/10/08
if ( !IS_NPC(ch) && ch->class == CLASS_CRUSADER && IS_SET(ch->ability_crusader,ABILITY_CRUSADER_SUNDER) )
{
AFFECT_DATA af,*paf;
int acmod=0,factor=0, abonus=0, hfactor=0, sfactor=0,acvic=0,ac=0,hf=0,fbonus=0,hbonus=0,tosunder = 0;
int sunderamount = 0;
factor = ( get_skill ( ch, gsn_second_attack ) + get_skill ( ch, gsn_third_attack ) +
get_skill ( ch, gsn_fourth_attack ) + get_skill ( ch, gsn_fifth_attack ) ) / 2;
abonus = ( ch->alignment - victim->alignment ) / 100;
hfactor = GET_HITROLL (ch);
sfactor = ( ( victim->saving_throw * -1 ) * get_curr_stat( victim, STAT_WIS ) ) / 10;
acvic = ( ( GET_AC( victim, AC_PIERCE) + GET_AC( victim, AC_BASH ) + GET_AC( victim, AC_SLASH ) +
GET_AC( victim, AC_EXOTIC) ) * -1 ) / 4;
hf = hfactor + factor + number_percent();
ac = ( acvic * .75 + number_percent() ) / 2;
abonus = ( abonus < 0 ? 0 : abonus );
tosunder = ( hf <= ac ? ( ac - hf ) / 25 : ( ( hf - ac ) / 10 ) *-1 );
acmod = abonus + ( ( hfactor - sfactor ) / 10 ) + number_range( 1, 10 );
acmod = ( acmod < 0 ? 0 : acmod );
if ( !IS_NPC(victim) )
{
fbonus = ch->pcdata->focus[MAGIC_ABILITY] - victim->pcdata->focus[MAGIC_DEFENSE];
hbonus = ch->pcdata->focus[COMBAT_AGILITY] - victim->pcdata->focus[COMBAT_DEFENSE];
hbonus = ( hbonus < 0 ? 0 : hbonus );
fbonus = ( fbonus < 0 ? 0 : hbonus );
tosunder = tosunder + hbonus;
acmod = abonus + fbonus + ( ( hfactor - sfactor ) / 10 ) + number_range( 1, 10 );
}
for ( paf = victim->affected; paf != NULL ; paf = paf->next )
{
switch( paf->location )
{
case APPLY_AC:
sunderamount += paf->modifier;
break;
}
}
if ( ( ( tosunder + number_percent() ) >= number_percent() ) && ( ch->mana >= acmod/5 ) && ( acmod != 0 )
&& ( sunderamount < ( ( ( acvic * -1 - sunderamount ) * -1) / 2 ) ) )
{
sprintf(buf,"{yYour faith favors you! Your sunder raises their ac by {Y%d{y!{x\n\r",acmod);
send_to_char( buf, ch );
ch->mana -= ( acmod < 2 && acmod >= 0 ? 1 : acmod/2 );
dam *= 4;
af.where = TO_AFFECTS;
af.type = gsn_sunder;
af.level = ch->level;
af.duration = 1;
af.location = APPLY_AC;
af.modifier = acmod;
af.bitvector = 0;
affect_join( victim, &af );
}
}
End of new Crusader Ability Sunder by Dusk */
/*
* Bonuses.
*/
/* Start of Nightstalker Ability by Dusk */
if ( IS_SET( ch->ability_lich, ABILITY_LICH_NIGHTSTALKER ) && (vam_str[time_info.hour] != 0 ) )
{
if ((time_info.hour > 6) && (time_info.hour < 18))
{
dam -= ((dam * vam_str[time_info.hour]) / 10);
}
else
{
dam += ((dam * vam_str[time_info.hour]) / 10);
}
}
/* End of Nightstalker Ability by Dusk */
// Add Bonuses here
if (ch->class == CLASS_HIGHLANDER && get_skill(ch, gsn_blademastery) > 0)
{
int hroll;
hroll = number_percent ();
if (hroll*7 <= get_skill (ch, gsn_blademastery))
{
check_improve (ch, gsn_blademastery, TRUE, 3);
dt = gsn_blademastery;
dam_type = DAM_SLASH;
if(number_percent() < 30)
{
hroll = number_range(2,ch->pcdata->power[POWER_LEVEL]);
if(hroll > 2) {
hroll *= 6/7;
}
dam *= hroll;
}
}
}
dam = add_bonuses( ch, victim, dam, dt, dam_type );
if ((dt == gsn_assassinate) && wield != NULL)
dam *= 16;
if (dt == gsn_garrote)
dam *= 14;
/* Added bonus for dual wielding daggers for Assassins
Dusk
*/
wield = get_eq_char (ch, WEAR_WIELD);
second = get_eq_char (ch, WEAR_SECONDARY);
if (second != NULL )
{
if ( (dt == gsn_backstab) && (wield->value[0] == WEAPON_DAGGER) &&
(second->value[0] == WEAPON_DAGGER) && (ch->class == CLASS_ASSASSIN) )
{
if (ch->level <= 15)
dam *= 2;
else if (ch->level <= 31)
dam *= 2;
else if (ch->level <= 47)
dam *= 2;
else if (ch->level <= 63)
dam *= 2;
else if (ch->level <= 79)
dam *= 2;
else if (ch->level <= 91)
dam *= 2;
else if (ch->level <= 101)
dam *= get_skill(ch,gsn_assassinate)/40;
else
dam *= get_skill(ch,gsn_assassinate)/40;
}
else if ( (dt == gsn_backstab) && (wield->value[0] == WEAPON_DAGGER) &&
(second->value[0] != WEAPON_DAGGER) && (ch->class == CLASS_ASSASSIN) )
{
if (ch->level <= 15)
dam *= 2;
else if (ch->level <= 31)
dam *= 2;
else if (ch->level <= 47)
dam *= 2;
else if (ch->level <= 63)
dam *= 2;
else if (ch->level <= 79)
dam *= 2;
else if (ch->level <= 91)
dam *= 2;
else if (ch->level <= 101)
dam *= get_skill(ch,gsn_assassinate)/50;
else
dam *= get_skill(ch,gsn_assassinate)/50;
}
}
/*
Removed the CLASS_ASSASSIN check because of above addition of
dual wield backstab bonus
Dusk
*/
if ( (dt == gsn_backstab) && (wield != NULL) &&
(ch->class == CLASS_BARD || ch->class == CLASS_NINJA) )
{
if (ch->level <= 15)
dam *= 2;
else if (ch->level <= 31)
dam *= 4;
else if (ch->level <= 47)
dam *= 6;
else if (ch->level <= 63)
dam *= 8;
else if (ch->level <= 79)
dam *= 10;
else if (ch->level <= 91)
dam *= 12;
else if (ch->level <= 101)
dam *= 17;
else
dam *= 15;
}
else if ((dt == gsn_backstab) && (wield != NULL)) {
if (ch->level <= 15)
dam *=2;
else if (ch->level <=31)
dam *=3;
else if (ch->level <=47)
dam *=5;
else if (ch->level <=63)
dam *=7;
else if (ch->level <=79)
dam *=9;
else if (ch->level <=91)
dam *=11;
else if (ch->level <=101)
dam *=12;
else
dam *=13;
}
if (dt == gsn_bladedance && wield != NULL) {
if (ch->level <= 19)
dam *= 2;
else if (ch->level <= 39)
dam *= 3;
else if (ch->level <= 59)
dam *= 5;
else if (ch->level <= 79)
dam *= 7;
else if (ch->level <= 101)
dam *= 10;
else
dam *= 13;
}
if (dt == gsn_circle && wield != NULL) {
if (ch->level <= 19)
dam *= 2;
else if (ch->level <= 39)
dam *= 3;
else if (ch->level <= 59)
dam *= 5;
else if (ch->level <= 79)
dam *= 7;
else if (ch->level <= 101)
dam *= 9;
else
dam *= 12;
}
if (dt == gsn_vital_hit && wield == NULL)
{
if (ch->level <= 82)
dam *= 4;
else if (ch->level <= 92)
dam *= 5;
else if (ch->level <= 101)
dam *= 11/2;
else
dam *= 6;
}
if (dt == gsn_twirl && wield != NULL) {
if (ch->level <= 29)
dam *= 3;
else if (ch->level <= 49)
dam *= 4;
else if (ch->level <= 79)
dam *= 5;
else if (ch->level <= 101)
dam *= 6;
else
dam *= 10;
}
if (dt == gsn_ambush && wield != NULL) {
if (wield->value[0] != 2)
dam *= 3 / 2 + (ch->level / 10);
else
dam *= 3 / 2 + (ch->level / 8);
}
dam += GET_MOD_DAMROLL(ch) * UMIN(110,skill)/100;
if (!IS_NPC(ch))
if (!str_cmp(class_table[ch->class].name,"monk")
|| !str_cmp(class_table[ch->class].name,"ninja"))
{
if (wield == NULL && get_eq_char(ch,WEAR_SECONDARY) == NULL)
dam += (dam * 11) / 10;
}
/*
* Fists and Affects -- Monk/Ninja/Voodan
*/
if (is_affected(ch,gsn_fists_fang) && dt != gsn_backstab && dt != gsn_circle)
{
if (number_percent() < ( get_skill(ch,gsn_fists_fang) / 3) )
{
send_to_char("You lash out with your fangs!\n\r",ch);
act("$n strikes with the fangs on his wrists!",ch,0,victim,TO_ROOM);
dt = gsn_fists_fang;
dam_type = DAM_PIERCE;
dam = dam + (dam*1/10);
if (!saves_spell(ch->level/ 2,victim,DAM_POISON))
{
AFFECT_DATA af;
send_to_char("You feel poison running in your blood.\n\r",victim);
act("$N is poisoned by your fangs!",ch,0,victim,TO_CHAR);
af.where = TO_AFFECTS;
af.type = gsn_poison;
af.level = ch->level * 5/4;
af.duration = ch->level / 4;
af.location = APPLY_STR;
af.modifier = -1*number_range(1,6);
af.bitvector = AFF_POISON;
affect_join( victim, &af);
}
}
}
if (is_affected(ch,gsn_fists_flame))
{
if (number_percent() < ( get_skill(ch,gsn_fists_flame) / 5 ) )
{
send_to_char("A flaming aura surrounds your fists!\n\r",ch);
act("$n's fists are surrounded by a flaming aura!",ch,0,victim,TO_ROOM);
dt = gsn_fists_flame;
dam_type = DAM_FIRE;
dam = dam + (dam*2/10);
//Flaming Flag
if ( number_range( 1,2 ) == 2 ) //50% chance (keep in mind fists don't hit every punch)
{
act("$n is burned by the flames!",victim,0,NULL,TO_ROOM);
act("Your flesh is seared by the flames!",victim,0,NULL,TO_CHAR);
victim->hit = (victim->hit - 20); //20 hidden bonus damage
fire_effect( (void *) victim,ch->level*7/10,dam,TARGET_CHAR); //slightly lower level than weapon flaming
update_pos( victim );
}
}
}
if (is_affected(ch,gsn_fists_divinity))
{
if (number_percent() < (get_skill(ch,gsn_fists_divinity) / 5))
{
send_to_char("A bright aura surrounds your fists!\n\r",ch);
act("$n's fists are surrounded by a bright aura!",ch,0,victim,TO_ROOM);
dt = gsn_fists_divinity;
dam_type = DAM_HOLY;
dam = dam + (dam*2/10);
//Shocking flag:
if (number_range( 1,2 ) == 2) //50% chance
{
wdam = number_range( 1, ch->level / 5 + 2);
act("$n is shocked with holy power!",victim,0,NULL,TO_ROOM);
act("You are shocked with divine power!",victim,0,NULL,TO_CHAR);
victim->hit = (victim->hit <= wdam ? 1 : victim->hit - wdam);
shock_effect(victim, ch->level,dam,TARGET_CHAR);
update_pos(victim);
}
}
}
if (is_affected(ch,gsn_fists_ice))
{
if (number_percent() < (get_skill(ch,gsn_fists_ice) / 5))
{
send_to_char("A cold mist surrounds your fists!\n\r",ch);
act("$n's fists are surrounded by a cold mist!",ch,0,victim,TO_ROOM);
dt = gsn_fists_ice;
dam_type = DAM_COLD;
dam = dam + (dam*2/10);
//Frost Flag
if (number_range( 1,2 ) == 2) //50% chance
{
wdam = number_range( 1, ch->level / 15 + 2);
act("$n is frozen by the cold!",victim,0,NULL,TO_ROOM);
act("The freezing punch surrounds you with ice!",victim,0,NULL,TO_CHAR);
victim->hit = (victim->hit - wdam);
cold_effect(victim,ch->level,dam,TARGET_CHAR);
update_pos(victim);
}
}
}
/* STORM CRIT STRIKE by Bree */
/* if(is_affected(ch, gsn_crit_strike))
{
if (number_percent() < (get_skill(ch,gsn_third_attack) / 8))
{
dt = gsn_crit_strike;
check_improve(ch,gsn_crit_strike,TRUE,6);
send_to_char("You land a critical strike!\n\r",ch);
act("$n lands a critical strike!", ch, NULL, NULL, TO_ROOM);
dam = dam + (dam*4/8);
}
}
*/
/* Manuevers by Bree */
if(is_affected(ch, gsn_snattack))
{
if (number_percent() < (get_skill(ch,gsn_third_attack) / 8))
{
dt = gsn_snattack;
check_improve(ch,gsn_snattack,TRUE,6);
send_to_char("You manuever in for a quick strike!\n\r",ch);
act("$n manuevers for a strike!", ch, NULL, NULL, TO_ROOM);
dam = dam + (dam*4/8);
}
}
/* blasphemy by Bree */
if(is_affected(ch, gsn_snattacktwo))
{
if (number_percent() < (get_skill(ch,gsn_third_attack) / 8))
{
dt = gsn_snattacktwo;
check_improve(ch,gsn_snattacktwo,TRUE,6);
send_to_char("Your Blasphemy gives you another strike!\n\r",ch);
act("$n manuevers for a strike!", ch, NULL, NULL, TO_ROOM);
dam = dam + (dam*4/8);
}
}
/* greed by Bree */
/* if(is_affected(ch, gsn_greed))
{
if (number_percent() < (get_skill(ch,gsn_third_attack) / 8))
{
dt = gsn_greed;
check_improve(ch,gsn_greed,TRUE,6);
send_to_char("You see a shiney gold coin and move in for a strike!\n\r",ch);
act("$n lunges at $N's coin purse! ", ch, NULL, NULL, TO_ROOM);
dam = dam + (dam*4/8);
}
}
*/
/* bloodlust by Bree */
if(is_affected(ch, gsn_bloodlust))
{
if (number_percent() < (get_skill(ch,gsn_third_attack) / 8))
{
dt = gsn_bloodlust;
check_improve(ch,gsn_bloodlust,TRUE,6);
send_to_char("Rage overcomes you as you strike!!\n\r",ch);
act("$n smells blood and goes {RI{rN{RS{rA{RN{rE{R!!{X", ch, NULL, NULL, TO_ROOM);
dam = dam + (dam*4/8);
}
}
/* Shadow ungodly blows by Bree */
if(is_affected(ch, gsn_modis_anger))
{
if (number_percent() < (get_skill(ch,gsn_second_attack) / 6.5))
{
dt = gsn_modis_anger;
check_improve(ch,gsn_modis_anger,TRUE,6);
act("$n strikes with the fury of The Shadows!", ch, NULL, NULL, TO_ROOM);
dam = dam + (dam*4/8);
}
}
/* Conquest Critical Strike */
if(is_affected(ch, gsn_divide))
{
if (number_percent() < (get_skill(ch,gsn_second_attack) / 8))
{
dt = gsn_divide;
check_improve(ch,gsn_crit_strike,TRUE,6);
send_to_char("You land a Crushing Blow!\n\r",ch);
act("$n lands a crushing Blow!", ch, NULL, NULL, TO_ROOM);
dam = dam + (dam*4/7.5);
}
}
/* Vanir Critical Strike */
if(is_affected(ch, gsn_vmight))
{
if (number_percent() < (get_skill(ch,gsn_third_attack) / 8))
{
dt = gsn_vmight;
check_improve(ch,gsn_crit_strike,TRUE,6);
send_to_char("You land a Vanirian Blow!\n\r",ch);
act("$n lands a Vanirian Blow!", ch, NULL, NULL, TO_ROOM);
dam = dam + (dam*4/8);
}
}
if (ch->class == CLASS_HIGHLANDER && get_skill(ch, gsn_follow_through) > 0)
{
if (number_percent() < (get_skill(ch,gsn_follow_through) / 5))
{
check_follow_through(ch,victim,dam);
}
}
if (is_affected(ch,gsn_fists_acid) && dt != gsn_backstab && dt != gsn_circle)
{
if (number_percent() < (get_skill(ch,gsn_fists_acid) / 6))
{
send_to_char("Your fists flare yellow-green for a moment!\n\r",ch);
act("$n's fists flare yellow-green for a moment!",ch,0,victim,TO_ROOM);
dt = gsn_fists_acid;
dam_type = DAM_ACID;
dam = dam + (dam*2/10);
}
}
if (is_affected(ch,gsn_fists_liquid))
{
int fisthit;
if (number_percent() < (get_skill(ch,gsn_fists_liquid) / 5 ))
{
fisthit = number_range(1,4);
switch( fisthit )
{
case 1:
send_to_char("Water surrounds your fists!\n\r",ch);
act("$n's fists are surrounded by water!",ch,0,victim,TO_ROOM);
dam_type = DAM_DROWNING;
dam = dam + (dam*3/11);//7% damage boost to compensate for no flag/fists of fury
break;
case 2:
send_to_char("Hot magma surrounds your fists!\n\r",ch);
act("$n's fists are surrounded by liquid fire!",ch,0,victim,TO_ROOM);
dam_type = DAM_FIRE;
dam = dam + (dam*3/11);
break;
case 3:
send_to_char("Cold air surrounds your fists!\n\r",ch);
act("$n's fists are surrounded by liquid air!",ch,0,victim,TO_ROOM);
dam_type = DAM_COLD;
dam = dam + (dam*3/11);
break;
case 4:
send_to_char("Searing acid surrounds your fists!\n\r",ch);
act("$n's fists are surrounded by acid!",ch,0,victim,TO_ROOM);
dam_type = DAM_ACID;
dam = dam + (dam*3/11);
break;
}
dt = gsn_fists_liquid;
}
}
if (is_affected(ch,gsn_fists_claw) && dt != gsn_backstab && dt != gsn_circle)
{
int percent;
if ((percent = number_percent()) <= (get_skill(ch,gsn_fists_claw)/8.5))
{
send_to_char("You lash out with your claws!\n\r",ch);
act("$n strikes $N with the claws on his wrists!",ch,0,victim,TO_ROOM);
dt = gsn_fists_claw;
dam_type = DAM_PIERCE;
dam = 2 * dam + (dam * 2.5 * percent / 100);
}
}
if (is_affected(ch,gsn_fists_darkness) && dt != gsn_backstab && dt != gsn_circle)
{
if (get_eq_char(ch,WEAR_SECONDARY) == NULL)//Single-wield only (voodan skill)
{
if (number_percent() < (get_skill(ch,gsn_fists_darkness) / 6))
{
send_to_char("Shadows surround your fists!\n\r",ch);
act("$n's fists are covered by shadows!",ch,0,victim,TO_ROOM);
dt = gsn_fists_darkness;
dam_type = DAM_NEGATIVE;
dam = dam + (dam*3/10);//Slight increase in damage (to help voodan)
//Vampiric Flag
wdam = number_range( 1, ch->level / 5 + 2);
act("$n's life is sucked away!",victim,0,NULL,TO_ROOM);
act("You feel your life being sucked away!",victim,0,NULL,TO_CHAR);
victim->hit = (victim->hit <= wdam ? 1 : victim->hit - wdam);
ch->hit = UMIN(ch->max_hit,ch->hit + wdam);
victim->mana = (victim->mana <= (wdam / 4) ? 1 : victim->mana - (wdam / 3));
ch->mana = UMIN(ch->max_mana,ch->mana + (wdam / 2));
update_pos(victim);
}
}
}
if (check_open_palming(ch) && is_affected(ch,gsn_martial_arts))
{
int percent = number_percent();
int fun = number_range(1,5);
act("You hit $N with stunning force!",ch,NULL,victim,TO_CHAR);
act("$n hits you with stunning force!",ch,NULL,victim,TO_VICT);
act("$n hits $N with stunning force!",ch,NULL,victim,TO_NOTVICT);
switch(fun)
{
case 1: dam_type = DAM_PIERCE; break;
case 2: dam_type = DAM_BASH; break;
case 3: dam_type = DAM_SLASH; break;
case 4: dam_type = DAM_HARM; break;
default: dam_type = DAM_BASH; break;
}
if (ch->level <= 59)
dam = 2 * dam + (dam * 2 * percent / 120);
else if(ch->level <= 100)
dam = 2 * dam + (dam * 2 * percent / 100);
else
dam = 2 * dam + (dam * 2 * percent / 80);
check_improve(ch,gsn_palm,TRUE,2);
}
/* Renshai Modi's Anger */
if(is_affected(ch, gsn_modis_anger))
{
int chance, skill;
chance = get_skill(ch,gsn_modis_anger)/10;
skill = get_skill(ch,gsn_modis_anger);
if( number_percent() < chance )
{
if( ch->mana > 20 )
{
dam += GET_MOD_DAMROLL(ch) * UMIN(100,skill)/100;
dt = gsn_modis_anger;
ch->mana -= 20;
check_improve(ch,gsn_modis_anger,TRUE,6);
act("$n strikes with the anger of Modi!", ch, NULL, NULL, TO_ROOM);
}
}
else
check_improve(ch,gsn_concentration,FALSE,1);
}
if (dam <= 0)
dam = 1;
result = damage (ch, victim, dam, dt, dam_type, show, 0);
/* STORM Critical Strike*/
/* if(is_affected(ch, gsn_crit_strike))
{
int chance, skill;
chance = get_skill(ch,gsn_crit_strike)/10;
skill = get_skill(ch,gsn_crit_strike);
if( number_percent() < chance )
{
if( ch->mana > 20 )
{
dam += GET_MOD_DAMROLL(ch) * UMIN(100,skill)/100;
dt = gsn_crit_strike;
ch->mana -= 20;
check_improve(ch,gsn_crit_strike,TRUE,6);
act("$n lands a critacal strike!", ch, NULL, NULL, TO_ROOM);
}
}
else
check_improve(ch,gsn_concentration,FALSE,1);
}
if (dam <= 0)
dam = 1;
result = damage (ch, victim, dam, dt, dam_type, show, 0);*/
// Toughness
if(result)
improve_toughness(victim);
// Weapon Flags
if ( !IS_NPC(ch) && wield != NULL ) {
if ( number_range( 1,5 ) == 2 ) {
if ( ch->fighting == victim && result ) {
if ( IS_WEAPON_STAT(wield, WEAPON_FLAMING) ) {
wdam = number_range( 1, wield->level / 15 + 1);
act("$n is burned by $p.",victim,wield,NULL,TO_ROOM);
act("$p sears your flesh.",victim,wield,NULL,TO_CHAR);
victim->hit = (victim->hit <= wdam ? 1 : victim->hit - wdam);
fire_effect( (void *) victim,wield->level*3/5,dam,TARGET_CHAR);
update_pos( victim );
}
if ( IS_WEAPON_STAT(wield, WEAPON_FROST) ) {
wdam = number_range( 1, wield->level / 12 + 2);
act("$p freezes $n.",victim,wield,NULL,TO_ROOM);
act("The cold touch of $p surrounds you with ice.",victim,wield,NULL,TO_CHAR);
victim->hit = (victim->hit <= wdam ? 1 : victim->hit - wdam);
cold_effect(victim,wield->level,dam,TARGET_CHAR);
update_pos(victim);
}
if ( IS_WEAPON_STAT(wield, WEAPON_VAMPIRIC) ) {
wdam = number_range( 1, wield->level / 3 + 2);
act("$p draws life from $n.",victim,wield,NULL,TO_ROOM);
act("The vile touch of $p draws your life.",victim,wield,NULL,TO_CHAR);
victim->hit = (victim->hit <= wdam ? 1 : victim->hit - wdam);
ch->hit = UMIN(ch->max_hit,ch->hit + wdam);
victim->mana = (victim->mana <= (wdam / 4) ? 1 : victim->mana - (wdam / 3));
ch->mana = UMIN(ch->max_mana,ch->mana + (wdam / 2));
update_pos(victim);
} //bree change osmosis
if ( IS_WEAPON_STAT(wield, WEAPON_OSMOSIS) ) {
wdam = number_range( 1, wield->level / 5 + 2);
act("$p draws power from $n.",victim,wield,NULL,TO_ROOM);
act("The vile touch of $p draws your power.",victim,wield,NULL,TO_CHAR);
victim->hit = (victim->hit <= wdam ? 1 : victim->hit - wdam);
ch->hit = UMIN(ch->max_hit,ch->hit + wdam);
victim->mana = (victim->mana <= wdam ? 1 : victim->mana - wdam);
ch->mana = UMIN(ch->max_mana,ch->mana + (wdam * 2 / 3));
update_pos(victim);
}
if ( IS_WEAPON_STAT(wield, WEAPON_ENERGYDRAIN) ) {
wdam = number_range( 1, wield->level / 5 + 3);
act("$p draws energy from $n.",victim,wield,NULL,TO_ROOM);
act("The vile touch of $p draws your energy!.",victim,wield,NULL,TO_CHAR);
victim->move = (victim->move <= wdam ? 1 : victim->move - wdam);
ch->move = UMIN(ch->max_move,ch->move + wdam);
victim->move = (victim->move <= wdam ? 1 : victim->move - wdam);
ch->move = UMIN(ch->max_move,ch->move + (wdam * 2 / 3));
update_pos(victim);
}
if ( IS_WEAPON_STAT(wield, WEAPON_SHOCKING) ) {
wdam = number_range( 1, wield->level / 15 + 2);
act("$p shocks $n.",victim,wield,NULL,TO_ROOM);
act("The electrified touch of $p shocks you.",victim,wield,NULL,TO_CHAR);
victim->hit = (victim->hit <= wdam ? 1 : victim->hit - wdam);
shock_effect(victim, wield->level + 10,dam,TARGET_CHAR);
update_pos(victim);
}
if ( IS_WEAPON_STAT(wield, WEAPON_POISON) ) {
wdam = number_range( 1, wield->level / 15 + 2);
act("$n turns green as $p poisons $m.",victim,wield,NULL,TO_ROOM);
act("You feel sick as $p's poisoned edge pierces you.",victim,wield,NULL,TO_CHAR);
poison_effect(victim, wield->level, dam, TARGET_CHAR);
victim->hit = (victim->hit <= wdam ? 1 : victim->hit - wdam);
update_pos(victim);
}
if ( IS_WEAPON_STAT(wield, WEAPON_ACIDIC) ) {
wdam = number_range( 1, wield->level / 15 + 2);
act("$n screams as $p sears $m.",victim,wield,NULL,TO_ROOM);
act("You scream $p's acidic edge sears your flesh.",victim,wield,NULL,TO_CHAR);
acid_effect(victim, wield->level, dam, TARGET_CHAR);
victim->hit = (victim->hit <= wdam ? 1 : victim->hit - wdam);
update_pos(victim);
}
}
}
}
if(result)
{
if (ch->fighting == victim) {
if (IS_SHIELDED (victim, SHD_ICE)) {
if (!IS_SHIELDED (ch, SHD_ICE)) {
dam = number_range (20, 25);
dt = skill_lookup ("iceshield");
damage (victim, ch, dam, dt, DAM_COLD, TRUE,
DF_NOREDUCE | DF_NODODGE | DF_NOPARRY | DF_NOBLOCK);
}
}
if (IS_SHIELDED (victim, SHD_FIRE)) {
if (!IS_SHIELDED (ch, SHD_FIRE)) {
dam = number_range (20, 25);
dt = skill_lookup ("fireshield");
damage (victim, ch, dam, dt, DAM_FIRE, TRUE,
DF_NOREDUCE | DF_NODODGE | DF_NOPARRY | DF_NOBLOCK);
}
}
if ( IS_SHIELDED (victim, SHD_SHOCK) )
{
if ( !IS_SHIELDED (ch, SHD_SHOCK) )
{
dam = number_range (25, 30);
dt = skill_lookup ("shockshield");
damage (victim, ch, dam, dt, DAM_LIGHTNING, TRUE,
DF_NOREDUCE | DF_NODODGE | DF_NOPARRY | DF_NOBLOCK);
if ( ( get_curr_stat( victim, STAT_WIS) + victim->saving_throw ) < ( number_percent() + get_curr_stat( victim, STAT_INT) )
&& has_skill(ch, skill_lookup( "shockshield" ) ) )
{
if ( con_app[get_curr_stat( ch, STAT_CON)].shock < number_percent() )
{
send_to_char("You got zapped by their shockshield!\n\r",ch);
act("$n's body go stiff with paralysis from the shockshield!",ch,NULL,NULL,TO_ROOM);
WAIT_STATE(ch, .5 * PULSE_VIOLENCE);
}
}
}
}
if ( IS_SHIELDED (victim, SHD_DEATH ) )
{
if ( !IS_SHIELDED (ch, SHD_DEATH) )
{
int dmax, dmin;
dmin = 5 + ((victim->level * 30) / 101);
dmax = 10 + ((victim->level * 40) / 101);
dam = number_range (dmin, dmax);
dt = skill_lookup ("deathshield");
damage (victim, ch, dam, dt, DAM_NEGATIVE, TRUE,
DF_NODODGE | DF_NOPARRY | DF_NOBLOCK);
victim->hit += dam;
}
}
}
}
tail_chain ();
if (!is_safe(ch,victim))
{
improve_stance(ch);
}
return;
}
int add_bonuses( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, int dam_type )
{
float mult = 1;
float reduct = 1;
int diceroll;
if ( !IS_AWAKE(victim) )
mult += 1;
else if (victim->position < POS_FIGHTING)
dam = dam * 4 / 3;
if ( !IS_NPC(ch) )
{
if (ch->class == CLASS_HIGHLANDER && dt == gsn_blademastery)
{
if(ch->pcdata->power[POWER_LEVEL] != 0)
dam += edam_bonus( ch, dam )*(ch->pcdata->power[POWER_LEVEL]+1);
else
dam += edam_bonus( ch, dam );
}
if (ch->class == CLASS_HIGHLANDER && dt == gsn_decapitate) {
int hroll;
if(ch->pcdata->power[POWER_LEVEL] != 0)
dam += edam_bonus( ch, dam ) * (ch->pcdata->power[POWER_LEVEL]+2);
else
dam += edam_bonus( ch, dam );
diceroll = number_percent ();
if (diceroll <= (get_skill (ch, gsn_blademastery)/8))
{
hroll = number_range(1,ch->pcdata->power[POWER_LEVEL]);
if(hroll > 2) {
hroll *= 3;
hroll /= 4;
}
dam *= hroll;
dam_type = DAM_OTHER;
}
}
}
if ( IS_NPC(ch) && ch->level > 100 )
{
mult += ( ch->level / 100 );
reduct += ( ch->level / 90 );
}
if ( IS_NPC(victim) && victim->level > 100 )
{
mult += ( victim->level / 90 );
reduct += ( victim->level / 100 );
}
if (get_skill (ch, gsn_enhanced_damage) > 0) {
diceroll = number_percent ();
if (diceroll <= get_skill (ch, gsn_enhanced_damage)) {
check_improve (ch, gsn_enhanced_damage, TRUE, 6);
dam += 1.3*edam_bonus( ch, dam );
}
}
else
{
dam *= 7;
dam /= 10;
}
dam *= mult;
dam /= reduct;
return dam;
}
/*
* Mock hit one guy once.
*/
void
one_hit_mock (CHAR_DATA * ch, CHAR_DATA * victim, int dt, bool secondary)
{
OBJ_DATA *wield;
int victim_ac;
int thac0;
int thac0_00;
int thac0_32;
int dam;
int diceroll;
int sn, skill;
int dam_type;
bool result;
sn = -1;
/* just in case */
if (ch == NULL || victim == NULL)
return;
/*
* Can't beat a dead char!
* Guard against weird room-leavings.
*/
if (victim->position == POS_DEAD || ch->in_room != victim->in_room)
return;
/*
* Figure out the type of damage message.
* if secondary == true, use the second weapon.
*/
if (!secondary)
wield = get_eq_char (ch, WEAR_WIELD);
else
wield = get_eq_char (ch, WEAR_SECONDARY);
if (dt == TYPE_UNDEFINED)
{
dt = TYPE_HIT;
if (wield != NULL && wield->item_type == ITEM_WEAPON)
dt += wield->value[3];
else
dt += ch->dam_type;
}
if (dt < TYPE_HIT)
if (wield != NULL)
dam_type = attack_table[wield->value[3]].damage;
else
dam_type = attack_table[ch->dam_type].damage;
else
dam_type = attack_table[dt - TYPE_HIT].damage;
if (dam_type == -1)
dam_type = DAM_BASH;
/* get the weapon skill */
sn = get_weapon_sn (ch);
skill = 20 + get_weapon_skill (ch, sn);
/*
* Calculate to-hit-armor-class-0 versus armor.
*/
if (IS_NPC (ch))
{
thac0_00 = 20;
thac0_32 = -4; /* as good as a thief */
if (IS_SET (ch->act, ACT_VAMPIRE))
thac0_32 = -30;
else if (IS_SET (ch->act, ACT_DRUID))
thac0_32 = 0;
else if (IS_SET (ch->act, ACT_RANGER))
thac0_32 = -4;
else if (IS_SET (ch->act, ACT_WARRIOR))
thac0_32 = -10;
else if (IS_SET (ch->act, ACT_THIEF))
thac0_32 = -4;
else if (IS_SET (ch->act, ACT_CLERIC))
thac0_32 = 2;
else if (IS_SET (ch->act, ACT_MAGE))
thac0_32 = 6;
}
else
{
thac0_00 = class_table[ch->class].thac0_00;
thac0_32 = class_table[ch->class].thac0_32;
}
thac0 = interpolate (ch->level, thac0_00, thac0_32);
if (thac0 < 0)
thac0 = thac0 / 2;
if (thac0 < -5)
thac0 = -5 + (thac0 + 5) / 2;
thac0 -= GET_HITROLL (ch) * skill / 100;
thac0 += 5 * (100 - skill) / 100;
if (dt == gsn_backstab)
thac0 -= 10 * (100 - get_skill (ch, gsn_backstab));
if (dt == gsn_bladedance)
thac0 -= 10 * (100 - get_skill (ch, gsn_bladedance));
if (dt == gsn_circle)
thac0 -= 10 * (100 - get_skill (ch, gsn_circle));
if (dt == gsn_ambush)
thac0 -= 10 * (100 - get_skill (ch, gsn_ambush));
switch (dam_type)
{
case (DAM_PIERCE):
victim_ac = GET_AC (victim, AC_PIERCE) / 9;
break;
case (DAM_BASH):
victim_ac = GET_AC (victim, AC_BASH) / 9;
break;
case (DAM_SLASH):
victim_ac = GET_AC (victim, AC_SLASH) / 9;
break;
default:
victim_ac = GET_AC (victim, AC_EXOTIC) / 9;
break;
};
/*
if (victim_ac < -15)
victim_ac = (victim_ac + 15) / 5 - 15;
*/
if (!can_see (ch, victim))
victim_ac -= 4;
if (victim->position < POS_FIGHTING)
victim_ac += 4;
if (victim->position < POS_RESTING)
victim_ac += 6;
/*
* The moment of excitement!
*/
while ((diceroll = number_bits (5)) >= 20)
;
if (diceroll == 0
|| (diceroll != 19 && diceroll < thac0 - victim_ac))
{
/* Miss. */
damage_mock (ch, victim, 0, dt, dam_type, TRUE);
tail_chain ();
return;
}
/*
* Hit.
* Calc damage.
*/
if (IS_NPC (ch) && (!ch->pIndexData->new_format || wield == NULL))
if (!ch->pIndexData->new_format)
{
dam = number_range (ch->level / 2, ch->level * 3 / 2);
if (wield != NULL)
dam += dam / 2;
}
else
dam = dice (ch->damage[DICE_NUMBER], ch->damage[DICE_TYPE]);
else
{
/*if (sn != -1)
check_improve (ch, sn, TRUE, 5); No abusing to spam up weapon skills!*/
if (wield != NULL)
{
if (wield->clan)
{
float adlev, inclev;
int cntr;
adlev = 8;
inclev = .01;
for (cntr = 0; cntr <= ch->level; cntr++)
{
adlev += .57;
adlev += inclev;
inclev += .005;
}
cntr = (int) adlev;
dam = dice (cntr / 3, 3) * skill / 100;
}
else
{
if (wield->pIndexData->new_format)
dam = dice (wield->value[1], wield->value[2]) * skill / 100;
else
dam = number_range (wield->value[1] * skill / 100,
wield->value[2] * skill / 100);
}
if (get_eq_char (ch, WEAR_SHIELD) == NULL) /* no shield = more */
dam = dam * 11 / 10;
/* sharpness! */
if (IS_WEAPON_STAT (wield, WEAPON_SHARP))
{
int percent;
if ((percent = number_percent ()) <= (skill / 8))
dam = 2 * dam + (dam * 2 * percent / 100);
}
}
else
dam = number_range (1 + 4 * skill / 100, 2 * ch->level / 3 * skill / 100);
}
/*
* Bonuses.
*/
if (get_skill (ch, gsn_enhanced_damage) > 0)
{
diceroll = number_percent ();
if (diceroll <= get_skill (ch, gsn_enhanced_damage))
{
//check_improve (ch, gsn_enhanced_damage, TRUE, 6);
// dam += 2 * (dam * diceroll / 300);
dam += edam_bonus( ch, dam );
}
}
if (!IS_AWAKE (victim))
dam *= 2;
else if (victim->position < POS_FIGHTING)
dam = dam * 3 / 2;
if (dt == gsn_backstab && wield != NULL)
{
if (wield->value[0] != 2)
dam *= 2 + (ch->level / 2);
else
dam *= 2 + (ch->level);
}
if (dt == gsn_circle && wield != NULL)
{
if (wield->value[0] != 2)
dam *= 2 + (ch->level / 3);
else
dam *= 2 + (ch->level / 2);
}
dam += GET_MOD_DAMROLL(ch) * UMIN (100, skill) / 100;
if (dam <= 0)
dam = 1;
result = damage_mock (ch, victim, dam, dt, dam_type, TRUE);
tail_chain ();
return;
}
/*
* Inflict damage from a hit.
*/
bool damage (CHAR_DATA * ch, CHAR_DATA * victim, int dam, int dt, int dam_type,
bool show, int flags)
{
OBJ_DATA *corpse;
bool immune = FALSE;
int victim_ac=0;
//CHAR_DATA *gch;
if (victim->position == POS_DEAD)
return FALSE;
if(skill_table[dt].spell_fun != NULL && skill_table[dt].target == TAR_CHAR_OFFENSIVE)
{
if(check_sorcery(ch,dt))
{
// if(!IS_IMMORTAL(ch))
send_to_char("You feel a surge of magic!\n\r",ch);
dam = sorcery_dam(dam,2, ch);
}
}
/* damage reduction */
if (!(flags & DF_NOREDUCE))
{
if (dam > 35)
dam = (dam - 35) * 7 / 10 + 35;
if (dam > 85)
dam = (dam - 85) * 7 / 10 + 85;
if (dam > 500)
dam = (dam - 500) * 7 / 10 + 500;
if (dam > 1000)
dam = (dam - 1000) * 7 / 10 + 1000;
if (dam > 2000)
dam = (dam - 2000) * 7 / 10 + 2000;
if (dam > 3000)
dam = (dam - 3000) * 7 / 10 + 3000;
}
/*
* Stop up any residual loopholes.
*/
if (dam > 6000 && dt >= TYPE_HIT && ch->level < 106)
{
bug ("Damage: %d: more than 6000 points!", dam);
dam = 6000;
if (!IS_IMMORTAL (ch) )
{
OBJ_DATA *obj;
obj = get_eq_char (ch, WEAR_WIELD);
send_to_char ("{cYou {z{Breally{x{c shouldn't cheat.{x\n\r", ch);
if (obj != NULL)
extract_obj (obj);
}
}
if (victim != ch)
{
/*
* Certain attacks are forbidden.
* Most other attacks are returned.
*/
if (is_safe (ch, victim))
return FALSE;
if (victim->position > POS_STUNNED)
{
if (victim->fighting == NULL)
{
set_fighting (victim, ch);
victim->position = POS_FIGHTING;
if (IS_NPC (victim) && HAS_TRIGGER (victim, TRIG_KILL))
mp_percent_trigger (victim, ch, NULL, NULL, TRIG_KILL);
}
if (victim->timer <= 4)
victim->position = POS_FIGHTING;
}
if (victim->position > POS_STUNNED)
{
if (ch->fighting == NULL)
set_fighting (ch, victim);
}
}
/*
* More charm stuff.
*/
if (victim->master == ch) // Why stop if it is yourself? || ch == victim)
stop_follower (victim);
/*
* Inviso attacks ... not.
*/
if (IS_SHIELDED (ch, SHD_INVISIBLE))
{
if (!can_see(victim,ch)) {
dam *= 1.25;
send_to_char("You use your concealment to get a surprise attack!\n\r",ch);
}
affect_strip (ch, gsn_invis);
affect_strip (ch, gsn_mass_invis);
REMOVE_BIT (ch->shielded_by, SHD_INVISIBLE);
act ("$n fades into existence.", ch, NULL, NULL, TO_ROOM);
}
if(is_affected(ch,gsn_hide)) {
if (!can_see(victim,ch)) {
dam *= 1.25;
send_to_char("You use your concealment to get a surprise attack!\n\r",ch);
}
affect_strip(ch,gsn_hide);
act( "$n leaps from $s concealment.", ch, NULL, NULL, TO_ROOM );
}
if(IS_AFFECTED(ch,AFF_HIDE)) {
if (!can_see(victim,ch)) {
dam *= 1.25;
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(ch,gsn_forest_blend)) {
if (!can_see(victim,ch)) {
dam *= 1.5;
send_to_char("You use your concealment to get a surprise attack!\n\r",ch);
}
affect_strip(ch,gsn_forest_blend);
act( "$n leaps from $s concealment.", ch, NULL, NULL, TO_ROOM );
}
if(is_affected(ch,gsn_earthmeld)) {
if (!can_see(victim,ch)) {
dam *= 1.5;
send_to_char("You use your concealment to get a surprise attack!\n\r",ch);
}
affect_strip(ch,gsn_earthmeld);
act( "$n pops up from the ground!", ch, NULL, NULL, TO_ROOM );
}
/*
* Damage modifiers.
*/
if (dam > 1 && !IS_NPC (victim)
&& victim->pcdata->condition[COND_DRUNK] > 10)
dam = 9 * dam / 10;
if (dam > 1 && IS_SHIELDED (victim, SHD_SANCTUARY))
dam -= dam/3;
// Toughness
if (dam > 1 && is_warrior_class(victim->class) && number_percent() < victim->toughness * 0.3Showing the first 100 KB of 365.4 KB. Download the archive for the full file.