fight.c
atd/src/fight.c · 211.2 KB
From the archive AtDv2.0.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. *
***************************************************************************/
/***************************************************************************
* God Wars Mud originally written by KaVir aka Richard Woolcock. *
* Changes done to the code done by Sage aka Walter Howard, this mud is *
* for the public, however if you run this code it means you agree *
* to the license.low, license.gw, and license.merc have fun. :) *
***************************************************************************/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "leader.h"
#include "commands.h"
#include "angel.h"
#include "priest.h"
#define MONK_AUTODROP ch->pcdata->autostance
/*
* Local functions.
*/
void autodrop args( ( CHAR_DATA *ch) );
bool check_dodge args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) );
void check_killer args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
bool check_parry args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) );
void dam_message args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt ) );
void death_cry args( ( CHAR_DATA *ch ) );
void group_gain args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
int xp_compute args( ( CHAR_DATA *gch, CHAR_DATA *victim ) );
void set_fighting args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
bool can_counter args( ( CHAR_DATA *ch) );
bool can_bypass args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
int number_attacks args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
int dambonus args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int stance) );
void update_damcap args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
int add_bonuses args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt ) );
int get_maxq args( ( CHAR_DATA *ch ) );
int count_artifacts args( ( CHAR_DATA *ch ) );
int count_satanic args( ( CHAR_DATA *ch ) );
#define MIN_CRIT_PER 20
#define MAX_CRIT_PER 400
bool will_crit( CHAR_DATA *ch, CHAR_DATA *victim )
{
int per1 = number_range( MIN_CRIT_PER, MAX_CRIT_PER );
int per2 = number_range( MIN_CRIT_PER, MAX_CRIT_PER );
if( IS_NPC(ch) )
{
if( IS_SET(ch->act, ACT_SKILLED) && number_percent( ) > 75 )
return TRUE;
return FALSE;
}
if( !can_see(ch,victim) )
return FALSE;
if( IS_SET(ch->extra,FROUND) )
return FALSE;
if( IS_ITEMAFF( ch, ITEMA_CRITICALS ) )
{
if( get_curr_int(ch) > per1 )
return TRUE;
return FALSE;
}
if( get_curr_int(ch) < per1
|| get_curr_int(ch) < per2 )
return FALSE;
return TRUE;
}
int crit_damage( CHAR_DATA *ch, CHAR_DATA *victim )
{
int dam;
int x = 100;
dam = ch->damcap[DAM_CAP];
if( IS_NPC(ch))
{
dam *= number_range(105,120);
return (dam/100);
}
if( ch->level < 3 )
dam *= number_range( 105, 120 );
else
switch( ch->class )
{
default: dam *= number_range( 105, 120 ); break;
case CLASS_MONK:
x += ch->monkab[AWARE];
x += ch->monkab[COMBAT];
x += ch->chi[CURRENT]; /* max of 14 */
dam *= number_range( x, x+20);
break;
case CLASS_NINJA:
x = PC(ch,powers)[NPOWER_NINGENNO]; /* max of 7 */
dam *= number_range( x+110, 100+x*4 );
break;
case CLASS_VAMPIRE:
x += PC(ch,powers)[VAM_QUIE];
x += PC(ch,powers)[VAM_POTE]; /* max of 10 */
dam *= number_range( x, x+5 );
break;
case CLASS_PRIEST:
dam *= number_range( 120, 130 );
break;
case CLASS_DROW:
x = 5;
if( room_is_dark( ch->in_room ) )
x += 15;
dam *= number_range( 100+x, 100+x*2 );
break;
case CLASS_WEREWOLF:
x += URANGE( 10, ch->gnosis[GCURRENT], 30 );
dam *= number_range( 110, x );
break;
case CLASS_MAGE:
x += URANGE( 1, ch->quint[CURRENT], 20 );
dam *= number_range( 101, x );
break;
}
dam /= 100;
if( IS_ITEMAFF(ch,ITEMA_CRITICALS) )
dam += number_range( 3000, 4500 );
return dam;
}
/*
* Control the fights going on.
* Called periodically by update_handler.
*
*/
void violence_update( void )
{
CHAR_DATA *ch;
CHAR_DATA *ch_next;
CHAR_DATA *victim;
CHAR_DATA *rch;
CHAR_DATA *rch_next;
CHAR_DATA *mount;
char buf[MAX_STRING_LENGTH];
int chance;
chance = number_percent();
for ( ch = char_list; ch != NULL; ch = ch->next )
{
if ( ch->hunting != NULL && ch->hunting != '\0' &&
strlen(ch->hunting) > 1 )
{
check_hunt( ch );
continue;
}
if ( chance > 60 && ch->position == POS_FIGHTING &&
IS_CLASS(ch, CLASS_DEMON) && IS_SET(ch->warp, WARP_SCARED))
{
do_flee(ch,"");
send_to_char("You are so scared you flee from combat, COWARD!\n\r", ch );
return;
}
victim = ch->blinkykill;
if (ch->blinkykill == NULL) continue;
if (IS_SET(ch->flag2, AFF2_BLINK_1ST_RD))
{
REMOVE_BIT(ch->flag2, AFF2_BLINK_1ST_RD);
SET_BIT(ch->flag2, AFF2_BLINK_2ND_RD);
}
else if (IS_SET(ch->flag2, AFF2_BLINK_2ND_RD))
{
REMOVE_BIT(ch->flag2, AFF2_BLINK_2ND_RD);
REMOVE_BIT(ch->flag2, AFF2_BLINK_1ST_RD);
if (ch->blinkykill->in_room != ch->in_room)
{
ch->blinkykill = NULL;
act("$n pops back into existence.", ch, NULL, NULL, TO_ROOM);
send_to_char("You pop back into existence.\n\r", ch);
send_to_char("Your victim is no longer in the room.\n\r", ch);
break;
}
act("$n pops back into existence next to $N.", ch, NULL, ch->blinkykill, TO_NOTVICT);
act("You pop back into existence next to $N.", ch, NULL, ch->blinkykill, TO_CHAR);
act("$n pops back into existence next to you.", ch, NULL, ch->blinkykill, TO_VICT);
set_fighting(ch, ch->blinkykill);
ch->blinkykill = NULL;
multi_hit(ch, victim, gsn_blinky);
multi_hit(ch, victim, gsn_blinky);
update_pos(victim);
}
}
for ( ch = char_list; ch != NULL; ch = ch->next )
{
ch_next = ch->next;
if ( ch->fighting &&
ch->in_room != ch->fighting->in_room )
{
stop_fighting( ch, FALSE );
stop_fighting( ch->fighting, FALSE );
}
if ( is_memb( ch ) )
return;
if (ch->silence_timer > 0)
{
ch->silence_timer--;
if (ch->silence_timer < 1)
{
if (IS_SET(ch->newbits, NEW_SILENCE))
{
act("The room is no longer silent.",ch,NULL,NULL,TO_CHAR);
act("The room is no longer silent.",ch,NULL,NULL,TO_ROOM);
REMOVE_BIT(ch->in_room->affected_by,ROOM2_SILENCE);
REMOVE_BIT(ch->newbits, NEW_SILENCE);
ch->silence_timer = 60;
}
else send_to_char("Your ability to call the Silence of Death has returned.\n\r",ch);
}
}
if (ch->obeah_timer > 0 && !IS_SET(ch->newbits, NEW_NEUTRAL))
{
ch->obeah_timer--;
if (ch->obeah_timer < 1)
{
if (IS_WEREWOLF(ch))
send_to_char("Your healing powers have returned.\n\r",ch);
else
{
send_to_char("Your third eye stops glowing.\n\r",ch);
act("The eye in $n's forehead stops glowing.",ch,NULL,NULL,TO_ROOM);
}
}
}
if (ch->reina_timer > 0)
{
ch->reina_timer--;
if (ch->reina_timer < 1)
{
if (IS_SET(ch->newbits, NEW_REINA))
{
send_to_char("The peaceful harmony in the air gradually fades away to nothing.\n\r",ch);
act("The peaceful harmony in the air gradually fades away to nothing.",ch,NULL,NULL,TO_ROOM);
REMOVE_BIT(ch->in_room->affected_by, ROOM_SAFE);
REMOVE_BIT(ch->newbits, NEW_REINA);
ch->reina_timer = 60;
}
else if (IS_WEREWOLF(ch))
{
send_to_char("You may once again use madness.\n\r", ch);
REMOVE_BIT(ch->affected_by, AFF_STEELSHIELD);
}
else send_to_char("You have recovered your voice.\n\r",ch);
REMOVE_BIT(ch->affected_by, AFF_STEELSHIELD);
}
}
if (ch->cobra_timer > 0)
{
ch->cobra_timer--;
if (ch->cobra_timer < 1) {
if (IS_WEREWOLF(ch))
{
send_to_char("You may once again use eyes of the cobra\n\r",ch);
}
else
send_to_char("EMPTY PLACE FOR A NEW MESSAGE..:)\n\r",ch);
}
}
if (ch->majesty_timer > 0) {
ch->majesty_timer--;
if (ch->majesty_timer < 1) {
if (IS_WEREWOLF(ch))
{
send_to_char("You may now use your icy chill of despair\n\r",ch);
}
else
send_to_char("Your may once again use majesty.\n\r",ch);
}
}
if (ch->darkness_timer > 0)
ch->darkness_timer--;
if (ch->arena_timer > 0)
ch->arena_timer--;
if (ch->arena_timer < 1)
{
if ( IS_SET(ch->flag2, AFF2_INARENA) || IS_SET(ch->flag2, AFF2_CHALLENGED) || IS_SET(ch->flag2, AFF2_CHALLENGER))
{
REMOVE_BIT(ch->flag2, AFF2_CHALLENGED);
REMOVE_BIT(ch->flag2, AFF2_CHALLENGER);
REMOVE_BIT(ch->flag2, AFF2_INARENA );
undo_arena(ch);
arena = FIGHT_CLEAR;
sprintf(buf,"The arena is no longer busy!");
do_info(ch,buf);
send_to_char("You waited to long, arena status cleared!\n\r", ch);
}
}
if (ch->wyld_timer > 0)
ch->wyld_timer--;
if (ch->fight_timer > 0)
ch->fight_timer--;
if (ch->hit < 1)
update_pos( ch );
if ( IS_SET(ch->monkstuff, MONK_DEATH) )
{
if ( ch->position < POS_STUNNED )
{
REMOVE_BIT( ch->monkstuff, MONK_DEATH );
send_to_char("You feel the magical forces leave your body.\n\r",ch);
act("The magical forces leave $n's body.",ch,NULL,NULL,TO_ROOM);
}
else if ( ch->hit > (ch->max_hit /2 ) )
{
ch->hit -= number_range( 50,200 );
send_to_char("Your writhe in agony as magical energies tear you asunder.\n\r",ch);
act("$n's writhes in agony as magical forces tear apart $s body.",ch,NULL,NULL,TO_ROOM);
}
else
{
if ( number_range( 1,2 ) == 1 )
{
send_to_char("You feel the magical forces leave your body.\n\r",ch);
act("The magical forces leave $n's body.",ch,NULL,NULL,TO_ROOM);
REMOVE_BIT(ch->monkstuff, MONK_DEATH);
}
else
{
ch->hit -= number_range( 50,200 );
send_to_char("Your writhe in agony as magical energies tear you asunder.\n\r",ch);
act("$n's writhes in agony as magical forces tear apart $s body.",ch,NULL,NULL,TO_ROOM);
}
}
}
if ( IS_SET(ch->monkstuff, MONK_HEAL) )
{
if( ch->position < POS_STUNNED )
{
REMOVE_BIT( ch->monkstuff, MONK_HEAL);
send_to_char("The sparks fizzle and die.\n\r",ch);
}
else if ( ch->hit < (ch->max_hit/2) )
{
if ( ch->hit < ch->max_hit )
ch->hit += number_range( 5000,10000 );
if ( ch->move < ch->max_move )
ch->move += number_range( 1750,4000 );
send_to_char("Your body emits glowing sparks.\n\r",ch);
act("$n's body emits glowing sparks and fizzes.",ch,NULL,NULL,TO_ROOM);
}
else
{
if ( number_range( 1,2 ) == 1 )
{
send_to_char("The sparks fizzle and die.\n\r",ch);
act("The sparks around $n's body fizzle and die.",ch,NULL,NULL,TO_ROOM);
REMOVE_BIT(ch->monkstuff, MONK_HEAL);
}
else
{
if ( ch->hit < ch->max_hit )
ch->hit += number_range( 5000,10000 );
if ( ch->move < ch->max_move )
ch->move += number_range( 1750,4000 );
send_to_char("Your body emits glowing sparks.\n\r",ch);
act("$n's body emits glowing sparks and fizzes.",ch,NULL,NULL,TO_ROOM);
}
}
}
if ( IS_SET(ch->newbits, NEW_POWER) )
{
if ( ch->move < 75 )
do_spiritpower(ch,"");
else
ch->move -= 15;
}
if ( ch->chi[CURRENT] > 0 && IS_CLASS(ch,CLASS_MONK) )
{
if ( ch->move > (ch->chi[CURRENT] * 50 ) )
ch->move -= ch->chi[CURRENT] * 50;
else
{
if ( ch->chi[CURRENT] > 0 )
{
send_to_char("You feel exhausted, and lose control of your ch'i.\n\r",ch);
ch->chi[CURRENT] -= 1;
}
}
}
if ( ( victim = ch->fighting ) == NULL || ch->in_room == NULL )
continue;
if (!IS_NPC(ch) && !IS_NPC(victim) && !is_safe(ch, victim)
&& !is_safe(victim,ch))
ch->fight_timer = 10;
if ( IS_AWAKE(ch) && IS_AWAKE(victim) &&
ch->in_room == victim->in_room )
{
multi_hit( ch, victim, TYPE_UNDEFINED );
}
if (IS_CLASS(ch, CLASS_DROW)
&& IS_POLYAFF(ch,POLY_SPIDERFORM)
&& IS_SET(ch->pcdata->powers[1], DPOWER_ARMS))
multi_hit(ch, victim, gsn_spiderform);
if ( ( victim = ch->fighting ) == NULL )
continue;
for ( rch = ch->in_room->people; rch != NULL; rch = rch_next )
{
rch_next = rch->next_in_room;
if ( IS_AWAKE(rch) && rch->fighting == NULL )
{
if ( (mount = rch->mount) != NULL )
{
if (mount == ch) multi_hit( rch, victim, TYPE_UNDEFINED );
continue;
}
if ( !IS_NPC(ch) || IS_AFFECTED(ch, AFF_CHARM) )
{
if ( ( !IS_NPC(rch) || IS_AFFECTED(rch, AFF_CHARM) )
&& is_same_group(ch, rch) )
multi_hit( rch, victim, TYPE_UNDEFINED );
continue;
}
if ( IS_NPC(rch) && !IS_AFFECTED(rch, AFF_CHARM) )
{
if ( rch->pIndexData == ch->pIndexData
|| number_bits( 3 ) == 0 )
{
CHAR_DATA *vch;
CHAR_DATA *target;
int number;
target = NULL;
number = 0;
for ( vch = ch->in_room->people; vch; vch = vch->next )
{
if ( can_see( rch, vch )
&& is_same_group( vch, victim )
&& number_range( 0, number ) == 0 )
{
target = vch;
number++;
}
}
if ( target != NULL )
multi_hit( rch, target, TYPE_UNDEFINED );
}
}
}
}
}
return;
}
/*
* Do one group of attacks.
*/
void multi_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
{
OBJ_DATA *wield;
OBJ_DATA *wield1;
OBJ_DATA *wield2;
OBJ_DATA *wield3;
OBJ_DATA *wield4;
int sn;
int level;
int chance;
int unarmed;
int wieldorig = 0;
int wieldtype = 0;
int maxcount;
int countup;
int wieldie;
if ( ch->position < POS_SLEEPING ) return;
/*
* Moved the following safe checks to before the dt =='s
* --Dreimas
*/
if (!IS_NPC(ch) && IS_ITEMAFF(ch, ITEMA_PEACE))
{
send_to_char( "You are unable to attack them.\n\r", ch );
return;
}
if (!IS_NPC(victim) && IS_ITEMAFF(victim, ITEMA_PEACE))
{
send_to_char( "You can't seem to attack them.\n\r", ch );
return;
}
if (!IS_NPC(ch) && IS_AFFECTED(ch, AFF_SAFE) )
{
send_to_char( "You cannot attack people under Gaia's protection.\n\r", ch );
return;
}
if (!IS_NPC(victim) && IS_AFFECTED(victim, AFF_SAFE) )
{
send_to_char( "You cannot attack people under Gaia's protection.\n\r", ch );
return;
}
if (!IS_NPC(victim) && IS_AFFECTED(victim, AFF_STEELSHIELD) )
{
send_to_char( "You cannot attack them while they are in majesty.\n\r", ch );
return;
}
if (!IS_NPC(victim) && IS_AFFECTED(victim, AFF_STEELSHIELD) )
{
send_to_char( "They are protected by a powerful being.\n\r", ch );
return;
}
if ( dt == gsn_spiket )
{
one_hit( ch, victim, dt, 1 );
return;
}
if ( dt == gsn_magma )
{
one_hit( ch, victim, dt, 1 );
return;
}
if ( dt == gsn_shards )
{
one_hit( ch, victim, dt, 1 );
return;
}
if ( dt == gsn_venomt )
{
one_hit( ch, victim, dt, 1 );
return;
}
if ( dt == gsn_headbutt )
{
one_hit( ch, victim, dt, 1 );
return;
}
if ( dt == gsn_quills)
{
one_hit(ch,victim,dt,1);
return;
}
if ( dt == gsn_spiderform )
{
one_hit( ch, victim, dt, 2 );
one_hit( ch, victim, dt, 2 );
one_hit( ch, victim, dt, 4 );
one_hit( ch, victim, dt, 4 );
one_hit( ch, victim, dt, 6 );
one_hit( ch, victim, dt, 6 );
one_hit( ch, victim, dt, 8 );
one_hit( ch, victim, dt, 8 );
return;
}
if ( dt == gsn_tail )
{
one_hit( ch, victim, dt, 1 );
return;
}
wield1 = get_eq_char( ch, WEAR_WIELD );
wield2 = get_eq_char( ch, WEAR_HOLD );
if ( wield1 != NULL && wield1->item_type == ITEM_WEAPON ) wieldorig = 1;
if ( wield2 != NULL && wield2->item_type == ITEM_WEAPON ) wieldorig += 2;
wieldtype = wieldorig;
wield1 = get_eq_char( ch, WEAR_WIELD );
wield2 = get_eq_char( ch, WEAR_HOLD );
wield3 = get_eq_char( ch, WEAR_THIRD );
wield4 = get_eq_char( ch, WEAR_FOURTH);
if ( wield1 != NULL && wield1->item_type == ITEM_WEAPON ) wieldorig = 1;
if ( wield2 != NULL && wield2->item_type == ITEM_WEAPON ) wieldorig += 2;
if ( wield3 != NULL && wield3->item_type == ITEM_WEAPON ) wieldorig += 4;
if ( wield4 != NULL && wield4->item_type == ITEM_WEAPON ) wieldorig += 8;
wieldtype = wieldorig;
wieldie = number_range(1,4);
if ( wieldorig == 15 )
{
if (wieldie == 2)
wieldtype = 8;
else
wieldtype = 4;
}
if ( wieldorig == 14 )
{
if (wieldie == 2)
wieldtype = 8;
else if (wieldie == 1)
wieldtype = 4;
else if (wieldie == 3)
wieldtype = 2;
else
wieldtype = 1;
}
if ( wieldorig == 13 )
{
if ( wieldie == 1)
wieldtype = 8;
else if (wieldie == 2)
wieldtype = 4;
else wieldtype = 1;
}
if ( wieldorig == 12 )
{
if ( wieldie == 1 )
wieldtype = 8;
else
wieldtype = 4;
}
if ( wieldorig == 11 )
{
if ( wieldie == 1 )
wieldtype = 8;
if ( wieldie == 2 )
wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 10 )
{
if ( wieldie == 1 )
wieldtype = 8;
else wieldtype = 2;
}
if ( wieldorig == 9 )
{
if ( wieldie == 1 )
wieldtype = 8;
else wieldtype = 1;
}
if ( wieldorig == 8 )
wieldtype = 8;
if ( wieldorig == 7 )
{
if ( wieldie == 1 )
wieldtype = 4;
else if ( wieldie == 2 )
wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 6 )
{
if ( wieldie == 1 || wieldie == 2)
wieldtype = 2;
else wieldtype = 4;
}
if ( wieldorig == 5 )
{
if ( wieldie == 1)
wieldtype = 4;
else wieldtype = 1;
}
if ( wieldorig == 4 )
wieldtype = 4;
if ( wieldorig == 3 )
{
if ( wieldie == 2 || wieldie == 4)
wieldtype = 2;
else wieldtype = 1;
}
if ( wieldorig == 2 )
wieldtype = 2;
if ( wieldorig == 1 )
wieldtype = 1;
if ( wieldtype == 8 ) wield = wield4;
else if ( wieldtype == 4 ) wield = wield3;
else if ( wieldtype == 2 ) wield = wield2;
else wield = wield1;
if (!IS_NPC(ch) && ch->stance[0] > 0 && number_percent() == 1)
{
int stance = ch->stance[0];
if (ch->stance[stance] >= 200)
{
special_move(ch,victim);
return;
}
}
if ( IS_CREATOR(ch) || IS_CLASS(ch, CLASS_MONK) )
{
if (!IS_NPC(ch))
{
unarmed = number_range(1,7);
if ( !IS_NPC(ch) && ch->cmbt[unarmed] != 0 )
{
fightaction(ch,victim,ch->cmbt[unarmed], dt, wieldtype);
}
}
}
unarmed = 0;
one_hit( ch, victim, dt, wieldtype );
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if ( dt == TYPE_UNDEFINED )
{
dt = TYPE_HIT;
if ( wield != NULL && wield->item_type == ITEM_WEAPON )
{
dt += wield->value[3];
if (wield->value[0] >= 1 && wield->value[0] < MAX_SKILL )
{
sn = wield->value[0];
if (sn != 0 && victim->position == POS_FIGHTING)
(*skill_table[sn].spell_fun) (sn,wield->level,ch,victim);
}
}
}
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if ( ch->fighting != victim
|| dt == gsn_backstab
|| dt == gsn_headbutt )
return;
if ( !IS_NPC(victim) && !IS_SET(victim->special, SPC_WOLFMAN) &&
number_percent( ) <= victim->pcdata->learned[gsn_fastdraw] )
{
OBJ_DATA *obj;
int wpntype = 0;
int wpntype2 = 0;
if ((obj = get_eq_char(victim,WEAR_SCABBARD_R)) != NULL)
{
wpntype = obj->value[3];
if (wpntype < 0 || wpntype > 12) wpntype = 0;
if ((obj = get_eq_char(victim,WEAR_WIELD)) != NULL)
{
obj_from_char(obj);
obj_to_room(obj,victim->in_room);
act("You hurl $p aside.",victim,obj,NULL,TO_CHAR);
act("$n hurls $p aside.",victim,obj,NULL,TO_ROOM);
}
do_draw(victim,"right");
}
if ((obj = get_eq_char(victim,WEAR_SCABBARD_L)) != NULL)
{
wpntype2 = obj->value[3];
if (wpntype2 < 0 || wpntype2 > 12) wpntype2 = 0;
if ((obj = get_eq_char(victim,WEAR_HOLD)) != NULL)
{
obj_from_char(obj);
obj_to_room(obj,victim->in_room);
act("You hurl $p aside.",victim,obj,NULL,TO_CHAR);
act("$n hurls $p aside.",victim,obj,NULL,TO_ROOM);
}
do_draw(victim,"left");
}
if (wpntype > 0) one_hit( victim, ch, TYPE_UNDEFINED, 1 );
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if (wpntype2 > 0) one_hit( victim, ch, TYPE_UNDEFINED, 2 );
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
}
maxcount = number_attacks(ch,victim);
if (!IS_NPC(ch))
{
chance = 0;
if (wield != NULL && wield->item_type == ITEM_WEAPON)
{
int tempnum = wield->value[3];
chance = (ch->wpn[tempnum]) / 10;
}
else chance = (ch->wpn[0]) / 10;
if (number_percent() <= chance) maxcount += 1;
}
if (wieldorig == 3) maxcount += 1;
for (countup = 0; countup <= maxcount; countup++)
{
wieldtype = wieldorig;
if ( wieldorig == 3 )
{
if (number_range(1,2) == 2) wieldtype = 2;
else wieldtype = 1;
}
if( will_crit(ch,victim) )
one_hit( ch, victim, gsn_critical, wieldtype );
else
one_hit( ch, victim, -1, wieldtype );
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if ( ch->fighting != victim ) return;
}
if (!IS_NPC(ch) && IS_VAMPAFF(ch,VAM_FANGS))
one_hit( ch, victim, ( TYPE_HIT + 10 + TYPE_ADD_AGG), 0 );
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if (!IS_NPC(ch))
{
if ( IS_CLASS(ch, CLASS_WEREWOLF) && IS_GAR1(ch, WOLF_VISCERAL ) )
{
if ( !IS_SET(victim->newbits, NEW_VISCERAL) )
{
SET_BIT(victim->newbits, NEW_VISCERAL);
act("The venom on your claws mingles with $N's blood",ch, NULL, victim, TO_CHAR);
act("Something black on $n's claws mingles with your blood.",ch,NULL,victim,TO_VICT);
act("Something black on $n's mingles with $N's blood.",ch,NULL,victim,TO_NOTVICT);
}
}
if ((IS_CLASS(ch, CLASS_WEREWOLF) && ch->gifts[BLACKFURIES] > 2)
&& number_range(1,3) == 1)
one_hit( ch, victim, gsn_waspt, 0);
if ( IS_CLASS(ch, CLASS_DEMON) && IS_SET(ch->warp, WARP_SPIKETAIL)
&& number_range(1,3) == 1)
one_hit( ch, victim, gsn_spiket, 0);
if ( IS_CLASS(ch, CLASS_DEMON) && IS_SET(ch->warp, WARP_SHARDS)
&& number_range(1,3) == 1)
one_hit( ch, victim, gsn_shards, 0);
if ( IS_CLASS(ch, CLASS_DEMON) && IS_SET(ch->warp, WARP_MAGMA)
&& number_range(1,3) == 1)
one_hit( ch, victim, gsn_magma, 0);
if ( IS_CLASS(ch, CLASS_DEMON) && IS_SET(ch->warp, WARP_VENOMTONG)
&& number_range(1,3) == 1)
one_hit( ch, victim, gsn_venomt, 0);
if (IS_CLASS(ch, CLASS_DEMON) && IS_DEMAFF(ch,DEM_HORNS)
&& number_range(1,3) == 1)
{one_hit( ch, victim, gsn_headbutt, 0 );dt += TYPE_ADD_AGG;}
if (ch->mageshields[mPRIS][mON] && IS_CLASS(ch, CLASS_MAGE))
{
int deek;
deek = ch->spl[0] + ch->spl[1] + ch->spl[2] + ch->spl[3] + ch->spl[4];
deek *= ch->spl[TAR_CHAR_OFFENSIVE] / 100;
if( PC(ch,powers[MPOWER_RUNE0]) == GREEN_MAGIC )
deek *= ch->spl[GREEN_MAGIC] / 300;
if( deek < 0 )
deek = 0;
mage_damage( ch, victim, deek, "{mpr{Mis{Wmatic shield{x", MAGEDAM_OTHER );
}
if (ch->mageshields[mCHAOS][mON] == TRUE && IS_CLASS(ch, CLASS_MAGE))
{
int deek = number_range(ch->race * 100, ch->race * 150);
deek *= ch->spl[TAR_CHAR_OFFENSIVE] / 100;
if( PC(ch,powers[MPOWER_RUNE0]) == GREEN_MAGIC )
deek *= ch->spl[GREEN_MAGIC] / 300;
if( deek < 0 )
deek = 0;
mage_damage( ch, victim, deek, "{gshadowy force{x", MAGEDAM_OTHER);
}
if (ch->mageshields[mBLADE][mON] && IS_CLASS(ch, CLASS_MAGE)) {
int deek;
int x;
deek = 0;
for( x=0;x<13;x++)
deek += ch->wpn[x];
deek *= ch->spl[TAR_CHAR_OFFENSIVE] / 100;
if( PC(ch,powers[MPOWER_RUNE0]) == GREEN_MAGIC )
deek *= ch->spl[GREEN_MAGIC] / 300;
if( deek < 0 )
deek = 0;
mage_damage( ch, victim, deek, "{rBlade{RBarrier", MAGEDAM_OTHER);
}
if (IS_CLASS(ch, CLASS_NINJA)
&& ch->pcdata->powers[NPOWER_NINGENNO] > 0
&& number_range(1,2 ) == 1)
one_hit(ch, victim, gsn_claws, 0);
if ( IS_CLASS(ch, CLASS_NINJA)
&& ch->pcdata->powers[NPOWER_NINGENNO] > 3
&& number_range(1,3) == 1)
multi_hit( ch, victim, gsn_shiroken+TYPE_ADD_AGG);
/* if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
&& ch->pcdata->powers[NPOWER_NINGENNO] >=5
&& number_range(1,2) != 1)
multi_hit(ch, victim, gsn_shiroken);
*/
if (IS_CLASS(ch, CLASS_DEMON) && IS_DEMAFF(ch,DEM_TAIL)
&& number_range(1,3) == 1) one_hit( ch, victim,gsn_tail , 0);
if (IS_SET(ch->newbits, NEW_QUILLS) )
one_hit( ch, victim, gsn_quills, 0 );
if ( IS_DROW(ch) && IS_SET(ch->pcdata->powers[1], DPOWER_ARMS) )
{
int ii;
if( IS_POLYAFF(ch, POLY_SPIDERFORM) )
{
for( ii = 0; ii < 8; ii++ )
{
if( number_range(1,4) == 1 )
{
if( number_range(1,3) == 1 )
one_hit( ch, victim, gsn_spiderform + TYPE_ADD_AGG, 0 );
else one_hit(ch, victim, gsn_spiderform, 0);
}
}
}
else
{
for( ii = 0; ii < 4; ii++ )
{
if( number_range(1,3) == 1 )
{
if( number_range(1,2) == 1 )
one_hit( ch, victim, gsn_spiderform + TYPE_ADD_AGG, 0 );
else
one_hit( ch, victim, gsn_spiderform, 0 );
}
}
}
}
if ( IS_CLASS(ch, CLASS_DEMON) && IS_SET(ch->warp, WARP_WINGS)
&& number_range(1,3) == 1) one_hit( ch, victim, gsn_buffet, 0 );
if (IS_CLASS(ch, CLASS_VAMPIRE) && IS_VAMPAFF(ch, VAM_WINGS)
&& number_range(1,3) == 1) one_hit( ch, victim, gsn_buffet, 0 );
if (IS_CLASS(ch, CLASS_VAMPIRE) && IS_VAMPAFF(ch, VAM_HORNS)
&& number_range(1,3) == 1) one_hit( ch, victim, gsn_headbutt, 0 );
if (IS_CLASS(ch, CLASS_VAMPIRE) && IS_VAMPAFF(ch, VAM_TAIL)
&& number_range(1,3) == 1) one_hit( ch, victim, gsn_tail, 0 );
}
if ( victim == NULL || victim->position != POS_FIGHTING ) return;
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_VAMPIRE) && IS_VAMPAFF(ch, VAM_SERPENTIS))
spell_poison( gsn_poison, (ch->level*number_range(5,10)),ch,victim );
else if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_WEREWOLF) && ch->pcdata->powers[WPOWER_SPIDER] > 0)
spell_poison( gsn_poison, (ch->level*number_range(5,10)),ch,victim );
else if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_DROW)
&& IS_SET(ch->pcdata->powers[1], DPOWER_DROWPOISON))
spell_poison(gsn_poison,(ch->level*number_range(10,20)),ch,victim);
else if (!IS_NPC(ch)
&& IS_CLASS(ch, CLASS_NINJA)
&& ch->pcdata->powers[NPOWER_NINGENNO] > 4)
spell_poison( gsn_poison, (ch->level*number_range(5,10)),ch,victim );
if (victim->itemaffect < 1) return;
if (IS_NPC(victim) || victim->spl[1] < 4) level = victim->level;
else level = (victim->spl[1] * 0.25);
if (IS_SET(victim->newbits, NEW_MONKFLAME)
&& !IS_AFFECTED(ch,AFF_FLAMING))
{
if (number_percent() > 85)
{
SET_BIT(ch->affected_by, AFF_FLAMING);
if (!IS_CLASS(ch, CLASS_WEREWOLF))
{
act("Your flaming hands catch $n on fire!", ch, NULL, victim, TO_VICT);
act("$N's flaming hands catch $n on fire!", ch, NULL, victim, TO_NOTVICT);
act("$N's flaming hands catch you on fire!.", ch, NULL, victim, TO_CHAR);
}
else
{
act("Your flaming claws catch $n on fire!", ch, NULL, victim, TO_VICT);
act("$N's flaming claws catch $n on fire!", ch, NULL, victim, TO_NOTVICT);
act("$N's flaming claws catch you on fire!.", ch, NULL, victim, TO_CHAR);
}
}
else
return;
}
if (IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD) && ch->position ==POS_FIGHTING)
if ( (sn = skill_lookup( "lightning bolt" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,level,victim,ch);
if (IS_ITEMAFF(victim, ITEMA_FIRESHIELD) && ch->position == POS_FIGHTING)
if ( (sn = skill_lookup( "fireball" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,level,victim,ch);
if (IS_ITEMAFF(victim, ITEMA_ICESHIELD) && ch->position == POS_FIGHTING)
if ( (sn = skill_lookup( "chill touch" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,level,victim,ch);
if (IS_ITEMAFF(victim, ITEMA_ACIDSHIELD) && ch->position == POS_FIGHTING)
if ( (sn = skill_lookup( "acid blast" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,level,victim,ch);
if (IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) && ch->position == POS_FIGHTING)
if ( (sn = skill_lookup( "chaos blast" ) ) > 0)
(*skill_table[sn].spell_fun) (sn,level,victim,ch);
return;
}
int number_attacks( CHAR_DATA *ch, CHAR_DATA *victim )
{
int count = 1;
if ( IS_NPC(ch) )
{
if (ch->level >= 50) count++;
if (ch->level >= 100) count += ( ch->level / 75 );
return count;
}
if ( IS_STANCE(ch, STANCE_VIPER) && number_percent() >
ch->stance[STANCE_VIPER] * 0.5) count += 1;
else if ( IS_STANCE(ch, STANCE_MANTIS) && number_percent() >
ch->stance[STANCE_MANTIS] * 0.5) count += 1;
else if ( IS_STANCE(ch, STANCE_TIGER) && number_percent() >
ch->stance[STANCE_TIGER] * 0.5) count += 2;
if (!IS_NPC(ch))
{
if ( IS_CLASS(ch, CLASS_VAMPIRE))
{
count += 2;
if (IS_EXTRA(ch, EXTRA_DRAGON))
count += 5;
}
else if ( IS_CLASS(ch, CLASS_MONK))
count += ch->monkab[COMBAT];
else if ( IS_CLASS(ch, CLASS_ANGEL))
count += 2;
else if ( IS_CLASS(ch, CLASS_PRIEST))
count += 2;
else if ( IS_CLASS(ch, CLASS_RANGER))
count += 2;
else if ( IS_CLASS(ch, CLASS_DEMON))
count += 2;
else if ( IS_CLASS(ch, CLASS_DROW))
{
count += 3;
if (IS_SET(ch->special, SPC_DROW_WAR)) count += 2;
if (IS_SET(ch->pcdata->powers[1],DPOWER_SPEED)) count += 3;
}
if ( IS_CLASS(ch, CLASS_WEREWOLF))
count += 1;
if ( IS_CLASS(ch, CLASS_HIGHLANDER))
count += 3;
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA)
&& ch->pcdata->powers[NPOWER_CHIKYU] >= 3)
count += 1;
if ( IS_CLASS(ch, CLASS_NINJA) )
{
if( GET_GEN(ch) >= BELT_TEN )
count += 1;
else if( GET_GEN(ch) >= BELT_NINE)
count += 2;
else if( GET_GEN(ch) >= BELT_EIGHT)
count += 3;
else if( GET_GEN(ch) >= BELT_FIVE)
count += 4;
else if( GET_GEN(ch) >= BELT_TWO)
count += 5;
else
count += 6;
}
}
if ( IS_ITEMAFF(ch, ITEMA_SPEED) )
count += 1;
count += (get_curr_str(ch) + get_curr_dex(ch))/50;
return count;
}
/*
* Hit one guy once.
*/
void one_hit( CHAR_DATA *ch, CHAR_DATA *victim, int dt, int handtype)
{
OBJ_DATA *wield;
OBJ_DATA *gloves;
int victim_ac;
int thac0;
int thac0_00;
int thac0_32;
int dam;
int diceroll;
int wdam;
int level;
bool right_hand;
/*
* Can't beat a dead char!
* Guard against weird room-leavings.
*/
if ( victim->position == POS_DEAD || ch->in_room != victim->in_room )
return;
if (!IS_NPC(ch) && IS_ITEMAFF(ch, ITEMA_PEACE))
{
send_to_char( "You are unable to attack them.\n\r", ch );
return;
}
if (!IS_NPC(victim) && IS_ITEMAFF(victim, ITEMA_PEACE))
{
send_to_char( "You can't seem to attack them.\n\r", ch );
return;
}
if (!IS_NPC(ch) && IS_AFFECTED(ch, AFF_SAFE) )
{
send_to_char( "You cannot attack people under Gaia's protection.\n\r", ch );
return;
}
if (!IS_NPC(victim) && IS_AFFECTED(victim, AFF_SAFE) )
{
send_to_char( "You cannot attack people under Gaia's protection.\n\r", ch );
return;
}
if (!IS_NPC(victim) && IS_AFFECTED(victim, AFF_STEELSHIELD) )
{
send_to_char( "There are far to imposing.\n\r", ch );
return;
}
/*
* Figure out the type of damage message.
*/
if (handtype == 2)
{
wield = get_eq_char( ch, WEAR_HOLD );
right_hand = FALSE;
}
else if (handtype == 4 )
{
wield = get_eq_char( ch, WEAR_THIRD );
right_hand = FALSE;
}
else if ( handtype == 8 )
{
wield = get_eq_char( ch, WEAR_FOURTH );
right_hand = FALSE;
}
else
{
wield = get_eq_char( ch, WEAR_WIELD );
right_hand = TRUE;
}
if ( dt == TYPE_UNDEFINED )
{
dt = TYPE_HIT;
if ( wield != NULL && wield->item_type == ITEM_WEAPON )
dt += wield->value[3];
if (IS_CLASS(victim, CLASS_WEREWOLF))
{
if ((right_hand && IS_ITEMAFF(ch, ITEMA_RIGHT_SILVER)) ||
(!right_hand && IS_ITEMAFF(ch, ITEMA_LEFT_SILVER)) )
dt += TYPE_ADD_AGG;
}
}
if( dt-1000 < 13 && dt-1000>-1)
{
if (ch->wpn[dt-1000] > 5)
level = (ch->wpn[dt-1000] / 5);
else
level = 1;
}
else
level = 1;
if (level > 20) level = 20;
/*
* Calculate to-hit-armor-class-0 versus armor.
*/
if ( IS_NPC(ch) )
{
thac0_00 = 20;
thac0_32 = 0;
}
else
{
thac0_00 = SKILL_THAC0_00;
thac0_32 = SKILL_THAC0_32;
}
thac0 = interpolate( level, thac0_00, thac0_32 ) - char_hitroll(ch);
victim_ac = UMAX( -100, char_ac(victim) / 10 );
if ( !can_see( ch, victim ) )
victim_ac -= 100;
/*
* The moment of excitement!
*/
while ( ( diceroll = number_bits( 5 ) ) >= 20 )
;
if ( diceroll == 0
|| ( diceroll != 19 && diceroll < thac0 - victim_ac ) )
{
/* Miss. */
damage( ch, victim, 0, dt );
tail_chain( );
if (!is_safe(ch,victim))
{
improve_wpn(ch,dt,right_hand);
improve_wpn(ch,dt,right_hand);
improve_stance(ch);
}
return;
}
/*
* Hit.
* Calc damage.
*/
if ( IS_NPC(ch) )
{
dam = number_range( ch->level, ch->level * 3 / 2 );
if ( wield != NULL )
dam += dam * 0.5;
}
else
{
if ( IS_VAMPAFF(ch,VAM_CLAWS) && wield == NULL)
{dam = number_range( 10, 20 );dt += TYPE_ADD_AGG;}
else if ( IS_SET(ch->newbits, NEW_MONKADAM))
{
dam = number_range( 10, 25 );
}
else if ( wield != NULL && wield->item_type == ITEM_WEAPON )
dam = number_range( wield->value[1], wield->value[2] );
else
dam = number_range( 1, 4 );
}
if ( number_range(1,5) == 2 )
{
if ( ch->fighting == victim && IS_CLASS(ch, CLASS_MONK)
&& !IS_NPC(ch) && ch->monkab[BODY] > 3 )
{
wdam = number_range( (ch->chi[CURRENT]*6),(ch->chi[CURRENT]*10) );
if ( victim->alignment < 0 )
wdam *= 1.5;
act("$n's hands glow with a heavenly aura.",ch,NULL,victim,TO_VICT);
act("$n's aura sears your flesh!",ch,NULL,victim,TO_VICT);
act("Your heavenly aura sears $N's flesh.",ch,NULL,victim,TO_CHAR);
act("$n's hands' heavenly aura sears $N's flesh.",ch,NULL,victim,TO_ROOM);
hurt_person( ch, victim, wdam, FALSE );
update_pos( victim );
}
}
/* Fun with weapons */
if ( !IS_NPC(ch) && wield != NULL )
{
if ( number_range( 1,5 ) == 2 )
{
if ( ch->fighting == victim )
{
if ( IS_WEAP(wield, WEAPON_FLAMING) )
{
wdam = number_range( 1,wield->level / 4 + 1);
act("$n is burned by $p.",victim,wield,NULL,TO_ROOM);
act("$p sears your flesh.",victim,wield,NULL,TO_CHAR);
hurt_person( ch, victim, wdam, FALSE );
update_pos( victim );
}
if ( IS_WEAP(wield, WEAPON_FROST) )
{
wdam = number_range( 1, wield->level / 6 + 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);
hurt_person( ch, victim, wdam, FALSE );
update_pos(victim);
}
if ( IS_WEAP(wield, WEAPON_POISON) )
{
wdam = number_range( 1, wield->level / 6 + 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);
hurt_person( ch, victim, wdam, FALSE );
update_pos(victim);
}
}
}
}
dam += char_damroll(ch);
dam = add_bonuses( ch, victim, dam, dt );
/* Werewolf Silver Stuff.. */
if ( !IS_NPC(victim) && IS_CLASS(victim, CLASS_WEREWOLF) )
{
if ( number_percent() > victim->pcdata->powers[WPOWER_SILVER] )
{
if ( is_garou(ch) )
{
if ( IS_GAR1(ch, GAROU_AVENGER) )
dam *= 2;
else if ( ch->gifts[AHROUN] >= 4 || ch->gifts[SILVERFANGS] >= 2 )
dam *= 1.2;
else if ( wield != NULL && IS_SET(wield->spectype, SITEM_SILVER) )
dam *= 1;
else if ( ( gloves = get_eq_char( ch, WEAR_HANDS ) ) != NULL && IS_SET(gloves->spectype, SITEM_SILVER) )
dam *= 1;
dam = dam /2;
}
else if ( !is_garou(ch) )
{
if ( wield != NULL && IS_SET(wield->spectype, SITEM_SILVER) )
dam *= 1;
else if ( ( gloves = get_eq_char( ch, WEAR_HANDS ) ) != NULL && IS_SET(gloves->spectype, SITEM_SILVER) )
dam *= 1;
}
}
}
if ( dt == gsn_backstab )
{
if ( IS_CLASS(ch, CLASS_DROW) )
dam *= number_range( 3, 4 );
else
dam *= number_range( 2, 3 );
}
if(dt == gsn_spiderform) dam *= number_range( 2, 3 );
if(dt == gsn_blinky)dam /= 1.10;
/*
* Again bypass the read for backstabs
*/
if( dt == gsn_backstab || dt == gsn_circle)
{
if( IS_NINJA( ch )
&& PC(ch,powers[NPOWER_NINGENNO]) > 1 )
{
update_damcap(ch,victim);
if( dam > ch->damcap[DAM_CAP]*2 )
dam = ch->damcap[DAM_CAP]*2;
hurt_person(ch,victim,dam,FALSE);
dam_message(ch,victim,dam,dt);
update_pos(ch);
if( !victim )
return;
}
}
/*
* Bypass the rest for critical hits
* --Dreimas
*/
if( dt == gsn_critical )
{
dam = crit_damage( ch, victim );
damage( ch, victim, dam, dt );
return;
}
damage( ch, victim, dam, dt );
tail_chain( );
if (!is_safe(ch,victim))
{
improve_wpn(ch,dt,right_hand);
improve_wpn(ch,dt,right_hand);
improve_stance(ch);
}
return;
}
int add_bonuses( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt )
{
float mult = 1;
float reduct = 1;
int stance;
int wpn;
if ( !IS_AWAKE(victim) )
dam *= 2;
if ( !IS_NPC(ch))
{
/* Stance Bonuses.. */
stance = ch->stance[0];
if ( IS_STANCE(ch, STANCE_NORMAL) ) mult += .25;
else dam = dambonus(ch,victim,dam,stance);
/* ----------------- */
if ( IS_CLASS(ch, CLASS_VAMPIRE) )
{
mult += .3;
if ( ch->pcdata->powers[VAM_POTE] > 0 )
mult += ( ch->pcdata->powers[VAM_POTE] / 3 );
/* Vampire Day\Night Bonus Shit */
if ( weather_info.sunlight == SUN_LIGHT && dam > 1 )
mult -= .7;
else
mult += .3;
}
if ( IS_CLASS(ch, CLASS_WEREWOLF) )
{
if ( ch->gifts[PHILODOX] >= 4 )
mult += .6;
if ( ch->gifts[SHADOWLORDS] >= 1 )
mult += .7;
if ( ch->gifts[GETOFFENRIS] >= 3 )
mult += 1;
if ( ch->gifts[STARGAZERS] >= 1 )
mult += .3;
if ( ch->gifts[AHROUN] >= 1 )
mult += .3;
if ( ch->gifts[AHROUN] >= 2 )
mult += .3;
if ( ch->gifts[BLACKFURIES] >= 3 )
mult += .3;
}
if ( IS_CLASS(ch, CLASS_MAGE) )
{
if ( IS_SET(ch->mflags, MAGE_TELEKINETICS) )
mult += .2; /* 4 */
if ( IS_SET(ch->mflags, MFLAGS_DIMMAK) )
mult += .1; /* 3 */
if ( ch->spheres[MENT] >= 1 )
mult += ( ch->spheres[MENT] *.2 );
}
if ( IS_CLASS(ch, CLASS_DROW) )
mult += .7;
if ( IS_CLASS(ch, CLASS_DEMON) )
{
if ( IS_DEMPOWER(ch, DEM_MIGHT) )
mult += .1;
}
if ( IS_CLASS(ch, CLASS_ANGEL))
{
if( IS_ANGPOWER(ch, ANG_STRENGTH) )
mult += .1;
}
if ( IS_CLASS(ch, CLASS_MONK) )
{
if ( ch->chi[CURRENT] > 0 )
mult += ch->chi[CURRENT] / 30 ;
}
if ( IS_CLASS(ch, CLASS_PRIEST))
mult += 3;
if ( IS_CLASS(ch, CLASS_NINJA) )
{
if ( ch->pcdata->powers[NPOWER_CHIKYU] > 1 )
mult += 1;
if (GET_GEN(ch) == BELT_ONE) mult += .9;
else if (GET_GEN(ch) == BELT_TWO) mult += .8;
else if (GET_GEN(ch) == BELT_THREE) mult += .7;
else if (GET_GEN(ch) == BELT_FOUR) mult += .6;
else if (GET_GEN(ch) == BELT_FIVE) mult += .5;
else if (GET_GEN(ch) == BELT_SIX) mult += .4;
else if (GET_GEN(ch) == BELT_SEVEN) mult += .3;
else if (GET_GEN(ch) == BELT_EIGHT) mult += .2;
else if (GET_GEN(ch) == BELT_NINE) mult += .1;
}
}
if ( !IS_NPC( victim ) )
{
if ( IS_ITEMAFF(victim, ITEMA_RESISTANCE) )
reduct += 1;
if ( IS_CLASS(victim, CLASS_VAMPIRE) )
{
if ( victim->pcdata->powers[VAM_FORT] > 0 )
reduct += ( victim->pcdata->powers[VAM_FORT] - .9 );
}
if ( IS_CLASS(victim, CLASS_WEREWOLF) )
{
if ( IS_GAR1(victim, WOLF_COCOON) )
reduct += .2;
if ( victim->gifts[PHILODOX] >= 1 )
reduct += .1;
if ( victim->gifts[PHILODOX] >= 3 )
reduct += .2;
if ( victim->gifts[SHADOWLORDS] >= 2 )
reduct += .2;
if ( victim->gifts[SHADOWLORDS] >= 4 )
reduct += .3;
}
if ( IS_CLASS(victim, CLASS_MAGE) )
{
if ( victim->spheres[MENT] >= 1 )
reduct += 1.5;
}
if ( IS_CLASS(victim, CLASS_DEMON) )
{
if ( IS_DEMPOWER(victim, DEM_TOUGH) )
reduct += 1.5;
}
if( IS_CLASS(victim, CLASS_ANGEL) )
{
if( IS_ANGPOWER(victim, ANG_PROTECTION_OF_GOD) )
reduct += 1.5;
}
if ( IS_CLASS(victim, CLASS_MONK) )
{
if ( victim->chi[CURRENT] > 0 )
reduct += victim->chi[CURRENT];
if ( victim->monkab[BODY] >= 2 )
reduct += .5;
}
if ( IS_CLASS(victim, CLASS_PRIEST) )
reduct += 1.7;
if ( IS_CLASS(victim, CLASS_DROW ) )
reduct += 1.1;
if ( IS_CLASS(victim, CLASS_NINJA ) )
reduct += .9;
}
if ( !IS_NPC(ch) && dt >= TYPE_HIT )
{
wpn = ( dt - 1000 );
for( ; wpn >= TYPE_HIT; wpn = wpn - 1000 )
;
dam = dam + ( dam * ((ch->wpn[wpn]+1) / 100 ) );
}
if ( !IS_NPC(victim) )
{
if ( dt >= TYPE_HIT )
{
wpn = ( dt - 1000 );
if ( wpn == 0 && IS_IMMUNE(victim,IMM_ANIMAL) )
dam /= ( number_range( 1, 4 ) );
if ( (wpn == 1 || wpn == 3) && IS_IMMUNE(victim, IMM_SLASH) )
dam /= ( number_range( 1, 4 ) );
if ( (wpn == 2 || wpn == 11) && IS_IMMUNE(victim, IMM_STAB) )
dam /= ( number_range( 1, 4 ) );
if ( (wpn == 6 || wpn == 7 || wpn == 8) && IS_IMMUNE(victim, IMM_SMASH) )
dam /= ( number_range( 1, 4 ) );
if ( (wpn == 5 || wpn == 10) && IS_IMMUNE(victim, IMM_ANIMAL) )
dam /= ( number_range( 1, 4 ) );
if ( (wpn == 4 || wpn == 9 || wpn == 12) && IS_IMMUNE(victim, IMM_MISC) )
dam /= ( number_range( 1, 4 ) );
}
}
if ( IS_NPC(ch) && ch->level > 200 )
{
mult += ( ch->level / 200 );
reduct += ( ch->level / 200 );
reduct += 1;
}
if ( IS_NPC(victim) && victim->level > 200 )
{
mult += ( victim->level / 200 );
reduct += ( victim->level / 200 );
reduct += 1;
}
dam *= mult;
dam /= reduct;
if ( !IS_NPC(ch) && IS_CLASS(ch, CLASS_NINJA))
{
if ( !IS_NPC(ch) && dt == gsn_backstab )
dam *= 12-GET_GEN(ch);
}
return dam;
}
bool can_counter( CHAR_DATA *ch)
{
if (!IS_NPC(ch) && IS_STANCE(ch, STANCE_MONKEY)) return TRUE;
if (!IS_NPC(ch) && IS_STANCE(ch, STANCE_COUGAR)) return TRUE;
return FALSE;
}
bool can_bypass( CHAR_DATA *ch, CHAR_DATA *victim )
{
if (IS_NPC(ch) || IS_NPC(victim)) return FALSE;
else if (IS_STANCE(ch, STANCE_VIPER)) return TRUE;
else if (IS_STANCE(ch, STANCE_MANTIS)) return TRUE;
else if (IS_STANCE(ch, STANCE_RABBIT)) return TRUE;
else if (IS_STANCE(ch, STANCE_TIGER)) return TRUE;
else if (IS_STANCE(ch, STANCE_BEAR)) return TRUE;
else if (IS_STANCE(ch, STANCE_COBRA)) return TRUE;
return FALSE;
}
void update_damcap( CHAR_DATA *ch, CHAR_DATA *victim )
{
int max_dam = 1000;
int basecap = 20000;
if ( !IS_NPC(ch) )
{
int hours;
/*
* Figure out what there base cap is
*
*/
basecap += PC(ch,basedamcap) * 250;
hours = get_hours_played( ch ) - 200;
if( hours > 0 )
max_dam += (hours/2)*16;
if ( IS_CLASS(ch, CLASS_DROW) )
{
max_dam += 4000;
if ( weather_info.sunlight == SUN_DARK )
max_dam += 1000;
if ( IS_SET(ch->newbits, NEW_DROWHATE) )
max_dam += 1750;
if( GET_GEN(ch) < 3 )
max_dam += 1000;
}
if ( IS_SET(victim->garou1, GAROU_PAWS) )
{
max_dam =- 500;
}
if( IS_CLASS(ch, CLASS_PRIEST ) )
{
max_dam += 5000;
if( IS_PRIPOWER(ch,PRI_PFORM) )
max_dam += 750;
}
if ( IS_CLASS(ch, CLASS_DEMON) )
{
if ( ch->in_room != NULL )
if ( ch->in_room->vnum == 30000 ) max_dam = 10000;
max_dam += 3000;
}
if ( IS_CLASS(ch, CLASS_VAMPIRE) )
{
if ( ch->pcdata->stats[UNI_GEN] < 2 ) max_dam = 1500;
else if ( ch->pcdata->stats[UNI_GEN] < 3 ) max_dam = 1400;
else if ( ch->pcdata->stats[UNI_GEN] < 4 ) max_dam = 1300;
else if ( ch->pcdata->stats[UNI_GEN] < 5 ) max_dam = 1200;
else max_dam = 1100;
max_dam += ( ch->pcdata->stats[UNI_RAGE] );
max_dam += 3500;
if( IS_POLYAFF( ch, POLY_ZULO ))
max_dam += 1000;
if ( ch->pcdata->powers[VAM_POTE] > 0 )
max_dam += ( 100 * ch->pcdata->powers[VAM_POTE] );
if ( ch->pcdata->rank == AGE_METHUSELAH ) max_dam += 1000;
else if ( ch->pcdata->rank == AGE_ELDER ) max_dam += 700;
else if ( ch->pcdata->rank == AGE_ANCILLA ) max_dam += 500;
}
if ( IS_CLASS(ch, CLASS_ANGEL) )
{
if ( ch->in_room != NULL )
if ( ch->in_room->vnum == 30010 ) max_dam = 10000;
max_dam += 3000;
if( IS_ANGPOWER(ch,ANG_STRENGTH) )
max_dam += 500;
if( IS_POLYAFF(ch,POLY_ANGELFORM) )
max_dam += 250;
if( IS_POLYAFF(ch,POLY_ZULO) )
max_dam += 500;
if (IS_ITEMAFF(ch, ITEMA_ANGHALO)) max_dam += 1000;
}
if ( IS_CLASS(ch, CLASS_MONK) )
{
max_dam += 2500;
if ( ch->monkab[COMBAT] > 0 )
max_dam += ( ch->monkab[COMBAT] * 150 );
if ( ch->chi[CURRENT] > 0 )
max_dam += ( ch->chi[CURRENT] * 250 );
}
if ( IS_CLASS(ch, CLASS_NINJA) )
{
if ( ch->pcdata->stats[UNI_GEN] < 3 ) max_dam = 2500;
else if ( ch->pcdata->stats[UNI_GEN] < 4 ) max_dam = 1400;
else if ( ch->pcdata->stats[UNI_GEN] < 5 ) max_dam = 1300;
else
max_dam = 1200;
max_dam += (ch->pcdata->stats[UNI_RAGE] * 5);
if ( ch->pcdata->powers[NPOWER_CHIKYU] >= 6
&& ch->pcdata->powers[HARA_KIRI] > 0 )
max_dam += 600;
if ( ch->pcdata->powers[NPOWER_CHIKYU] >= 2 )
max_dam += 500;
}
if ( IS_CLASS(ch, CLASS_MAGE) )
{
max_dam = 2500;
if ( ch->spheres[MENT] > 0 )
max_dam += ( 250 * ch->spheres[MENT] );
if( GET_GEN(ch) < WRL_ACOLYTE ) max_dam += 500;
if( GET_GEN(ch) < 3 ) max_dam += 500;
}
if ( IS_CLASS(ch, CLASS_WEREWOLF) )
{
max_dam += 3000;
/* if ( ch->pcdata->stats[UNI_GEN] < 2 ) max_dam = 2000;
else if ( ch->pcdata->stats[UNI_GEN] < 3 ) max_dam = 1900;
else if ( ch->pcdata->stats[UNI_GEN] < 4 ) max_dam = 1800;
else max_dam = 1700;
*/
if ( IS_SET(ch->special, SPC_WOLFMAN) )
max_dam += ( ch->pcdata->stats[UNI_RAGE] );
if ( ch->gifts[PHILODOX] >= 3 )
max_dam += 200;
if ( ch->gifts[SILVERFANGS] > 0 )
max_dam += 150;
if ( ch->gifts[GETOFFENRIS] >= 3 )
max_dam += 300;
if (IS_ITEMAFF(ch, ITEMA_SUNSHIELD)) max_dam += 500;
}
if ( IS_CLASS(ch, CLASS_HIGHLANDER) )
{
if ( get_eq_char(ch, WEAR_WIELD) != NULL )
{
max_dam += (ch->wpn[1] / 2);
max_dam += (ch->race * 50);
max_dam += 1000;
}
}
if( IS_ITEMAFF( ch, ITEMA_ARTIFACT ) )
{
max_dam += count_artifacts(ch) * 500;
max_dam -= count_artifacts(victim) * 500;
}
max_dam += count_satanic( ch ) * 50;
if( get_eq_char( ch, WEAR_MASTERY) )
max_dam += 300;
max_dam += get_curr_str(ch) * 10;
max_dam += (ch->race / 5 ) * 250;
max_dam += (PC(ch,stats)[LEVEL] * 10);
max_dam += PC(ch,basedamcap) * 250;
}
else
max_dam += ( ch->level * 50 ); // for NPCs
max_dam = URANGE( 1000, max_dam, basecap );
ch->damcap[DAM_CAP] = max_dam;
ch->damcap[DAM_CHANGE] = 0;
return;
}
/*
* Inflict damage from a hit.
*/
void damage( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt )
{
int max_dam = ch->damcap[DAM_CAP];
bool agg_dam = FALSE;
if ( victim->position == POS_DEAD )
return;
/*
* Stop up any residual loopholes.
*/
if (ch->damcap[DAM_CHANGE] == 1)
{
update_damcap(ch,victim);
max_dam = ch->damcap[DAM_CAP];
}
if ( dam > max_dam && dt != gsn_critical )
dam = number_range( max_dam - 500, max_dam );
/*
* Randomize the damage -- Dreimas
*/
if( IS_SET(sysdata.world, WORLD_RANDOMIZEDAM ) )
dam = dam * (dice(1,100)+50)/100;
if ( victim != ch )
{
/*
* Certain attacks are forbidden.
* Most other attacks are returned.
*/
if ( is_safe( ch, victim ) )
return;
check_killer( ch, victim );
if ( victim->position > POS_STUNNED )
{
if ( victim->fighting == NULL )
set_fighting( victim, ch );
victim->position = POS_FIGHTING;
}
if ( victim->position > POS_STUNNED )
{
if ( ch->fighting == NULL )
set_fighting( ch, victim );
/*
* If victim is charmed, ch might attack victim's master.
*/
if ( IS_NPC(ch)
&& IS_NPC(victim)
&& IS_AFFECTED(victim, AFF_CHARM)
&& victim->master != NULL
&& victim->master->in_room == ch->in_room
&& number_bits( 3 ) == 0 )
{
stop_fighting( ch, FALSE );
multi_hit( ch, victim->master, TYPE_UNDEFINED );
return;
}
}
/*
* More charm stuff.
*/
if ( victim->master == ch )
stop_follower( victim );
/*
* Make sure you start counting hits.
*/
if( ch->num_hits < 0 && victim == ch->fighting )
ch->num_hits = 0;
/*
* Damage modifiers.
*/
// First Round Check
if(IS_SET(ch->extra,FROUND))
{
if(IS_CLASS(ch,CLASS_WEREWOLF) && ch->gifts[BLACKFURIES] >= 1)
{
send_to_char("You devise the best place to strike your opponent.\n\r",ch);
dam *= 1.2;
}
REMOVE_BIT(ch->extra,FROUND);
}
if( IS_SET( ch->affected_by, AFF_HIDE ) )
REMOVE_BIT( ch->affected_by, AFF_HIDE );
if ( IS_SET(ch->act, PLR_WIZINVIS ) )
{
if (!can_see(victim,ch))
{
dam *= 1.2;
if( IS_NINJA( ch ) )
send_to_char("You leap from the shadows.\n\r", ch);
else if( IS_MONK( ch ) )
send_to_char("You emerge from a flash of light.\n\r", ch);
else
send_to_char("You use your concealment to get a surprise attack!\n\r",ch);
}
REMOVE_BIT( ch->act, PLR_WIZINVIS );
if( IS_NINJA( ch ) )
act( "$n leaps from the shadows.", ch, NULL, NULL, TO_ROOM );
else if ( IS_MONK( ch ) )
act( "$n bursts from a flash of light.", ch, NULL, NULL, TO_ROOM );
else
act( "$n leaps from $s concealment.", ch, NULL, NULL, TO_ROOM );
}
if ( IS_AFFECTED(victim, AFF_SANCTUARY) && dam > 1 )
dam *= 0.5;
if ( IS_AFFECTED(victim, AFF_HOLYAURA) && dam > 1 )
dam *= 0.5;
if ( IS_AFFECTED(victim, AFF_PROTECT) && IS_EVIL(ch) && dam > 1 )
dam -= dam * 0.25;
if ( dam < 0 )
dam = 0;
/*
* Check if damage is aggravated.
if ( dt >= TYPE_ADD_AGG )
{
agg_dam = TRUE;
dt -= TYPE_ADD_AGG;
while ( dt >= TYPE_ADD_AGG ) dt -= TYPE_ADD_AGG;
}
*/
/*
* Check for disarm, trip, parry, and dodge.
*/
if ( dt >= TYPE_HIT )
{
if ( IS_NPC(ch) && number_percent( ) < ch->level * 0.5 )
disarm( ch, victim );
if ( IS_NPC(ch) && number_percent( ) < ch->level * 0.5 )
trip( ch, victim );
if ( check_parry( ch, victim, dt ) )
return;
if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_CRANE) &&
victim->stance[STANCE_CRANE] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
return;
else if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_MANTIS) &&
victim->stance[STANCE_MANTIS] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
return;
else if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_RABBIT) &&
victim->stance[STANCE_RABBIT] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_parry( ch, victim, dt ))
return;
if ( check_dodge( ch, victim, dt ) )
return;
if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_MONGOOSE) &&
victim->stance[STANCE_MONGOOSE] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
return;
else if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_SWALLOW) &&
victim->stance[STANCE_SWALLOW] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
return;
else if ( !IS_NPC(victim) && IS_STANCE(victim, STANCE_EAGLE) &&
victim->stance[STANCE_EAGLE] > 100 && !can_counter(ch)
&& !can_bypass(ch,victim) && check_dodge( ch, victim, dt ))
return;
}
dam_message( ch, victim, dam, dt );
}
/*
* Take care of sysdata flags
*/
if( !IS_NPC(ch) && !IS_NPC(victim) )
dam = (dam * sysdata.dam_plr_vs_plr ) / 100;
else if ( IS_NPC(ch) && !IS_NPC(victim) )
dam = (dam * sysdata.dam_mob_vs_plr ) / 100;
else if ( IS_NPC(ch) && IS_NPC(victim ) )
dam = ( dam * sysdata.dam_mob_vs_mob ) / 100;
else
dam = (dam * sysdata.dam_plr_vs_mob ) / 100;
if ( dam < 0 )
dam = 0;
hurt_person(ch,victim,dam,agg_dam);
return;
}
void adv_damage( CHAR_DATA *ch, CHAR_DATA *victim, int dam )
{
if ( victim->position == POS_DEAD )
return;
if ( dam > 1500 ) dam = 1500;
if ( victim != ch )
{
if ( is_safe( ch, victim ) )
return;
check_killer( ch, victim );
if ( victim->position > POS_STUNNED )
{
if ( victim->fighting == NULL )
set_fighting( victim, ch );
victim->position = POS_FIGHTING;
}
if ( victim->position > POS_STUNNED )
{
if ( ch->fighting == NULL )
set_fighting( ch, victim );
if (victim->embracing == NULL)
{
stop_embrace(ch,victim);
}
/*
* If victim is charmed, ch might attack victim's master.
*/
if ( IS_NPC(ch)
&& IS_NPC(victim)
&& IS_AFFECTED(victim, AFF_CHARM)
&& victim->master != NULL
&& victim->master->in_room == ch->in_room
&& number_bits( 3 ) == 0 )
{
stop_fighting( ch, FALSE );
multi_hit( ch, victim->master, TYPE_UNDEFINED );
return;
}
}
if ( victim->master == ch )
stop_follower( victim );
if ( IS_AFFECTED(victim, AFF_SANCTUARY) && dam > 1 )
dam /= 2;
if ( IS_AFFECTED(victim, AFF_PROTECT) && IS_EVIL(ch) && dam > 1 )
dam -= dam / 4;
if (!IS_NPC(victim) && !IS_NPC(ch)) dam = dam *2/3;
}
return;
}
void hurt_person( CHAR_DATA *ch, CHAR_DATA *victim, int dam, bool agg_dam )
{
int vnum;
int dmpt = number_range(1,300);
char bleh[MAX_STRING_LENGTH];
int sn;
/*
* Hurt the victim.
* Inform the victim of his new state.
*/
sn = 0;
sn = skill_lookup( "manashield" );
if( sn > 1 && is_affected( victim, sn )
&& ( victim->hit < dam || victim->hit < 5000 ) )
victim->mana -= dam;
else
victim->hit -= dam;
if ( IS_SET(victim->flag2, AFF2_INARENA) && victim->hit < 0 )
clean_arena(victim, ch);
if (agg_dam && victim->agg < 100) victim->agg++;
if (agg_dam)
{
if (victim->position == POS_MORTAL) victim->agg = 100;
if (victim->agg < 100) victim->agg++;
if (!IS_NPC(victim)) SET_BIT(victim->act, PLR_LAST_AGG);
}
else if (!IS_NPC(victim)) REMOVE_BIT(victim->act, PLR_LAST_AGG);
if ( !IS_NPC(victim)
&& victim->level >= LEVEL_IMMORTAL
&& victim->hit < 1 )
victim->hit = 1;
update_pos( victim );
switch( victim->position )
{
case POS_MORTAL:
act( "$n is mortally wounded, and spraying blood everywhere.\n\r",victim, NULL, NULL, TO_ROOM );
send_to_char(
"You are mortally wounded, and spraying blood everywhere.\n\r",victim );
if ( IS_CLASS(victim, CLASS_DROW)
&& IS_SET(victim->in_room->affected_by, ROOM_TOTAL_DARKNESS) )
REMOVE_BIT(victim->in_room->affected_by, ROOM_TOTAL_DARKNESS);
break;
case POS_INCAP:
act( "$n is incapacitated, and bleeding badly.", victim, NULL, NULL, TO_ROOM );
send_to_char(
"You are incapacitated, and bleeding badly.\n\r", victim );
break;
case POS_STUNNED:
act( "$n is stunned, but will soon recover.", victim, NULL, NULL, TO_ROOM );
send_to_char("You are stunned, but will soon recover.\n\r",
victim );
break;
case POS_DEAD:
act( "{C$n {cis DEAD!!{x", victim, 0, 0, TO_ROOM );
send_to_char( "{RYou have been KILLED!!{x\n\r\n\r", victim );
break;
default:
if ( dam > victim->max_hit / 4 )
send_to_char( "That really did HURT!\n\r", victim );
if ( victim->hit < victim->max_hit / 4 && dam > 0 )
{
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_VAMPIRE)
&& number_percent() < victim->beast)
vamp_rage(victim);
else
send_to_char( "You sure are BLEEDING!\n\r", victim );
}
break;
}
/*
* Sleep spells and extremely wounded folks.
*/
if ( !IS_AWAKE(victim) )
stop_fighting( victim, FALSE );
/*
* Payoff for killing things.
*/
if ( victim->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),
victim->in_room->vnum );
log_string( log_buf );
/*
* Dying penalty:
* 1/2 your current exp.
*/
if ( victim->exp > 0 )
victim->exp = victim->exp / 2;
}
if (IS_NPC(victim) && !IS_NPC(ch))
{
ch->mkill += 1;
ch->in_room->area->mkills++;
if ( ch->level >= 3 )
{
if (dmpt > 1)
{
dmpt = victim->level*2;
}
if (dmpt > 300) {dmpt = 300;}
if (!IS_CLASS(ch, CLASS_WEREWOLF)
&& !IS_CLASS(ch, CLASS_VAMPIRE)
&& !IS_CLASS(ch, CLASS_DROW)
&& !IS_CLASS(ch, CLASS_NINJA)
&& !IS_CLASS(ch, CLASS_ANGEL)
&& !IS_CLASS(ch, CLASS_DEMON)
&& !IS_CLASS(ch, CLASS_HIGHLANDER)
&& !IS_CLASS(ch, CLASS_PRIEST)
&& !IS_CLASS(ch, CLASS_MAGE)
&& !IS_CLASS(ch, CLASS_MONK)
&& (ch->level >= 3 ) )
{
dmpt = 0;
}
if (!IS_NPC(ch))
{
if (IS_NPC(victim) && (!IS_SET(victim->act, ACT_NOEXP) && (!IS_SET(victim->act, ACT_MOUNT) && (victim->level > 10))))
{
ch->pcdata->stats[DEMON_CURRENT] += dmpt;
ch->pcdata->stats[DEMON_TOTAL] += dmpt;
sprintf(bleh,"{wYou gain{R %d {wcps.{x\n\r",dmpt);
send_to_char(bleh,ch);
}
if ( (( get_age(ch) - 17) * 2 ) < 2 )
{
ch->pcdata->stats[DEMON_CURRENT] += dmpt;
ch->pcdata->stats[DEMON_TOTAL] += dmpt;
sprintf(bleh,"{wNewbie CPs. {r[{R%d cp{r]{x\n\r",dmpt);
send_to_char(bleh,ch);
}
if( IS_SET( sysdata.world, WORLD_DOUBLEXP ) )
{
ch->pcdata->stats[DEMON_CURRENT] += dmpt;
ch->pcdata->stats[DEMON_TOTAL] += dmpt;
sprintf(bleh,"{wYou gain{R %d {wcps.{x\n\r",dmpt);
send_to_char(bleh,ch);
sprintf(bleh,"#.*#.*#.*#.*{w Double Exp = Double {RCps #.*#.*#.*#.*{x\n\r");
send_to_char(bleh,ch);
}
}
if (!IS_NPC(ch))
{
if ((vnum = victim->pIndexData->vnum) > 29000)
{
switch (vnum)
{
default:
break;
case 29600:
case 30001:
case 30006:
case 30007:
case 30008:
case 30009:
case 30000:
break;
}
}
else if (IS_NPC(victim) && !IS_SET(victim->act, ACT_NOEXP))
{
ch->pcdata->stats[DEMON_CURRENT] += 0;
ch->pcdata->stats[DEMON_TOTAL] += 0;
}
}
}
if (ch->level == 1 && ch->mkill > 4)
{
ch->level = 2;
do_save(ch,"");
}
}
if (!IS_NPC(victim) && IS_NPC(ch))
{
victim->mdeath = victim->mdeath + 1;
victim->in_room->area->mdeaths++;
}
raw_kill( victim, ch );
if ( IS_SET(ch->act, PLR_AUTOLOOT) )
do_get( ch, "all corpse" );
else
do_look( ch, "in corpse" );
if ( !IS_NPC(ch) )
{
if ( IS_SET(ch->act, PLR_AUTOSAC) )
do_sacrifice( ch, "corpse" );
}
return;
}
if ( victim == ch )
return;
/*
* Take care of link dead people.
*/
if ( !IS_NPC(victim) && victim->desc == NULL )
{
if ( number_range( 0, victim->wait ) == 0 )
{
do_recall( victim, "" );
return;
}
}
/*
* Wimp out?
*/
if ( IS_NPC(victim) && dam > 0 )
{
if ( ( IS_SET(victim->act, ACT_WIMPY) && number_bits( 1 ) == 0
&& victim->hit < victim->max_hit / 2 )
|| ( IS_AFFECTED(victim, AFF_CHARM) && victim->master != NULL
&& victim->master->in_room != victim->in_room ) )
do_flee( victim, "" );
}
if ( !IS_NPC(victim)
&& victim->hit > 0
&& victim->hit <= victim->wimpy
&& victim->wait == 0 )
do_flee( victim, "" );
tail_chain( );
return;
}
bool is_safe( CHAR_DATA *ch, CHAR_DATA *victim )
{
/* int i;*/
if ( IS_NPC(victim) && victim->pIndexData->pShop )
{
stc( "You cannot fight shop keepers.\n\r",ch);
return TRUE;
}
if ( IS_NPC(ch) && ch->pIndexData->pShop )
{
stc( "You cannot fight shop keepers.\n\r",ch);
return TRUE;
}
if( IS_AFFECTED(ch,AFF_ETHEREAL) )
{
stc( "You cannot fight someone who is etheral.\n\r", ch);
return TRUE;
}
if ( !IS_NPC(ch) && ch->level < 3 && !IS_NPC(victim) )
{
stc("You must be an avatar to fight other avatars!\n\r",ch);
return TRUE;
}
if ( !IS_NPC(victim) && !IS_NPC(ch) && victim->level < 3 )
{
stc("They must be an avatar!\n\r",ch);
return TRUE;
}
if ( !IS_NPC(victim) )
{
if (victim->pcdata->in_progress /* &&
(!victim->pcdata->in_progress->text) */ )
{
send_to_char ("Not while they are writting a note!\n\r", ch );
return TRUE;
}
}
if ( victim->fight_timer > 0 )
return FALSE;
/* Ethereal people can only attack other ethereal people */
if ( IS_AFFECTED(ch, AFF_ETHEREAL) && !IS_AFFECTED(victim, AFF_ETHEREAL) )
{
send_to_char( "You cannot while ethereal.\n\r", ch );
return TRUE;
}
if ( !IS_AFFECTED(ch, AFF_ETHEREAL) && IS_AFFECTED(victim, AFF_ETHEREAL) )
{
send_to_char( "You cannot fight an ethereal person.\n\r", ch );
return TRUE;
}
/* You cannot attack across planes */
if ( IS_AFFECTED(ch, AFF_SHADOWPLANE)
&& !IS_AFFECTED(victim, AFF_SHADOWPLANE) )
{
act( "You are too insubstantial!", ch, NULL, victim, TO_CHAR );
return TRUE;
}
if ( !IS_AFFECTED(ch, AFF_SHADOWPLANE)
&& IS_AFFECTED(victim, AFF_SHADOWPLANE) )
{
act( "$E is too insubstantial!", ch, NULL, victim, TO_CHAR );
return TRUE;
}
if ( is_safe_room( ch->in_room) )
{
send_to_char( "You cannot fight in a safe room.\n\r", ch );
return TRUE;
}
if ( IS_SET( ch->in_room->affected_by, ROOM_SAFE ))
{
send_to_char( "You cannot fight in a safe room.\n\r", ch );
return TRUE;
}
if ( IS_HEAD(ch,LOST_HEAD) || IS_EXTRA(ch,EXTRA_OSWITCH) )
{
send_to_char( "Objects cannot fight!\n\r", ch );
return TRUE;
}
else if ( IS_HEAD(victim,LOST_HEAD) || IS_EXTRA(victim,EXTRA_OSWITCH))
{
send_to_char( "You cannot attack an object.\n\r", ch );
return TRUE;
}
if ( IS_NPC(ch) || IS_NPC(victim) )
return FALSE;
/* Thx Josh! */
if ( victim->fighting == ch )
return FALSE;
if (IS_ITEMAFF(ch, ITEMA_PEACE))
{
send_to_char( "You are unable to attack them.\n\r", ch );
return TRUE;
}
if (IS_ITEMAFF(victim, ITEMA_PEACE))
{
send_to_char( "You can't seem to attack them.\n\r", ch );
return TRUE;
}
if (!IS_NPC(ch) && IS_AFFECTED(ch, AFF_SAFE) )
{
send_to_char( "You cannot attack people under Gaia's protection.\n\r", ch );
return TRUE;
}
if (!IS_NPC(victim) && IS_AFFECTED(victim, AFF_SAFE) )
{
send_to_char( "You cannot attack people under Gaia's protection.\n\r", ch );
return TRUE;
}
if (!IS_NPC(victim) && IS_AFFECTED(victim, AFF_STEELSHIELD) )
{
send_to_char( "They are far to imposing.\n\r", ch );
return TRUE;
}
/* if ( ch->trust > LEVEL_BUILDER )
{
send_to_char( "You cannot fight if you have implementor powers!\n\r", ch );
return TRUE;
}
if ( victim->trust > LEVEL_BUILDER )
{
send_to_char( "You cannot fight someone with implementor powers!\n\r", ch );
return TRUE;
}*/
else if (strlen(ch->pcdata->love) > 1 &&
!str_cmp(ch->pcdata->love, victim->name))
{
send_to_char( "How could you attack someone you love?!\n\r",ch );
return TRUE;
}
if ( !CAN_PK(ch) || !CAN_PK(victim) )
{
send_to_char( "Both players must be avatars to fight.\n\r", ch );
return TRUE;
}
return FALSE;
}
bool no_attack( CHAR_DATA *ch, CHAR_DATA *victim )
{
if ( !IS_NPC(ch) && ch->level < 3 && !IS_NPC(victim) )
{
stc("You must be an avatar to fight other avatars!\n\r",ch);
return TRUE;
}
if ( !IS_NPC(victim) && !IS_NPC(ch) && victim->level < 3 )
{
stc("They must be an avatar!\n\r",ch);
return TRUE;
}
if ( victim->fight_timer > 0 )
return FALSE;
/* Ethereal people can only attack other ethereal people */
if ( IS_AFFECTED(ch, AFF_ETHEREAL) && !IS_AFFECTED(victim, AFF_ETHEREAL) )
{
send_to_char( "You cannot while ethereal.\n\r", ch );
return TRUE;
}
if ( !IS_AFFECTED(ch, AFF_ETHEREAL) && IS_AFFECTED(victim, AFF_ETHEREAL) )
{
send_to_char( "You cannot fight an ethereal person.\n\r", ch );
return TRUE;
}
/* You cannot attack across planes */
if ( IS_AFFECTED(ch, AFF_SHADOWPLANE) && !IS_AFFECTED(victim, AFF_SHADOWPLANE) )
{
act( "You are too insubstantial!", ch, NULL, victim, TO_CHAR );
return TRUE;
}
if ( !IS_AFFECTED(ch, AFF_SHADOWPLANE) && IS_AFFECTED(victim, AFF_SHADOWPLANE) )
{
act( "$E is too insubstantial!", ch, NULL, victim, TO_CHAR );
return TRUE;
}
if ( IS_SET(ch->in_room->room_flags,ROOM_SAFE) )
{
send_to_char( "You cannot fight in a safe room.\n\r", ch );
return TRUE;
}
if ( IS_SET( ch->in_room->affected_by, ROOM_SAFE ))
{
send_to_char( "You cannot fight in a safe room.\n\r", ch );
return TRUE;
}
if ( IS_HEAD(ch,LOST_HEAD) || IS_EXTRA(ch,EXTRA_OSWITCH) )
{
send_to_char( "Objects cannot fight!\n\r", ch );
return TRUE;
}
else if ( IS_HEAD(victim,LOST_HEAD) || IS_EXTRA(victim,EXTRA_OSWITCH) )
{
send_to_char( "You cannot attack objects.\n\r", ch );
return TRUE;
}
return FALSE;
}
bool is_safe_quiet( CHAR_DATA *ch, CHAR_DATA *victim )
{
if ( IS_NPC(victim) && victim->pIndexData->pShop )
return TRUE;
if ( IS_NPC(ch) && ch->pIndexData->pShop )
return TRUE;
if( IS_AFFECTED(ch,AFF_ETHEREAL) )
return TRUE;
if ( !IS_NPC(ch) && ch->level < 3 && !IS_NPC(victim) )
return TRUE;
if ( !IS_NPC(victim) && !IS_NPC(ch) && victim->level < 3 )
return TRUE;
if ( !IS_NPC(victim) )
{
if (victim->pcdata->in_progress /* &&
(!victim->pcdata->in_progress->text) */ )
return TRUE;
}
if ( victim->fight_timer > 0 )
return FALSE;
/* Ethereal people can only attack other ethereal people */
if ( IS_AFFECTED(ch, AFF_ETHEREAL) && !IS_AFFECTED(victim, AFF_ETHEREAL) )
return TRUE;
if ( !IS_AFFECTED(ch, AFF_ETHEREAL) && IS_AFFECTED(victim, AFF_ETHEREAL) )
return TRUE;
/* You cannot attack across planes */
if ( IS_AFFECTED(ch, AFF_SHADOWPLANE)
&& !IS_AFFECTED(victim, AFF_SHADOWPLANE) )
return TRUE;
if ( !IS_AFFECTED(ch, AFF_SHADOWPLANE)
&& IS_AFFECTED(victim, AFF_SHADOWPLANE) )
return TRUE;
if ( is_safe_room( ch->in_room) )
return TRUE;
if ( IS_SET( ch->in_room->affected_by, ROOM_SAFE ))
return TRUE;
if ( IS_HEAD(ch,LOST_HEAD) || IS_EXTRA(ch,EXTRA_OSWITCH) )
return TRUE;
else if ( IS_HEAD(victim,LOST_HEAD) || IS_EXTRA(victim,EXTRA_OSWITCH))
return TRUE;
if ( IS_NPC(ch) || IS_NPC(victim) )
return FALSE;
if ( victim->fighting == ch )
return FALSE;
if (IS_ITEMAFF(ch, ITEMA_PEACE))
return TRUE;
if (IS_ITEMAFF(victim, ITEMA_PEACE))
return TRUE;
if (!IS_NPC(ch) && IS_AFFECTED(ch, AFF_SAFE) )
return TRUE;
if (!IS_NPC(victim) && IS_AFFECTED(victim, AFF_SAFE) )
return TRUE;
if (!IS_NPC(victim) && IS_AFFECTED(victim, AFF_STEELSHIELD) )
return TRUE;
else if (strlen(ch->pcdata->love) > 1 &&
!str_cmp(ch->pcdata->love, victim->name))
return TRUE;
if ( !CAN_PK(ch) || !CAN_PK(victim) )
return TRUE;
return FALSE;
}
/*
* See if an attack justifies a KILLER flag.
*/
void check_killer( CHAR_DATA *ch, CHAR_DATA *victim )
{
/*
* Follow charm thread to responsible character.
* Attacking someone's charmed char is hostile!
*/
while ( IS_AFFECTED(victim, AFF_CHARM) && victim->master != NULL )
victim = victim->master;
/*
* NPC's are fair game.
* So are killers and thieves.
*/
if ( IS_NPC(victim) )
return;
/*
* Charm-o-rama.
*/
if ( IS_SET(ch->affected_by, AFF_CHARM) )
{
if ( ch->master == NULL )
{
affect_strip( ch, gsn_charm_person );
REMOVE_BIT( ch->affected_by, AFF_CHARM );
return;
}
stop_follower( ch );
return;
}
return;
}
/*
* Check for parry.
*/
bool check_parry( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
{
OBJ_DATA *obj = NULL;
int chance = 0;
int thingy;
bool claws = FALSE;
bool hands = FALSE;
if ( !IS_AWAKE(victim) )
return FALSE;
if ( !IS_AWAKE(victim) || IS_POLYAFF(victim, POLY_SERPENT) ||
IS_POLYAFF(victim, POLY_BAT) || IS_POLYAFF(victim, POLY_RAVEN) )
return FALSE;
if ( IS_CLASS(victim, CLASS_WEREWOLF) &&
victim->gifts[AHROUN] >= 2 &&
IS_VAMPAFF(victim, VAM_CLAWS) &&
get_eq_char(victim, WEAR_WIELD) == NULL &&
get_eq_char(victim, WEAR_HOLD) == NULL)
{
obj = NULL;
claws = TRUE;
}
else if ( IS_CLASS(victim, CLASS_MONK) &&
IS_SET(victim->newbits, NEW_MONKADAM) &&
get_eq_char(victim, WEAR_WIELD) == NULL &&
get_eq_char(victim, WEAR_HOLD) == NULL)
{
obj = NULL;
claws = TRUE;
}
else
{
if ( ( obj = get_eq_char( victim, WEAR_WIELD ) ) == NULL
|| obj->item_type != ITEM_WEAPON )
{
if ( ( obj = get_eq_char( victim, WEAR_HOLD ) ) == NULL
|| obj->item_type != ITEM_WEAPON ) return FALSE;
}
}
if (dt < 1000 || dt > 1012) return FALSE;
if (!IS_NPC(ch)) chance -= (ch->wpn[dt-1000] * 0.1);
else chance -= (ch->level * 0.2);
if (!IS_NPC(victim)) chance += (victim->wpn[dt-1000] * 0.5);
else chance += victim->level;
if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_CRANE) &&
victim->stance[STANCE_CRANE] > 0 && !can_counter(ch) &&
!can_bypass(ch,victim))
chance += (victim->stance[STANCE_CRANE] * .25);
else if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_MANTIS) &&
victim->stance[STANCE_MANTIS] > 0 && !can_counter(ch) &&
!can_bypass(ch,victim))
chance += (victim->stance[STANCE_MANTIS] * .25);
chance -= (char_hitroll(ch) * 0.1);
if (claws)
{
chance += (char_hitroll(victim) * 0.075);
}
else chance += (char_hitroll(victim) * 0.1);
if (hands)
{
chance += (char_hitroll(victim) * 0.075);
}
else chance += (char_hitroll(victim) * 0.1);
if (!IS_NPC(ch))
{
if ( IS_ITEMAFF(ch, ITEMA_MASTERY) )
chance -= 5;
if ( IS_CLASS(ch, CLASS_VAMPIRE) )
{
if ( ch->pcdata->powers[VAM_CELE] > 0 )
chance -= ( 5 * ch->pcdata->powers[VAM_CELE] );
}
if ( IS_CLASS(ch, CLASS_NINJA) )
{
if ( ch->pcdata->powers[NPOWER_CHIKYU] >= 6
&& ch->pcdata->powers[HARA_KIRI] > 0 )
chance -= 25;
if ( ch->pcdata->powers[NPOWER_CHIKYU] > 2 )
chance -= 20;
if ( ch->pcdata->powers[NINJAKI] > 4 )
chance -= ( ch->pcdata->powers[NINJAKI] / 4 );
}
if ( IS_CLASS(ch, CLASS_ANGEL) )
{
if( IS_ANGPOWER(ch, ANG_SPEED) )
chance -= 15;
}
if ( IS_CLASS(ch, CLASS_PRIEST) )
{
chance -= 10;
}
if ( IS_CLASS(ch, CLASS_DEMON) )
{
if ( IS_DEMPOWER(ch, DEM_SPEED) )
chance -= 15;
}
if ( IS_CLASS(ch, CLASS_MAGE) )
{
if ( IS_SET(ch->mflags, MAGE_POLYAPPEAR) )
chance -= 10;
if ( ch->spheres[MTIM] > 0 )
chance -= ( ch->spheres[MTIM] * 3 );
}
if ( IS_CLASS(ch, CLASS_DROW) )
{
if ( IS_SET(ch->pcdata->powers[1], DPOWER_ARMS) )
chance -= 20;
chance -= 40;
}
if ( IS_CLASS(ch, CLASS_WEREWOLF) )
{
if ( IS_SET(ch->special, SPC_WOLFMAN) )
chance -= 5;
if ( ch->gifts[SILENTSTRIDERS] > 0 )
chance -= 5;
if ( ch->gifts[SILENTSTRIDERS] > 1 )
chance -= 10;
if ( ch->gifts[SILENTSTRIDERS] > 2 )
chance -= 10;
if ( ch->gifts[STARGAZERS] > 3 )
chance -= 5;
}
if ( IS_CLASS(ch, CLASS_MONK) )
{
if ( ch->chi[CURRENT] > 0 )
chance -= ( ch->chi[CURRENT] * 4 );
}
}
/* Some shit for Earth Embrace )Mage Power(, works on NPC's.. */
if ( IS_SET(victim->mflags, MAGE_EMBRACED2) )
chance += 10;
if ( IS_SET(victim->mflags, MAGE_EMBRACED1) )
chance += 5;
if ( IS_SET(ch->mflags, MAGE_EMBRACED2) )
chance -= 10;
if ( IS_SET(ch->mflags, MAGE_EMBRACED1) )
chance -= 5;
/* if(IS_CLASS(ch,CLASS_DROW)) chance *= 2;
if(IS_CLASS(ch,CLASS_DROW)) chance /= 3;*/
if (!IS_NPC(victim))
{
/*
* Everything was 50, i changed -- Dreimas
*/
if ( IS_ITEMAFF(victim, ITEMA_MASTERY) )
chance += 5;
if ( IS_CLASS(victim,CLASS_VAMPIRE) )
{
if ( victim->pcdata->powers[VAM_CELE] > 0 )
chance += ( 3 * victim->pcdata->powers[VAM_CELE] );
}
if ( IS_CLASS(victim, CLASS_NINJA) )
{
if ( victim->pcdata->powers[NPOWER_CHIKYU] >= 6
&& victim->pcdata->powers[HARA_KIRI] > 0 )
chance += 25;
if ( victim->pcdata->powers[NPOWER_CHIKYU] > 2 )
chance += 20;
if ( victim->pcdata->powers[NINJAKI] > 4 )
chance += ( victim->pcdata->powers[NINJAKI] / 4 );
}
if ( IS_CLASS(victim, CLASS_ANGEL) )
{
if( IS_ANGPOWER(victim, ANG_SPEED) )
chance += 15;
}
if ( IS_CLASS(victim, CLASS_PRIEST) )
{
chance += 15;
}
if ( IS_CLASS(victim, CLASS_DEMON) )
{
if ( IS_DEMPOWER(victim, DEM_SPEED) )
chance += 15;
}
if ( IS_CLASS(victim, CLASS_DROW) )
{
if ( IS_SET(victim->pcdata->powers[1], DPOWER_ARMS) )
chance += 20;
chance += 40;
}
if ( IS_CLASS(victim, CLASS_MAGE) )
{
if ( IS_SET(victim->mflags, MAGE_POLYAPPEAR) )
chance += 10;
if ( victim->spheres[MTIM] > 0 )
chance += ( victim->spheres[MTIM] * 2 );
}
if ( IS_CLASS(victim, CLASS_MONK) )
{
if ( victim->chi[CURRENT] > 0 )
chance += ( victim->chi[CURRENT] * 4 );
}
if ( IS_CLASS(victim, CLASS_WEREWOLF) )
{
if ( IS_SET(victim->special, SPC_WOLFMAN) )
chance += 5;
if ( victim->gifts[SILENTSTRIDERS] > 0 )
chance += 5;
if ( victim->gifts[SILENTSTRIDERS] > 1 )
chance += 10;
if ( victim->gifts[SILENTSTRIDERS] > 2 )
chance += 10;
if ( victim->gifts[STARGAZERS] > 3 )
chance += 5;
}
}
if (chance > 75) chance = 75;
else if (chance < 25) chance = 25;
if (!IS_NPC(ch) && ch->pcdata->powers[VAM_CELE] > 0 &&
IS_CLASS(ch, CLASS_VAMPIRE))
{
if (ch->pcdata->rank == AGE_METHUSELAH) chance -= 10;
else if (ch->pcdata->rank == AGE_ELDER) chance -= 7;
else if (ch->pcdata->rank == AGE_ANCILLA) chance -= 5;
}
if (!IS_NPC(victim) && victim->pcdata->powers[VAM_CELE] > 0 &&
IS_CLASS(victim, CLASS_VAMPIRE))
{
if (victim->pcdata->rank == AGE_METHUSELAH) chance += 10;
else if (victim->pcdata->rank == AGE_ELDER) chance += 7;
else if (victim->pcdata->rank == AGE_ANCILLA) chance += 5;
}
/*
if ( !IS_NPC(victim) && IS_CLASS(victim, CLASS_MONK) )
{
if ( victim->monkblock / 4 > 0 )
chance += victim->monkblock / 4;
}
*/
if ( IS_NPC(victim) )
{
if ( victim->level < 100 )
chance = 15;
if ( victim->level >= 100 )
chance = ( victim->level * .01 );
if ( victim->level >= 500 )
chance = 50;
}
chance -= sysdata.parry_mod;
thingy = number_range(1,100);
if ( thingy >= chance )
return FALSE;
if( !IS_NPC(victim) && victim->move < 5 )
return FALSE;
if( !IS_NPC(victim) )
victim->move -= 5;
if (claws)
{
if (IS_NPC(victim) || !IS_SET(victim->act, PLR_BRIEF))
act( "{wYou parry {W$n{w's blow with your claws.{w", ch, NULL, victim, TO_VICT );
if (IS_NPC(ch) || !IS_SET(ch->act, PLR_BRIEF))
act( "{W$N{w parries your blow with $S claws.{w", ch, NULL, victim, TO_CHAR );
return TRUE;
}
if (hands)
{
if (IS_NPC(victim) || !IS_SET(victim->act, PLR_BRIEF))
act( "You parry $n's blow with your adamantium hands.", ch, NULL, victim, TO_VICT);
if (IS_NPC(ch) || !IS_SET(ch->act, PLR_BRIEF))
act( "$N parries your blow with $S adamantium hands.", ch, NULL, victim, TO_CHAR);
return TRUE;
}
/* if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_MONK)
&& victim->monkblock < 150 )
victim->monkblock++;
*/
if (!IS_NPC(victim) && obj != NULL && obj->item_type == ITEM_WEAPON &&
obj->value[3] >= 0 && obj->value[3] <= 12)
{
if (IS_NPC(victim) || !IS_SET(victim->act, PLR_BRIEF))
act( "{wYou parry {W$n{w's blow with $p.{w", ch, obj, victim, TO_VICT );
if (IS_NPC(ch) || !IS_SET(ch->act, PLR_BRIEF))
act( "{W$N{w parries your blow with $p.{w", ch, obj, victim, TO_CHAR );
return TRUE;
}
if (IS_NPC(victim) || !IS_SET(victim->act, PLR_BRIEF))
act( "{wYou parry {W$n{w's attack.{w", ch, NULL, victim, TO_VICT );
if (IS_NPC(ch) || !IS_SET(ch->act, PLR_BRIEF))
act( "{W$N{w parries your attack.{w", ch, NULL, victim, TO_CHAR );
return TRUE;
}
/*
* Check for dodge.
*/
bool check_dodge( CHAR_DATA *ch, CHAR_DATA *victim, int dt )
{
int chance = 0;
int thingy;
if ( !IS_AWAKE(victim) )
return FALSE;
if (!IS_NPC(ch)) chance -= (ch->wpn[dt-1000] * 0.1);
else chance -= (ch->level * 0.2);
if (!IS_NPC(victim)) chance += (victim->wpn[0] * 0.5);
else chance += victim->level;
if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_MONGOOSE) &&
victim->stance[STANCE_MONGOOSE] > 0 && !can_counter(ch) &&
!can_bypass(ch,victim))
(chance += victim->stance[STANCE_MONGOOSE] * 0.25);
if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_SWALLOW) &&
victim->stance[STANCE_SWALLOW] > 0 && !can_counter(ch) &&
!can_bypass(ch,victim))
(chance += victim->stance[STANCE_SWALLOW] * 0.25);
if (!IS_NPC(victim) && IS_STANCE(victim, STANCE_EAGLE) &&
victim->stance[STANCE_EAGLE] > 0 && !can_counter(ch) &&
!can_bypass(ch,victim))
(chance += victim->stance[STANCE_EAGLE] * 0.30);
if ( IS_ITEMAFF(ch, ITEMA_MASTERY) )
chance -= 5;
if (!IS_NPC(ch))
{
if ( IS_CLASS(ch, CLASS_VAMPIRE) )
{
chance -= 20;
}
if ( IS_CLASS(ch, CLASS_NINJA) )
{
chance -= 20;
}
if ( IS_CLASS(ch, CLASS_DEMON) )
{
chance -= 20;
}
if ( IS_CLASS(ch, CLASS_MAGE) )
{
chance -= 20;
}
if ( IS_CLASS(ch, CLASS_DROW) )
{
chance -= 20;
}
if ( IS_CLASS(ch, CLASS_WEREWOLF) )
{
chance -= 20;
}
if ( IS_CLASS(ch, CLASS_ANGEL) )
{
chance -= 20;
}
if ( IS_CLASS(ch, CLASS_PRIEST) )
{
chance -= 20;
}
if ( IS_CLASS(ch, CLASS_RANGER) )
{
chance -= 20;
}
if ( IS_CLASS(ch, CLASS_MONK) )
{
chance -= 20;
}
if ( IS_CLASS(ch, CLASS_HIGHLANDER) )
{
chance -= 20;
}
}
/* Some shit for Earth Embrace )Mage Power(, works on NPC's.. */
if ( IS_SET(victim->mflags, MAGE_EMBRACED2) )
chance += 10;
if ( IS_SET(victim->mflags, MAGE_EMBRACED1) )
chance += 5;
if ( IS_SET(ch->mflags, MAGE_EMBRACED2) )
chance -= 10;
if ( IS_SET(ch->mflags, MAGE_EMBRACED1) )
chance -= 5;
if ( IS_ITEMAFF(victim, ITEMA_MASTERY) )
chance += 5;
if (!IS_NPC(victim))
{
if ( IS_CLASS(victim, CLASS_VAMPIRE) )
{
chance += 20;
}
if ( IS_CLASS(victim, CLASS_NINJA) )
{
chance += 20;
}
if ( IS_CLASS(victim, CLASS_DEMON) )
{
chance += 20;
}
if ( IS_CLASS(victim, CLASS_DROW) )
{
chance += 20;
}
if ( IS_CLASS(victim, CLASS_MAGE) )
{
chance += 20;
}
if ( IS_CLASS(victim, CLASS_MONK) )
{
chance += 50;
}
if ( IS_CLASS(victim, CLASS_ANGEL) )
{
chance += 20;
}
if ( IS_CLASS(ch, CLASS_PRIEST) )
{
chance += 20;
}
if ( IS_CLASS(ch, CLASS_RANGER) )
{
chance += 20;
}
if ( IS_CLASS(victim, CLASS_WEREWOLF) )
{
chance += 20;
}
}
if (chance > 75) chance = 75;
else if (chance < 25) chance = 25;
if (!IS_NPC(ch) && IS_VAMPAFF(ch, VAM_CELERITY) &&
IS_CLASS(ch, CLASS_VAMPIRE))
{
if (ch->pcdata->rank == AGE_METHUSELAH) chance -= 10;
else if (ch->pcdata->rank == AGE_ELDER) chance -= 7;
else if (ch->pcdata->rank == AGE_ANCILLA) chance -= 5;
}
if (!IS_NPC(victim) && IS_VAMPAFF(victim, VAM_CELERITY) &&
IS_CLASS(victim, CLASS_VAMPIRE))
{
if (victim->pcdata->rank == AGE_METHUSELAH) chance += 10;
else if (victim->pcdata->rank == AGE_ELDER) chance += 7;
else if (victim->pcdata->rank == AGE_ANCILLA) chance += 5;
}
if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_MONK)
&& ( victim->monkblock / 4 > 0 ) )
chance += (victim->monkblock / 4);
if (!IS_NPC(ch) && IS_CLASS(ch, CLASS_MONK)
&& ( ch->monkblock / 4 > 0 ) )
chance -= (ch->monkblock / 4);
if ( IS_NPC(victim) )
{
if ( victim->level < 100 )
chance = 15;
if ( victim->level >= 100 )
chance = ( victim->level * .01 );
if ( victim->level >= 500 )
chance = 50;
}
chance -= sysdata.dodge_mod;
thingy = number_range(1,100);
if ( thingy >= chance )
return FALSE;
if( !IS_NPC(victim) && victim->move < 5 )
return FALSE;
if( !IS_NPC(victim) )
victim->move -= 5;
if (IS_NPC(victim) || !IS_SET(victim->act, PLR_BRIEF))
act( "{wYou{w dodge {W$n{w's attack.{x", ch, NULL, victim, TO_VICT );
if (IS_NPC(ch) || !IS_SET(ch->act, PLR_BRIEF))
act( "{W$N{w dodges your attack.{x", ch, NULL, victim, TO_CHAR );
return TRUE;
}
/*
* Set position of a victim.
*/
void update_pos( CHAR_DATA *victim )
{
CHAR_DATA *mount;
if ( victim->hit > 0 )
{
if ( victim->position <= POS_STUNNED )
{
bool gm_stance = FALSE;
victim->position = POS_STANDING;
if (!IS_NPC(victim) && victim->stance[0] > 0)
{
int stance = victim->stance[0];
if (victim->stance[stance] >= 200) gm_stance = TRUE;
}
if (IS_NPC(victim) || victim->max_hit * 0.25 > victim->hit ||
!gm_stance)
{
act( "$n clambers back to $s feet.", victim, NULL, NULL, TO_ROOM);
act( "You clamber back to your feet.", victim, NULL, NULL, TO_CHAR);
}
else
{
act( "$n flips back up to $s feet.", victim, NULL, NULL, TO_ROOM);
act( "You flip back up to your feet.", victim, NULL, NULL, TO_CHAR);
}
}
return;
}
else if ( (mount = victim->mount) != NULL)
{
if (victim->mounted == IS_MOUNT)
{
act("$n rolls off $N.",mount,NULL,victim,TO_ROOM);
act("You roll off $N.",mount,NULL,victim,TO_CHAR);
}
else if (victim->mounted == IS_RIDING)
{
act("$n falls off $N.",victim,NULL,mount,TO_ROOM);
act("You fall off $N.",victim,NULL,mount,TO_CHAR);
}
mount->mount = NULL;
victim->mount = NULL;
mount->mounted = IS_ON_FOOT;
victim->mounted = IS_ON_FOOT;
}
if (!IS_NPC(victim) && victim->hit <=-11 && IS_HERO(victim))
{
victim->hit = -10;
if (victim->position == POS_FIGHTING)
stop_fighting(victim,TRUE);
return;
}
if ( IS_NPC(victim) || victim->hit <= -11 )
{
victim->position = POS_DEAD;
return;
}
if ( victim->hit <= -6 ) victim->position = POS_MORTAL;
else if ( victim->hit <= -3 ) victim->position = POS_INCAP;
else victim->position = POS_STUNNED;
return;
}
/*
* Start fights.
*/
void set_fighting( CHAR_DATA *ch, CHAR_DATA *victim )
{
if ( ch->fighting != NULL )
{
return;
}
if ( !IS_NPC( ch ) && !IS_NPC( victim) )
ch->fight_timer = 10;
if ( !IS_NPC( victim ) && !IS_NPC( ch ) )
victim->fight_timer = 10;
if ( IS_AFFECTED(ch, AFF_SLEEP) )
affect_strip( ch, gsn_sleep );
ch->fighting = victim;
ch->position = POS_FIGHTING;
ch->damcap[DAM_CHANGE] = 1;
autodrop(ch);
autodrop(victim);
if (IS_AFFECTED(ch, AFF_STEELSHIELD))
{
REMOVE_BIT(ch->affected_by, AFF_STEELSHIELD);
}
return;
}
void stop_embrace( CHAR_DATA *ch, CHAR_DATA *victim )
{
if (victim==NULL)
{ch->embracing=NULL;return;}
victim->embraced=NULL;
ch->embracing=NULL;
stc("You release your hold on your victim!\n\r", ch );
//act("$N releases his hold on $N.",ch,NULL,victim,TO_CHAR);
return;
}
/*
* Stop fights.
*/
void stop_fighting( CHAR_DATA *ch, bool fBoth )
{
CHAR_DATA *fch;
for ( fch = char_list; fch != NULL; fch = fch->next )
{
if ( fch == ch || ( fBoth && fch->fighting == ch ) )
{
fch->fighting = NULL;
fch->position = POS_STANDING;
update_pos( fch );
}
}
return;
}
/*
* Make a corpse out of a character.
*/
void make_corpse( CHAR_DATA *ch, CHAR_DATA *maker )
{
char buf[MAX_STRING_LENGTH];
OBJ_DATA *corpse;
OBJ_DATA *obj;
OBJ_DATA *obj_next;
char *name;
if ( IS_NPC(ch) )
{
name = ch->short_descr;
corpse = create_object(get_obj_index(OBJ_VNUM_CORPSE_NPC), 0);
corpse->timer = number_range( 4, 8 );
corpse->value[2]= ch->pIndexData->vnum;
if ( ch->gold > 0 )
{
obj_to_obj( create_money( ch->gold ), corpse );
ch->gold = 0;
}
}
else
{
name = ch->name;
corpse = create_object(get_obj_index(OBJ_VNUM_CORPSE_PC), 0);
corpse->timer = number_range( 25, 40 );
/* Why should players keep their gold? */
if ( ch->gold > 0 )
{
obj = create_money( ch->gold );
if (IS_AFFECTED(ch,AFF_SHADOWPLANE) &&
(!IS_SET(obj->extra_flags, ITEM_SHADOWPLANE) ) )
SET_BIT(obj->extra_flags, ITEM_SHADOWPLANE);
obj_to_obj( obj, corpse );
ch->gold = 0;
}
}
free_string(corpse->questmaker);
if (IS_NPC(maker)) corpse->questmaker = str_dup(maker->short_descr);
else corpse->questmaker = str_dup(maker->name);
free_string(corpse->questowner);
if (IS_NPC(ch)) corpse->questowner = str_dup(ch->short_descr);
else corpse->questowner = str_dup(ch->name);
if (ch->in_room != NULL) corpse->specpower = ch->in_room->vnum;
sprintf( buf, corpse->short_descr, name );
free_string( corpse->short_descr );
corpse->short_descr = str_dup( buf );
sprintf( buf, corpse->description, name );
free_string( corpse->description );
corpse->description = str_dup( buf );
for ( obj = ch->carrying; obj != NULL; obj = obj_next )
{
obj_next = obj->next_content;
obj_from_char( obj );
if ( IS_SET( obj->extra_flags, ITEM_VANISH ) )
extract_obj( obj );
else
{
if (IS_AFFECTED(ch,AFF_SHADOWPLANE) &&
(!IS_SET(obj->extra_flags, ITEM_SHADOWPLANE) ) )
SET_BIT(obj->extra_flags, ITEM_SHADOWPLANE);
obj_to_obj( obj, corpse );
}
}
/* If you die in the shadowplane, your corpse should stay there */
if (IS_AFFECTED(ch, AFF_SHADOWPLANE))
SET_BIT(corpse->extra_flags, ITEM_SHADOWPLANE);
if (IS_NPC(ch))
obj_to_room( corpse, maker->in_room );
else if( get_hours_played(ch) < 3 )
obj_to_room(corpse, get_room_index(ROOM_VNUM_MORGUE));
else
obj_to_room( corpse, maker->in_room );
return;
}
void death_cry( CHAR_DATA *ch )
{
ROOM_INDEX_DATA *was_in_room;
char *msg;
int door;
if ( IS_NPC(ch) )
msg = "You hear something's death cry.";
else
msg = "You hear someone's death cry.";
was_in_room = ch->in_room;
if( !was_in_room )
{
bugf( "Death_cry: %s null room, setting to 3054", ch->name );
was_in_room = get_room_index( ROOM_VNUM_ESCAPE );
}
char_from_room(ch);
for ( door = 0; door <= 5; door++ )
{
EXIT_DATA *pexit;
if ( ( pexit = was_in_room->exit[door] ) != NULL
&& pexit->to_room != NULL
&& pexit->to_room != was_in_room )
{
char_to_room( ch, pexit->to_room);
act( msg, ch, NULL, NULL, TO_ROOM );
char_from_room( ch );
}
}
char_to_room(ch,was_in_room);
return;
}
void make_part( CHAR_DATA *ch, char *argument )
{
char arg [MAX_INPUT_LENGTH];
int vnum;
argument = one_argument(argument,arg);
vnum = 0;
if (arg[0] == '\0') return;
if (!str_cmp(arg,"head")) vnum = OBJ_VNUM_SEVERED_HEAD;
else if (!str_cmp(arg,"arm")) vnum = OBJ_VNUM_SLICED_ARM;
else if (!str_cmp(arg,"leg")) vnum = OBJ_VNUM_SLICED_LEG;
else if (!str_cmp(arg,"heart")) vnum = OBJ_VNUM_TORN_HEART;
else if (!str_cmp(arg,"turd")) vnum = OBJ_VNUM_TORN_HEART;
else if (!str_cmp(arg,"entrails")) vnum = OBJ_VNUM_SPILLED_ENTRAILS;
else if (!str_cmp(arg,"brain")) vnum = OBJ_VNUM_QUIVERING_BRAIN;
else if (!str_cmp(arg,"eyeball")) vnum = OBJ_VNUM_SQUIDGY_EYEBALL;
else if (!str_cmp(arg,"blood")) vnum = OBJ_VNUM_SPILT_BLOOD;
else if (!str_cmp(arg,"face")) vnum = OBJ_VNUM_RIPPED_FACE;
else if (!str_cmp(arg,"windpipe")) vnum = OBJ_VNUM_TORN_WINDPIPE;
else if (!str_cmp(arg,"cracked_head")) vnum = OBJ_VNUM_CRACKED_HEAD;
else if (!str_cmp(arg,"ear")) vnum = OBJ_VNUM_SLICED_EAR;
else if (!str_cmp(arg,"nose")) vnum = OBJ_VNUM_SLICED_NOSE;
else if (!str_cmp(arg,"tooth")) vnum = OBJ_VNUM_KNOCKED_TOOTH;
else if (!str_cmp(arg,"tongue")) vnum = OBJ_VNUM_TORN_TONGUE;
else if (!str_cmp(arg,"hand")) vnum = OBJ_VNUM_SEVERED_HAND;
else if (!str_cmp(arg,"foot")) vnum = OBJ_VNUM_SEVERED_FOOT;
else if (!str_cmp(arg,"thumb")) vnum = OBJ_VNUM_SEVERED_THUMB;
else if (!str_cmp(arg,"index")) vnum = OBJ_VNUM_SEVERED_INDEX;
else if (!str_cmp(arg,"middle")) vnum = OBJ_VNUM_SEVERED_MIDDLE;
else if (!str_cmp(arg,"ring")) vnum = OBJ_VNUM_SEVERED_RING;
else if (!str_cmp(arg,"little")) vnum = OBJ_VNUM_SEVERED_LITTLE;
else if (!str_cmp(arg,"toe")) vnum = OBJ_VNUM_SEVERED_TOE;
if ( vnum != 0 )
{
char buf[MAX_STRING_LENGTH];
OBJ_DATA *obj;
char *name;
name = IS_NPC(ch) ? ch->short_descr : ch->name;
obj = create_object( get_obj_index( vnum ), 0 );
if (IS_NPC(ch)) obj->timer = number_range(2,15);
else obj->timer = -1;
if (!str_cmp(arg,"head") && IS_NPC(ch))
obj->value[1] = ch->pIndexData->vnum;
else if (!str_cmp(arg,"head") && !IS_NPC(ch))
{ch->pcdata->chobj = obj; obj->chobj = ch;obj->timer =
number_range(1,2);}
/* else if (!str_cmp(arg,"arm"))
SET_BIT(obj->extra_flags, ITEM_ARM); */
else if (!str_cmp(arg,"brain") && !IS_NPC(ch) &&
IS_AFFECTED(ch,AFF_POLYMORPH) && IS_HEAD(ch, LOST_HEAD))
{
if (ch->pcdata->chobj != NULL) ch->pcdata->chobj->chobj = NULL;
ch->pcdata->chobj = obj;
obj->chobj = ch;
obj->timer = number_range(2,3);
}
/* For blood :) KaVir */
if (vnum == OBJ_VNUM_SPILT_BLOOD) obj->timer = 2;
/* For voodoo dolls - KaVir */
if (!IS_NPC(ch))
{
sprintf( buf, obj->name, name );
free_string( obj->name );
obj->name = str_dup( buf );
}
else
{
sprintf( buf, obj->name, "mob" );
free_string( obj->name );
obj->name = str_dup( buf );
}
sprintf( buf, obj->short_descr, name );
free_string( obj->short_descr );
obj->short_descr = str_dup( buf );
sprintf( buf, obj->description, name );
free_string( obj->description );
obj->description = str_dup( buf );
if (IS_AFFECTED(ch, AFF_SHADOWPLANE))
SET_BIT(obj->extra_flags, ITEM_SHADOWPLANE);
obj_to_room( obj, ch->in_room );
}
return;
}
void raw_kill( CHAR_DATA *victim, CHAR_DATA *ch )
{
CHAR_DATA *mount;
if (!IS_NPC(victim) && victim->fatal > 0)
death_message(ch,victim);
stop_fighting( victim, TRUE );
victim->agg = 0;
if (IS_NPC(victim) && (IS_SET(victim->flag2, VAMP_CLONE)
|| IS_SPIRIT(victim)))
act("$n slowly fades away to nothing.",victim,NULL,NULL,TO_ROOM);
else if (IS_NPC(victim) && strlen(victim->powertype) > 1
&& !str_cmp(victim->powertype,"zombie"))
act("$n crumbles to dust as $e hits the floor.",victim,NULL,NULL,TO_ROOM);
else if (!IS_NPC(victim) || !IS_SET(victim->flag2, VAMP_CLONE) )
{
death_cry( victim );
make_corpse( victim, ch );
}
if ( (mount = victim->mount) != NULL)
{
if (victim->mounted == IS_MOUNT)
{
act("$n rolls off the corpse of $N.",mount,NULL,victim,TO_ROOM);
act("You roll off the corpse of $N.",mount,NULL,victim,TO_CHAR);
}
else if (victim->mounted == IS_RIDING)
{
act("$n falls off $N.",victim,NULL,mount,TO_ROOM);
act("You fall off $N.",victim,NULL,mount,TO_CHAR);
}
mount->mount = NULL;
victim->mount = NULL;
mount->mounted = IS_ON_FOOT;
victim->mounted = IS_ON_FOOT;
}
if( IS_NPC(victim )
&& ch
&& !IS_NPC(ch)
&& ch->level > 1
&& GET_PC(ch,aquest,QUEST_NONE)->type == QUEST_KILL
&& GET_PC(ch,aquest->target,NULL)== victim->pIndexData )
{
send_to_char( "{CYou have almost completed your QUEST!{x\n\r", ch );
send_to_char( "Better hurry and finish it now.\n\r", ch );
PC(ch,aquest)->type = QUEST_KILL_COMPLETE;
}
if ( IS_NPC(victim) )
{
if( !IS_NPC( ch )
&& ch->level > 1
&& GET_PC(ch,aquest,QUEST_NONE)->type == QUEST_KILL
&& GET_PC(ch,aquest->target,NULL)== victim->pIndexData )
{
send_to_char( "{CYou have almost completed your QUEST!{x\n\r", ch );
send_to_char( "Better hurry and finish it now.\n\r", ch );
PC(ch,aquest)->type = QUEST_KILL_COMPLETE;
}
victim->pIndexData->killed++;
kill_table[URANGE(0, victim->level, MAX_LEVEL-1)].killed++;
extract_char( victim, TRUE, FALSE );
return;
}
extract_char( victim, FALSE, FALSE );
while ( victim->affected )
affect_remove( victim, victim->affected );
if (IS_AFFECTED(victim,AFF_POLYMORPH) && IS_AFFECTED(victim,AFF_ETHEREAL))
{
victim->affected_by = AFF_POLYMORPH + AFF_ETHEREAL;
}
else if (IS_AFFECTED(victim,AFF_POLYMORPH))
victim->affected_by = AFF_POLYMORPH;
else if (IS_AFFECTED(victim,AFF_ETHEREAL))
victim->affected_by = AFF_ETHEREAL;
else
victim->affected_by = 0;
REMOVE_BIT(victim->immune, IMM_STAKE);
REMOVE_BIT(victim->extra, TIED_UP);
REMOVE_BIT(victim->extra, GAGGED);
REMOVE_BIT(victim->extra, BLINDFOLDED);
REMOVE_BIT(victim->extra, EXTRA_PREGNANT);
REMOVE_BIT(victim->extra, EXTRA_LABOUR);
victim->pcdata->stats[DEMON_POWER] = 0;
victim->itemaffect = 0;
victim->loc_hp[0] = 0;
victim->loc_hp[1] = 0;
victim->loc_hp[2] = 0;
victim->loc_hp[3] = 0;
victim->loc_hp[4] = 0;
victim->loc_hp[5] = 0;
victim->loc_hp[6] = 0;
victim->armor = 100;
victim->position = POS_RESTING;
victim->hit = UMAX( 1, victim->hit );
victim->mana = UMAX( 1, victim->mana );
victim->move = UMAX( 1, victim->move );
victim->hitroll = 0;
victim->damroll = 0;
victim->saving_throw = 0;
victim->carry_weight = 0;
victim->carry_number = 0;
do_call(victim,"all");
save_char_obj( victim );
return;
}
void behead( CHAR_DATA *victim, CHAR_DATA *ch )
{
char buf [MAX_STRING_LENGTH];
ROOM_INDEX_DATA *location;
if ( !victim ) return;
if (IS_NPC(victim)) return;
location = victim->in_room;
stop_fighting( victim, TRUE );
make_corpse( victim, ch);
extract_char( victim, FALSE, FALSE );
char_from_room(victim);
char_to_room(victim,location);
if (victim == NULL)
{bug( "Behead: Victim no longer exists.", 0 );return;}
make_part( victim, "head" );
while ( victim->affected )
affect_remove( victim, victim->affected );
if (IS_AFFECTED(victim,AFF_POLYMORPH) && IS_AFFECTED(victim,AFF_ETHEREAL))
{
victim->affected_by = AFF_POLYMORPH + AFF_ETHEREAL;
}
else if (IS_AFFECTED(victim,AFF_POLYMORPH))
victim->affected_by = AFF_POLYMORPH;
else if (IS_AFFECTED(victim,AFF_ETHEREAL))
victim->affected_by = AFF_ETHEREAL;
else
victim->affected_by = 0;
REMOVE_BIT(victim->immune, IMM_STAKE);
REMOVE_BIT(victim->extra, TIED_UP);
REMOVE_BIT(victim->extra, GAGGED);
REMOVE_BIT(victim->extra, BLINDFOLDED);
REMOVE_BIT(victim->extra, EXTRA_PREGNANT);
REMOVE_BIT(victim->extra, EXTRA_LABOUR);
victim->pcdata->stats[DEMON_POWER] = 0;
victim->itemaffect = 0;
victim->loc_hp[0] = 0;
victim->loc_hp[1] = 0;
victim->loc_hp[2] = 0;
victim->loc_hp[3] = 0;
victim->loc_hp[4] = 0;
victim->loc_hp[5] = 0;
victim->loc_hp[6] = 0;
victim->affected_by = 0;
victim->armor = 100;
victim->position = POS_STANDING;
victim->hit = 1;
victim->mana = UMAX( 1, victim->mana );
victim->move = UMAX( 1, victim->move );
victim->hitroll = 0;
victim->damroll = 0;
victim->saving_throw = 0;
victim->carry_weight = 0;
victim->carry_number = 0;
victim->fight_timer = 0;
SET_BIT(victim->loc_hp[0],LOST_HEAD);
SET_BIT(victim->affected_by,AFF_POLYMORPH);
sprintf(buf,"the severed head of %s",victim->name);
free_string(victim->morph);
victim->morph = str_dup(buf);
do_call(victim,"all");
save_char_obj( victim );
return;
}
void group_gain( CHAR_DATA *ch, CHAR_DATA *victim )
{
char buf[MAX_STRING_LENGTH];
/* char bleh[MAX_STRING_LENGTH];*/
CHAR_DATA *gch;
CHAR_DATA *lch;
CHAR_DATA *mount;
int xp;
int members;
/* int blah = victim->level*(number_range( 170, 250 )/60);*/
/*
* Monsters don't get kill xp's or alignment changes.
* P-killing doesn't help either.
* Dying of mortal wounds or poison doesn't give xp to anyone!
*/
if ( (IS_NPC(ch) && (mount = ch->mount) == NULL) || victim == ch )
return;
members = 0;
for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room )
{
if ( is_same_group( gch, ch ) )
members++;
}
if ( members == 0 )
{
bug( "Group_gain: members.", members );
members = 1;
}
lch = (ch->leader != NULL) ? ch->leader : ch;
for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room )
{
OBJ_DATA *obj;
OBJ_DATA *obj_next;
if ( !is_same_group( gch, ch ) )
continue;
if (members >= 5 && members <= 5) { xp = xp_compute( gch, victim ) * members; }
else {xp = xp_compute( gch, victim ) / members; }
if( xp < 0 )
xp = 0;
if ( (( get_age(gch) - 17) * 2 ) < 2 )
{
sprintf( buf, "{m*{M*{b*{B*{c*{C*{r*{R*{g*{G*{w*{W*{y*{Y*{D*{w Newbie Exp! {D*{Y*{y*{W*{w*{G*{g*{R*{r*{C*{c*{B*{b*{M*{m*{x\n\r");
send_to_char(buf,gch );
}
sprintf(buf,"{wYou gain{Showing the first 100 KB of 211.2 KB. Download the archive for the full file.