fight-old
./distorted/src/fight-old · 310.9 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_phase_real args ((CHAR_DATA * ch, CHAR_DATA * victim, bool silent));
bool check_shield_block 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 ((int cclass, 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) );
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);
else if(ch->mana_regen_rate < 0)
regenerate = number_range(1, -ch->mana_regen_rate);
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);
}
}
/* 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;
/* decrement the wait */
if (ch->desc == NULL)
ch->wait = UMAX (0, ch->wait - PULSE_VIOLENCE);
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 &&
(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);
one_hit(ch,victim,gsn_multistrike,FALSE);
one_hit(ch,victim,gsn_multistrike,FALSE);
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 )
{
//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, 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 /= 6; // 16% 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 /= 10; // 10% 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 /= 10; //13% 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)
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;
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;
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 || 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_circle)
thac0 -= 10 * (100 - get_skill (ch, gsn_circle));
if (dt == gsn_twirl)
thac0 -= 10 * (100 - get_skill (ch, gsn_twirl));
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 **************
*/
if (((!str_cmp (class_table[victim->class].name, "shade"))
|| (!str_cmp (class_table[victim->class].name, "lich"))
|| (!str_cmp (class_table[victim->class].name, "fade"))
|| (!str_cmp (class_table[victim->class].name, "necromancer"))
|| (!str_cmp (class_table[victim->class].name, "banshee")))
&& (IS_OUTSIDE (victim))
&& (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]) / 100);
}
else // Night time
{
victim_ac -= ((victim_ac * vam_str[time_info.hour]) / 100);
}
}
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 * 2 * percent / 100);
}
else
{
dam = 1.5 * dam + (dam * percent / 100);
}
}
}
else
{
if(ch->class != CLASS_MONK && ch->class != CLASS_NINJA)
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 = 10; //100
sides = 19;
}
else if (ch->class == CLASS_MONK && ch->level > 80) {
ndice = 10; //90
sides = 17;
}
else if (ch->class == CLASS_NINJA && ch->level > 100) {
ndice = 10; //90
sides = 16;
}
else if (ch->level > 70) {
ndice = 9; //70
sides = 16;
}
else if (ch->level > 60) {
ndice = 9; //63
sides = 13;
}
else if (ch->level > 40) {
ndice = 8; //44
sides = 10;
}
else if (ch->level > 20) {
ndice = 4; //22.5
sides = 9;
}
dam = dice (ndice, sides - 100 );
if(has_skill(ch,gsn_vital_hit))
{
if( (get_skill(ch,gsn_vital_hit) / 12) > number_percent( ))
{
check_improve(ch,gsn_vital_hit,TRUE, 3);
dam = (dam * 7) / 5;
dt = gsn_vital_hit;
}
}
}
}
}
/*
* Bonuses.
*/
if (((!strcmp (class_table[ch->class].name, "vampire"))
|| (!strcmp (class_table[ch->class].name, "lich"))
|| (!strcmp (class_table[ch->class].name, "fade"))
|| (!strcmp (class_table[ch->class].name, "necromancer"))
|| (!strcmp (class_table[ch->class].name, "banshee")) )
&& (IS_OUTSIDE (ch))
&& (vam_str[time_info.hour] != 0))
{
if ((time_info.hour > 6) && (time_info.hour < 18))
{
dam -= ((dam * vam_str[time_info.hour]) / 75);
}
else
{
dam += ((dam * vam_str[time_info.hour]) / 125);
}
}
// Add Bonuses here
if (ch->class == CLASS_HIGHLANDER && get_skill(ch, gsn_blademastery) > 0)
{
int hroll;
hroll = number_percent ();
if (hroll*8 <= 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 *= 2;
hroll /= 3;
}
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;
if ((dt == gsn_backstab) && (wield != NULL) &&
(ch->class == CLASS_ASSASSIN || ch->class == CLASS_BARD ||
ch->class == CLASS_NINJA)) {
if (ch->level <= 15)
dam *= 3;
else if (ch->level <= 31)
dam *= 5;
else if (ch->level <= 47)
dam *= 7;
else if (ch->level <= 63)
dam *= 9;
else if (ch->level <= 79)
dam *= 11;
else if (ch->level <= 91)
dam *= 13;
else if (ch->level <= 101)
dam *= 15;
else
dam *= 16;
}
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_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_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 * 3/4;
af.duration = ch->level / 4;
af.location = APPLY_STR;
af.modifier = -1;
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);
}
}
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);
}
}
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);
}
}
if (ch->class == CLASS_HIGHLANDER && get_skill(ch, gsn_follow_through) > 0)
{
if (number_percent() < (get_skill(ch,gsn_follow_through) / 6))
{
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*2/10);
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*2/10);
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*2/10);
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*2/10);
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)/10))
{
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 * percent / 100);
}
}
if (is_affected(ch,gsn_fists_darkness) && dt != gsn_backstab && dt != gsn_circle)
{
if (wield == NULL && get_eq_char(ch,WEAR_SECONDARY) == NULL)
{
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*2/10);
}
}
}
if (check_open_palming(ch))
{
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 / 75);
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);
// 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/4,dam,TARGET_CHAR);
update_pos( victim );
}
if ( IS_WEAPON_STAT(wield, WEAPON_FROST) ) {
wdam = number_range( 1, wield->level / 15 + 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 / 15 + 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/2) ? 1 : victim->mana - (wdam/2));
ch->mana = UMIN(ch->max_mana,ch->mana + wdam);
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,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 (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);
ch->hit += dam/10;
if(!IS_SHIELDED(ch, SHD_SANCTUARY))
victim->hit += dam/2;
else
victim->hit += dam/4;
}
}
}
}
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->class, dam )*(ch->pcdata->power[POWER_LEVEL]);
else
dam += edam_bonus( ch->class, dam );
}
if (ch->class == CLASS_HIGHLANDER && dt == gsn_decapitate) {
int hroll;
if(ch->pcdata->power[POWER_LEVEL] != 0)
dam += edam_bonus( ch->class, dam ) * (ch->pcdata->power[POWER_LEVEL]+1);
else
dam += edam_bonus( ch->class, 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 += edam_bonus( ch->class, 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_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) / 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;
};
/*
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);
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->class, 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,1 + focus_sorc(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) || (ch->level < 110 && str_cmp(ch->name,"Anonymous")))
{
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);
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.5;
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.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(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.35)
dam -= dam * (float)((victim->toughness/5)/34)/10;
if (dam > 1 && ((IS_SHIELDED (victim, SHD_PROTECT_EVIL) && IS_EVIL (ch))
|| (IS_SHIELDED (victim, SHD_PROTECT_GOOD) && IS_GOOD (ch))))
dam -= dam / 5;
if (dam > 1 && (IS_SHIELDED (victim, SHD_STONE)))
dam -= dam / 10;
if (dam > 1 && (IS_SHIELDED (victim, SHD_STEEL)))
dam -= dam / 10;
/* Check for will of iron */
if( is_affected(ch,gsn_will_of_iron) && number_percent() < 40)
dam -= dam/3;
/*
* Parry, Shield Block, Dodge, Phase.
* Block, Roll, Acrobatics
*/
if (dt >= TYPE_HIT && ch != victim)
{
if (!(flags & DF_NOPARRY) &&
(check_parry (ch, victim)))
return FALSE;
if(victim->class == CLASS_MONK)
{
if (check_deflect(ch,victim,dt,dam))
return FALSE;
}
if (!(flags & DF_NOBLOCK) &&
(check_shield_block (ch, victim)))
return FALSE;
if (!(flags & DF_NODODGE) &&
(check_dodge (ch, victim)))
return FALSE;
if (check_phase (ch, victim))
return FALSE;
if (!(flags & DF_NOPARRY) && check_roll(ch, victim))
return FALSE;
if (!(flags & DF_NODODGE) && check_acrobatics(ch, victim))
return FALSE;
}
switch (check_immune(victim, dam_type))
{
case (IS_IMMUNE):
dam = 0;
break;
case (IS_RESISTANT):
dam -= dam/3.5 + number_range(dam/8,dam/12);
break;
case (IS_VULNERABLE):
dam += dam/3.5 + number_range(dam/8,dam/12);
break;
}
// AC
if(dam_type == DAM_BASH)
victim_ac = GET_AC(victim,AC_BASH);
else if(dam_type == DAM_SLASH)
victim_ac = GET_AC(victim,AC_SLASH);
else if(dam_type == DAM_PIERCE)
victim_ac = GET_AC(victim,AC_PIERCE);
else
victim_ac = GET_AC(victim,AC_EXOTIC);
/* if(victim->class == CLASS_HIGHLANDER)
{
dam -= dam * (-victim_ac * .00025);
}
else
{
dam -= dam * (-victim_ac * .0004375);
}
*/
// Sorn - New Damage Reduction
if(victim->class == CLASS_HIGHLANDER) {
if(victim_ac < -1729) {
dam -= dam * UMIN(.7,-victim_ac*.0002); }
else {
dam -= dam * ((-victim_ac-((-victim_ac*-victim_ac*3.0)/12100.0))*.00035); }
}
else {
if(victim_ac < -1900) {
dam -= dam * UMIN(.7,-victim_ac*.0003); }
else {
dam -= dam * ((-victim_ac-((-victim_ac*-victim_ac*2.0)/12100.0))*.0004375); }
}
if(IS_SET(ch->stance_aff,STANCE_AFF_AGGRESSIVE) &&
number_percent() < ch->stance[ch->stance[0]] * 0.5)
{
if(IS_SET(ch->stance_aff,STANCE_AFF_DOUBLE_POWER))
dam += dam * 0.18;
else
dam += dam * 0.10;
}
if(IS_SET(victim->stance_aff,STANCE_AFF_IMPROVED_DEFENSE) &&
number_percent() < victim->stance[victim->stance[0]] * 0.5)
{
dam -= dam * 0.10;
}
if ( dam < 0 )
dam = 0;
/* Do Check for Targetting Here */
/* if(!IS_NPC(ch) && !IS_NPC(victim))
{
for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
{
if(IS_NPC(gch) || gch == ch)
continue;
if (is_same_group (gch, ch) && !str_cmp(gch->pcdata->target,victim->name)
&& (victim->hit - dam) < 0 && !IN_ARENA(ch))
{
// No hit...Wait for the Assassination
return FALSE;
}
}
} */
/* change killer */
if(dt == gsn_whip && show)
{
dam_message_new(ch, victim, dam, dt, immune, DMF_WHIP);
rounddam += dam;
}
else
{
if (show)
dam_message (ch, victim, dam, dt, immune);
rounddam+= dam;
}
if(!IS_NPC(ch))
ch->pcdata->round_dam += dam;
if(IS_NPC(ch))
ch->pIndexData->round_dam += dam;
if (dam == 0)
return FALSE;
/*
* Hurt the victim.
* Inform the victim of his new state.
*/
victim->hit -= dam;
if (!IS_NPC (victim)
&& victim->level >= LEVEL_IMMORTAL
&& victim->hit < 1
&& !IS_SET(victim->in_room->room_flags, ROOM_ARENA))
victim->hit = 1;
update_pos (victim);
if(victim->hit < 1 && dt == gsn_poison && IS_NPC(victim))
victim->position = POS_MORTAL;
if (dt == gsn_feed)
{
ch->hit = UMIN (ch->hit + ((dam / 3) * 2), ch->max_hit);
update_pos (ch);
}
#if 0
/* If POS_MORTAL, POS_INCAP, or POS_DEAD and in arena, do arena stuff */
if ((arena == FIGHT_BUSY) && (victim->position < POS_STUNNED))
{
check_arena (ch, victim);
return TRUE;
}
#endif
if(!IS_NPC(victim) && !IS_NPC(ch))
{
if(IS_SET(ch->plyr,PLAYER_SUBDUE))
switch( victim->position )
{
case POS_MORTAL:
act( "You May DECAPITATE $N now!",ch,NULL, victim, TO_CHAR);
act ("{c$n is mortally wounded, and will die soon, if not aided.{x", victim, NULL, NULL, TO_ROOM);
send_to_char ("{cYou are mortally wounded, and will die soon, if not aided.{x\n\r", victim);
break;
case POS_INCAP:
act ("{c$n is incapacitated and will slowly die, if not aided.{x",
victim, NULL, NULL, TO_ROOM);
send_to_char (
"{cYou are incapacitated and will slowly {z{Rdie{x{c, if not aided.{x\n\r",
victim);
break;
case POS_STUNNED:
act ("{c$n is stunned, but will probably recover.{x",
victim, NULL, NULL, TO_ROOM);
send_to_char ("{cYou are stunned, but will probably recover.{x\n\r",
victim);
break;
default:
if(victim->hit <= -11)
{
send_to_char("You are mortally wounded, and will die soon, if not aided.\n\r",victim );
stop_fighting( ch, TRUE );
victim->hit = -10;
victim->position = POS_MORTAL;
}
break;
}
}
else /* This now handles cases where Ch or Victim is NPC */
{
switch (victim->position)
{
case POS_MORTAL:
act ("{c$n is mortally wounded, and will die soon, if not aided.{x", victim, NULL, NULL, TO_ROOM);
send_to_char ("{cYou are mortally wounded, and will die soon, if not aided.{x\n\r", victim);
break;
case POS_INCAP:
act ("{c$n is incapacitated and will slowly die, if not aided.{x",
victim, NULL, NULL, TO_ROOM);
send_to_char (
"{cYou are incapacitated and will slowly {z{Rdie{x{c, if not aided.{x\n\r",
victim);
break;
case POS_STUNNED:
act ("{c$n is stunned, but will probably recover.{x",
victim, NULL, NULL, TO_ROOM);
send_to_char ("{cYou are stunned, but will probably recover.{x\n\r",
victim);
break;
case POS_DEAD:
/* if ((IS_NPC(victim)) && ( victim->die_descr[0] != '\0'))
{
act( "{c$n $T{x", victim, 0, victim->die_descr, TO_ROOM );
}
else
{ */
act ("{c$n is {CDEAD!!{x", victim, 0, 0, TO_ROOM);
/* } */
send_to_char ("{cYou have been {RKILLED!!{x\n\r\n\r", victim);
break;
default:
if (dam > victim->max_hit / 2)
send_to_char ("{cThat really did {RHURT!{x\n\r", victim);
if (victim->hit < victim->max_hit / 4)
send_to_char ("{cYou sure are {z{RBLEEDING!{x\n\r", victim);
break;
}
}
/*
* Sleep spells and extremely wounded folks.
*/
if (!IS_AWAKE (victim))
stop_fighting (victim, FALSE);
/*
* Payoff for killing things.
*/
if (victim->position == POS_DEAD)
{
group_gain (ch, victim);
if (!IS_NPC (victim))
{
sprintf (log_buf, "%s killed by %s at %d",
victim->name,
(IS_NPC (ch) ? ch->short_descr : ch->name),
ch->in_room->vnum);
log_string (log_buf);
}
if(dt == gsn_decapitate)
{
// Put severed part here.
}
/*
* Death Trigger
*/
if (IS_NPC (victim) && HAS_TRIGGER (victim, TRIG_DEATH))
{
victim->position = POS_STANDING;
mp_percent_trigger (victim, ch, NULL, NULL, TRIG_DEATH);
}
if(!IS_NPC(ch) && !IS_NPC(victim) && is_pkill(ch) && is_pkill(victim) && victim->pcdata->bounty > 0 && !str_cmp(ch->pcdata->target,victim->name) && !(IN_ARENA(ch) || IN_ARENA(victim)))
{
do_mutilate(ch,victim);
}
raw_kill (victim, ch);
/* dump the flags */
if (ch != victim && !IS_NPC (ch) && (!is_same_clan (ch, victim)
|| clan_table[victim->clan].independent))
{
if (IS_SET (victim->act, PLR_TWIT))
REMOVE_BIT (victim->act, PLR_TWIT);
}
/* RT new auto commands */
if (!IS_NPC (ch) && IS_NPC (victim))
{
OBJ_DATA *coins;
corpse = get_obj_list (ch, "corpse", ch->in_room->contents);
if (IS_SET (ch->act, PLR_AUTOLOOT) &&
corpse && corpse->contains) /* exists and not empty */
do_get (ch, "all corpse");
if (IS_SET (ch->act, PLR_AUTOGOLD) &&
corpse && corpse->contains && /* exists and not empty */
!IS_SET (ch->act, PLR_AUTOLOOT))
{
if ((coins = get_obj_list (ch, "gcash", corpse->contains))
!= NULL)
do_get (ch, "all.gcash corpse");
}
if (IS_SET (ch->act, PLR_AUTOSAC))
{
if (IS_SET (ch->act, PLR_AUTOLOOT) && corpse && corpse->contains)
return TRUE; /* leave if corpse has treasure */
else
do_sacrifice (ch, "corpse");
}
}
return TRUE;
}
if (victim == ch)
return TRUE;
/*
* Take care of link dead people.
*/
if (!IS_NPC (victim) && victim->desc == NULL)
{
if (number_range (0, victim->wait) == 0)
{
do_recall (victim, "");
return TRUE;
}
}
/*
* Wimp out?
*/
if (IS_NPC (victim) && dam > 0 && victim->wait < PULSE_VIOLENCE / 2)
{
if ((IS_SET (victim->act, ACT_WIMPY) && number_bits (2) == 0
&& victim->hit < victim->max_hit / 5)
|| (IS_AFFECTED (victim, AFF_CHARM) && victim->master != NULL
&& victim->master->in_room != victim->in_room))
do_flee (victim, "");
}
if (!IS_NPC (victim)
&& IS_NPC (ch)
&& victim->hit > 0
&& victim->hit <= victim->wimpy
&& victim->wait < PULSE_VIOLENCE / 2)
do_flee (victim, "");
tail_chain ();
return TRUE;
}
/*
* Show damage from a mock hit.
*/
bool
damage_mock (CHAR_DATA * ch, CHAR_DATA * victim, int dam, int dt, int dam_type, bool show)
{
long immdam;
bool immune;
char buf1[256], buf2[256], buf3[256];
const char *attack;
if (victim->position == POS_DEAD)
return FALSE;
if (dam > 35)
dam = (dam - 35) / 2 + 35;
if (dam > 80)
dam = (dam - 80) / 2 + 80;
if (is_safe_mock (ch, victim))
return FALSE;
/*
* 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.35)
dam -= dam * (float)((victim->toughness/5)/34)/10;
if (dam > 1 && ((IS_SHIELDED (victim, SHD_PROTECT_EVIL) && IS_EVIL (ch))
|| (IS_SHIELDED (victim, SHD_PROTECT_GOOD) && IS_GOOD (ch))))
dam -= dam / 6;
if (dam > 1 && (IS_SHIELDED (victim, SHD_STONE)))
dam -= dam / 10;
if (dam > 1 && (IS_SHIELDED (victim, SHD_STEEL)))
dam -= dam / 10;
immune = FALSE;
switch (check_immune (victim, dam_type))
{
case (IS_IMMUNE):
immune = TRUE;
dam = 0;
break;
case (IS_RESISTANT):
dam -= dam / 3;
break;
case (IS_VULNERABLE):
dam += dam / 2;
break;
}
if (dt >= 0 && dt < MAX_SKILL)
attack = skill_table[dt].noun_damage;
else if (dt >= TYPE_HIT
&& dt <= TYPE_HIT + MAX_DAMAGE_MESSAGE)
attack = attack_table[dt - TYPE_HIT].noun;
else
{
bug ("Dam_message: bad dt %d.", dt);
dt = TYPE_HIT;
attack = attack_table[0].name;
}
immdam = 0;
if (ch->level == MAX_LEVEL)
{
immdam = dam * 63;
}
if (ch == victim)
{
sprintf (buf1, "{y$n's {gmock {B%s{g would have done {R%d hp{g damage to {y$mself{g.{x", attack, dam);
sprintf (buf2, "{yYour {gmock {B%s{g would have done {R%d hp{g damage to {yyourself{g.{x", attack, dam);
act (buf1, ch, NULL, NULL, TO_ROOM);
act (buf2, ch, NULL, NULL, TO_CHAR);
}
else if (ch->level < MAX_LEVEL)
{
sprintf (buf1, "{y$n's {gmock {B%s{g would have done {R%d hp{g damage to {y$N{g.{x", attack, dam);
sprintf (buf2, "{yYour {gmock {B%s{g would have done {R%d hp{g damage to {y$N{g.{x", attack, dam);
sprintf (buf3, "{y$n's {gmock {B%s{g would have done {R%d hp{g damage to {yyou{g.{x", attack, dam);
act (buf1, ch, NULL, victim, TO_NOTVICT);
act (buf2, ch, NULL, victim, TO_CHAR);
act (buf3, ch, NULL, victim, TO_VICT);
}
else
{
sprintf (buf1, "{y$n's {gmock {B%s{g would have done {R%lu hp{g damage to {y$N{g.{x", attack, immdam);
sprintf (buf2, "{yYour {gmock {B%s{g would have done {R%lu hp{g damage to {y$N{g.{x", attack, immdam);
sprintf (buf3, "{y$n's {gmock {B%s{g would have done {R%lu hp{g damage to {yyou{g.{x", attack, immdam);
act (buf1, ch, NULL, victim, TO_NOTVICT);
act (buf2, ch, NULL, victim, TO_CHAR);
act (buf3, ch, NULL, victim, TO_VICT);
}
tail_chain ();
return TRUE;
}
/*
* Inflict damage from a hit.
*/
bool damage_old (CHAR_DATA * ch, CHAR_DATA * victim, int dam, int dt, int dam_type, bool show)
{
return damage(ch,victim,dam,dt,dam_type,show,0);
return TRUE;
}
bool is_safe (CHAR_DATA * ch, CHAR_DATA * victim)
{
if (victim->in_room == NULL || ch->in_room == NULL)
return TRUE;
if (IS_NPC(ch) && victim->invis_level >= LEVEL_HERO)
return TRUE;
/* LinkDead */
if (!IS_NPC(victim) && victim->desc == NULL && !IS_NPC(ch)
&& victim->fighting != ch && ch->fighting != victim)
{
act("$N is protected from $n by the Aesir.",ch,0,victim,TO_NOTVICT);
act("The Aesir protect $N from you.",ch,0,victim,TO_CHAR);
return TRUE;
}
if (victim->fighting == ch || victim == ch)
return FALSE;
if(IS_SET(victim->plyr,PLAYER_GHOST) && (!IS_NPC(ch)))
{
act("$N is a ghost, you cannot attack them.",ch,NULL,victim,TO_CHAR);
act("The Aesir protects you from $n.",ch,NULL,victim,TO_VICT);
act("$N is protected from $n by the immortals.",ch,NULL,victim,TO_NOTVICT);
return TRUE;
}
else if(IS_SET(ch->plyr,PLAYER_GHOST))
{
if (!IS_NPC(victim))
{
send_to_char("You're a ghost! you can't attack anyone!\n\r",ch);
act("The Aesir protects you from $n.",ch,NULL,victim,TO_VICT);
act("$N is protected from $n by the immortals.",ch,NULL,victim,TO_NOTVICT);
return TRUE;
}
if (IS_AFFECTED(victim,AFF_CHARM) && victim->master != NULL
&& !IS_NPC(victim->master))
{
send_to_char("You're a ghost! you can't attack anyone!\n\r",ch);
act("The Aesir protects you from $n.",ch,NULL,victim,TO_VICT);
act("$N is protected from $n by the immortals.",ch,NULL,victim,TO_NOTVICT);
return TRUE;
}
}
/* Clan stuff */
if (IS_SET(victim->plyr,PLAYER_ANCIENT_ENEMY))
{
if (IS_NPC(ch) && ch->spec_fun == spec_lookup("spec_cloaked_enforcer"))
return FALSE;
}
if (IS_NPC(victim) && victim->spec_fun == spec_lookup("spec_cloaked_enforcer"))
return FALSE;
/* killing mobiles */
if (IS_NPC (victim))
{
/* safe room? */
if (IS_SET (victim->in_room->room_flags, ROOM_SAFE))
{
send_to_char ("Not in this room.\n\r", ch);
return TRUE;
}
/* safe room? */
if (IS_SET(victim->in_room->affected_by, ROOM_AFF_SAFE))
{
send_to_char ("Not in this room.\n\r", ch);
return TRUE;
}
if (!IS_NPC (ch) && IS_SET (victim->in_room->room_flags, ROOM_CLAN_ENT))
{
send_to_char ("Not in this room.\n\r", ch);
return TRUE;
}
if (victim->pIndexData->pShop != NULL)
{
send_to_char ("The shopkeeper wouldn't like that.\n\r", ch);
return TRUE;
}
if (is_same_clan (ch, victim))
{
send_to_char ("You can't fight your own clan members.\n\r", ch);
return TRUE;
}
if (!IS_NPC(ch))
{
/* Only in master's PK */
if (IS_AFFECTED(victim,AFF_CHARM) && !can_pkill(ch,victim->master))
{
act("The Aesir protect $N from $n.",ch,0,victim,TO_NOTVICT);
act("The Aesir protect you from $n.",ch,0,victim,TO_VICT);
act("The Aesir protect $N from you.",ch,0,victim,TO_CHAR);
return TRUE;
}
}
else
{
if (IS_AFFECTED(ch,AFF_CHARM) && IS_AFFECTED(victim,AFF_CHARM)
&& !can_pkill(ch->master,victim->master))
return TRUE;
}
/* no killing healers, trainers, etc */
if (IS_SET (victim->act, ACT_TRAIN)
|| IS_SET (victim->act, ACT_PRACTICE)
|| IS_SET (victim->act, ACT_IS_HEALER)
|| IS_SET (victim->act, ACT_IS_BANKER)
|| IS_SET (victim->act, ACT_IS_SATAN)
|| (victim->spec_fun == spec_lookup ("spec_questmaster"))
|| IS_SET (victim->act, ACT_IS_PRIEST))
{
act ("I don't think $G would approve.", ch, NULL, NULL, TO_CHAR);
return TRUE;
}
/*
if (!IS_NPC (ch))
{
no pets
if (IS_SET (victim->act, ACT_PET))
{
act ("But $N looks so cute and cuddly...",ch, NULL, victim, TO_CHAR);
return TRUE;
}
no charmed creatures unless owner
if (IS_AFFECTED (victim, AFF_CHARM) && ch != victim->master)
{
send_to_char ("You don't own that monster.\n\r", ch);
return TRUE;
}
} */
}
/* killing players */
else
{
/* NPC doing the killing */
if (IS_NPC (ch))
{
/* safe room check */
if (IS_SET (victim->in_room->room_flags, ROOM_SAFE))
{
send_to_char ("Not in this room.\n\r", ch);
return TRUE;
}
/* safe room? */
if (IS_SET(victim->in_room->affected_by, ROOM_AFF_SAFE))
{
send_to_char ("Not in this room.\n\r", ch);
return TRUE;
}
/* charmed mobs and pets cannot attack players while owned */
if (IS_AFFECTED (ch, AFF_CHARM) && ch->master != NULL
&& ch->master->fighting != victim)
{
send_to_char ("Players are your friends!\n\r", ch);
return TRUE;
}
}
/* player doing the killing */
else
{
if(IS_SET (victim->act, PLR_TWIT))
return FALSE;
if (victim->level < 5)
{
send_to_char("Are you trying to be a newbie killer or something?",ch);
return TRUE;
}
if (IS_AFFECTED (ch, AFF_CHARM) )
{
send_to_char ("You have a master now, sit still and listen to them!\n\r", ch);
return TRUE;
}
// no attacking in arena unless named in current challenge
if ((IS_SET (victim->in_room->room_flags, ROOM_ARENA)) &&
(in_current_challenge(ch->name) == 0))
{
send_to_char ("You're not involved in the current challenge.\n\r", ch );
return TRUE;
}
// teammate in arena?
if ((IS_SET (victim->in_room->room_flags, ROOM_ARENA)) &&
(in_current_challenge(ch->name) == in_current_challenge(victim->name)))
{
send_to_char( "You can't attack your teammates.\n\r", ch );
return TRUE;
}
// enemy in arena?
if ((IS_SET (victim->in_room->room_flags, ROOM_ARENA)) &&
(in_current_challenge(ch->name) !=
in_current_challenge(victim->name)))
return FALSE;
if (!can_pkill(ch, victim))
{
act("The Aesir protect $N from $n.",ch,0,victim,TO_NOTVICT);
act("The Aesir protect you from $n.",ch,0,victim,TO_VICT);
act("The Aesir protect $N from you.",ch,0,victim,TO_CHAR);
return TRUE;
}
if(IS_SET(victim->shielded_by,SHD_PROTECT_AURA)
|| IS_SET(ch->shielded_by,SHD_PROTECT_AURA))
return TRUE;
if (!is_clan (ch))
{
send_to_char ("Join a clan if you want to fight players.\n\r", ch);
return TRUE;
}
if (!is_pkill (ch))
{
send_to_char ("Your clan does not allow player fighting.\n\r", ch);
return TRUE;
}
if (!is_clan (victim))
{
send_to_char ("They aren't in a clan, leave them alone.\n\r", ch);
return TRUE;
}
if (!is_pkill (victim))
{
send_to_char ("They are in a no pkill clan, leave them alone.\n\r", ch);
return TRUE;
}
if (is_same_clan (ch, victim) && !(IS_SET (victim->in_room->room_flags, ROOM_ARENA)))
{
send_to_char ("You can't fight your own clan members.\n\r", ch);
return TRUE;
}
if(victim->fight_timer > 0)
return FALSE;
if (IS_SET (victim->in_room->room_flags, ROOM_SAFE)
&& (victim->in_room->vnum == ROOM_ARENA_LOUNGE ||
victim->in_room->vnum == ROOM_ARENA_HI ||
victim->in_room->vnum == ROOM_ARENA_LO))
{
send_to_char ("Not in this room.\n\r", ch);
return TRUE;
}
/* safe room? */
if (IS_SET (victim->in_room->affected_by, ROOM_AFF_SAFE))
{
send_to_char ("Not in this room.\n\r", ch);
return TRUE;
}
if (ch->on_quest)
{
send_to_char ("Not while you are on a quest.\n\r", ch);
return TRUE;
}
if (victim->on_quest)
{
send_to_char ("They are on a quest, leave them alone.\n\r", ch);
return TRUE;
}
}
}
return FALSE;
}
bool is_safe_quiet (CHAR_DATA * ch, CHAR_DATA * victim)
{
if (victim->in_room == NULL || ch->in_room == NULL)
return TRUE;
if (IS_NPC(ch) && victim->invis_level >= LEVEL_HERO)
return TRUE;
/* LinkDead */
if (!IS_NPC(victim) && victim->desc == NULL && !IS_NPC(ch)
&& victim->fighting != ch && ch->fighting != victim)
{
//act("$N is protected from $n by the Aesir.",ch,0,victim,TO_NOTVICT);
//act("The Aesir protect $N from you.",ch,0,victim,TO_CHAR);
return TRUE;
}
if (victim->fighting == ch || victim == ch)
return FALSE;
if(IS_SET(victim->plyr,PLAYER_GHOST) && (!IS_NPC(ch)))
{
//act("$N is a ghost, you cannot attack them.",ch,NULL,victim,TO_CHAR);
//act("The Aesir protects you from $n.",ch,NULL,victim,TO_VICT);
//act("$N is protected from $n by the immortals.",ch,NULL,victim,TO_NOTVICT);
return TRUE;
}
else if(IS_SET(ch->plyr,PLAYER_GHOST))
{
if (!IS_NPC(victim))
{
//send_to_char("You're a ghost! you can't attack anyone!\n\r",ch);
//act("The Aesir protects you from $n.",ch,NULL,victim,TO_VICT);
//act("$N is protected from $n by the immortals.",ch,NULL,victim,TO_NOTVICT);
return TRUE;
}
if (IS_AFFECTED(victim,AFF_CHARM) && victim->master != NULL
&& !IS_NPC(victim->master))
{
//send_to_char("You're a ghost! you can't attack anyone!\n\r",ch);
//act("The Aesir protects you from $n.",ch,NULL,victim,TO_VICT);
//act("$N is protected from $n by the immortals.",ch,NULL,victim,TO_NOTVICT);
return TRUE;
}
}
/* Clan stuff */
if (IS_SET(victim->plyr,PLAYER_ANCIENT_ENEMY))
{
if (IS_NPC(ch) && ch->spec_fun == spec_lookup("spec_cloaked_enforcer"))
return FALSE;
}
if (IS_NPC(victim) && victim->spec_fun == spec_lookup("spec_cloaked_enforcer"))
return FALSE;
/* killing mobiles */
if (IS_NPC (victim))
{
/* safe room? */
if (IS_SET (victim->in_room->room_flags, ROOM_SAFE))
{
//send_to_char ("Not in this room.\n\r", ch);
return TRUE;
}
/* safe room? */
if (IS_SET(victim->in_room->affected_by, ROOM_AFF_SAFE))
{
//send_to_char ("Not in this room.\n\r", ch);
return TRUE;
}
if (!IS_NPC (ch) && IS_SET (victim->in_room->room_flags, ROOM_CLAN_ENT))
{
//send_to_char ("Not in this room.\n\r", ch);
return TRUE;
}
if (victim->pIndexData->pShop != NULL)
{
//send_to_char ("The shopkeeper wouldn't like that.\n\r", ch);
return TRUE;
}
if (is_same_clan (ch, victim))
{
//send_to_char ("You can't fight your own clan members.\n\r", ch);
return TRUE;
}
if (!IS_NPC(ch))
{
/* Only in master's PK */
if (IS_AFFECTED(victim,AFF_CHARM) && !can_pkill(ch,victim->master))
{
//act("The Aesir protect $N from $n.",ch,0,victim,TO_NOTVICT);
//act("The Aesir protect you from $n.",ch,0,victim,TO_VICT);
//act("The Aesir protect $N from you.",ch,0,victim,TO_CHAR);
return TRUE;
}
}
else
{
if (IS_AFFECTED(ch,AFF_CHARM) && IS_AFFECTED(victim,AFF_CHARM)
&& !can_pkill(ch->master,victim->master))
return TRUE;
}
/* no killing healers, trainers, etc */
if (IS_SET (victim->act, ACT_TRAIN)
|| IS_SET (victim->act, ACT_PRACTICE)
|Showing the first 100 KB of 310.9 KB. Download the archive for the full file.