23 Sep, 2010, Xrakisis wrote in the 1st comment:
Votes: 0
Hi.
Im trying to have a light plate item. I want it to be able to be forged into a piece of eq. when that hit_loc is hit, if it has a light plate it only gives the ch half damage..
this is the problem line.. thats crashing it.
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
anyone see anything wrong with it?

xrakisis


void dam_message( CHAR_DATA *ch, CHAR_DATA *victim, int dam, int dt, int hit_loc )
{

static char *const attack_table[] = {
"hit", "slash", "stab", "slice", "lash", "thwack",
"cut", "bludgeon", "crush", "hack", "slash", "pierce", "slash",
"smash", "smash", "stab", "thwack", "slash", "stab"
};
static char *const attack_table2[] = {
"hits", "slashes", "stabs", "slices", "lashes", "thwacks",
"cuts", "bludgeons", "crushes", "hacks", "slashes", "pierces", "slashes"
"smashes", "smashes", "stabs", "thwacks", "slashes", "stabs"
};
char buf1[512], buf2[512], buf3[512];
const char *vs;
const char *vp;
const char *attack;
const char *attack2;
const char *loc;
int damp;
int bodyloc;
bool critical = FALSE;
char punct;
OBJ_DATA *obj;

if (!IS_NPC(ch) && IS_SET(ch->newbits,NEW_REND)&& dam>0 && number_range(1,7) == 5) critical=TRUE;
if ( dam == 0 ) { vs = "#nm#0i#ns#0s#n"; vp = "#0m#ni#0s#ns#0e#ns"; }
else if ( dam <= 20 ) { vs = "scratch"; vp = "scratches"; }
else if ( dam <= 40 ) { vs = "graze"; vp = "grazes"; }
else if ( dam <= 60 ) { vs = "graze"; vp = "grazes"; }
else if ( dam <= 80 ) { vs = "injure"; vp = "injures"; }
else if ( dam <= 100 ) { vs = "wound"; vp = "wounds"; }
else if ( dam <= 150 ) { vs = "maul"; vp = "mauls"; }
else if ( dam <= 300 ) { vs = "#RD#rECIMAT#RE#n"; vp = "#RD#rECIMATE#RS#n"; }
else if ( dam <= 500 ) { vs = "#LD#lEVISTAT#LE#n"; vp = "#LD#lEVISTATE#LS#n"; }
else if ( dam <= 600 ) { vs = "#gm#ra#gi#rm#n"; vp = "#gm#ra#gi#rm#gs#n"; }
else if ( dam <= 1000 ) { vs = "#rMU#lTI#rL#lAT#rE#n"; vp = "#rMU#lTI#rL#lAT#rES#n"; }
else if ( dam <= 1500 ) { vs = "#CD#cISEMBOWE#CL#n"; vp = "#CD#cISEMBOWEL#CS#n"; }
else if ( dam <= 2000 ) { vs = "#yD#oISMEMBE#yR#n"; vp = "#yD#oISMEMBER#yS#n"; }
else if ( dam <= 2500 ) { vs = "#RM#rA#RS#rS#RA#rC#RR#rE#n"; vp = "#rM#RA#rS#RS#rA#RC#rR#RE#rS#n"; }
else if ( dam <= 3000 ) { vs = "#gM#oANGL#gE#n"; vp = "#gM#oANGLE#gS#n"; }
else if ( dam <= 3500 ) { vs = "#0* #RD#rEM#0OL#rI#0S#rH #0*#n"; vp = "#0* #RD#rEM#0OL#rI#0SH#rES #0*#n"; }
else if ( dam <= 4000 ) { vs = "#C*#c* #LDE#lVA#0S#lTA#LTE #c*#C*#n"; vp = "#C*#c* #LDE#lVA#0S#lTA#LTE#lS #c*#C*#n"; }
else if ( dam <= 4500 ) { vs = "#R=#r= #yO#oBLI#0TE#oRA#yTE #r=#R=#n"; vp = "#R=#r= #yO#oBLI#0TE#oRA#yTE#oS #r=#R=#n"; }
else if ( dam <= 5000 ) { vs = "#y=#o=#y= #GAT#gO#0M#gIZ#GE #y=#o=#y=#n"; vp = "#y=#o=#y= #GAT#gO#0M#gIZ#GES #y=#o=#y=#n"; }
else if ( dam <= 6000 ) { vs = "#l<#L*#l> #RAN#rNI#0HI#rLA#RTE #l<#L*#l>#n"; vp = "#l<#L*#l> #RAN#rNI#0HI#rLA#RTE#rS #l<#L*#l>#n"; }
else if ( dam <= 7000 ) { vs = "#7<#0*#7*#0> #RE#rR#LA#lD#0I#LC#lA#RT#rE #0<#7*#0*#7>#n"; vp = "#7<#0*#7*#0> #RE#rR#LA#lD#0I#lC#LA#rT#RE#rS #0<#7*#0*#7>#n"; }
else if ( dam <= 8000 ) { vs = "#g<#G*#g!#G*#g> #yE#oL#rE#oC#y#0T#yR#oO#rN#yI#oZ#yE #g<#G*#g!#G*#g>#n"; vp = "#g<#G*#g!#G*#g> #yE#oL#rE#yC#oT#0R#oO#yN#rI#oZ#yE#oS #g<#G*#g!#G*#g>#n"; }
else if ( dam <= 9000 ) { vs = "#G<#r*#G>#r!#G<#r*#G> #7SK#0EL#7ET#0ON#7IZ#0E #G<#r*#G>#r!#G<#r*#G>#n"; vp = "#G<#r*#G>#r!#G<#r*#G> #7SK#0EL#7ET#0ON#7IZ#0ES #G<#r*#G>#r!#G<#r*#G>#n"; }
else if ( dam <= 10000 ) { vs = "#0)#r!#0(#R*#0)#r!#0( #CN#cU#CK#cE #0)#r!#0(#R*#0)#r!#0(#n"; vp = "#0)#r!#0(#R*#0)#r!#0( #CN#cU#CK#cE#CS #0)#r!#0(#R*#0)#r!#0(#n"; }
else if ( dam <= 10500 ) { vs = "#0(#l*#0!#L<#0*#l>#0!#L*#0) #RT#rE#RR#rM#7I#rN#RA#rT#RE #0(#L*#0!#l<#0*#L>#0!#l*#0)#n";vp = "#0(#l*#0!#L<#0*#l>#0!#L*#0) #RT#rE#RR#rM#7I#rN#RA#rT#RE#rS #0(#L*#0!#l<#0*#L>#0!#l*#0)#n";}
else { vs = "#C–==>#r*#C>#r*#C> #gU#rTTERL#gY O#rBLITERAT#gE#C<#r*#C<#r*#C<==–#n";vp = "#C–==>#r*#C>#r*#C> #gU#rTTERL#gY O#rBLITERATE#gS #C<#r*#C<#r*#C<==–#n";}


switch(hit_loc)
{
case 1:
if ( number_range(1,2) == 1 ) obj = get_eq_char(victim,WEAR_FINGER_L);
else obj = get_eq_char(victim,WEAR_FINGER_R);
loc = number_range(1,2) == 1 ? "left hand fingers" : "right hand fingers";
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
break;

case 2:
if ( number_range(1,2) == 1 ) obj = get_eq_char(victim,WEAR_NECK_1);
else obj = get_eq_char(victim,WEAR_NECK_2);
loc = number_range(1,2) == 1 ? "neck" : "throat";
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
break;

case 3:
obj = get_eq_char(victim,WEAR_BODY);
switch(number_range(1,5)){
case 1:
loc = "right shoulder";
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
break;
case 2:
loc = "left shoulder";
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
break;
case 3:
loc = "back";
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
break;
case 4:
loc = "chest";
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
break;
case 5:
loc = "stomach";
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
break;
}
break;

case 4:
obj = get_eq_char(victim,WEAR_HEAD);
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
switch(number_range(1,3)){
case 1:
loc = "head";
break;
case 2:
loc = "left ear";
break;
case 3:
loc = "right ear";
break;
}
break;

case 5:
obj = get_eq_char(victim,WEAR_LEGS);
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
switch(number_range(1,4)){
case 1:
loc = "left calf";
break;
case 2:
loc = "left thigh";
break;
case 3:
loc = "right calf";
break;
case 4:
loc = "right thigh";
break;
}
break;

case 6:
obj = get_eq_char(victim,WEAR_FEET);
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
switch(number_range(1,4)){
case 1:
loc = "left foot";
break;
case 2:
loc = "left ankle";
break;
case 3:
loc = "right foot";
break;
case 4:
loc = "right ankle";
break;
}
break;

case 7:
obj = get_eq_char(victim,WEAR_HANDS);
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
switch(number_range(1,2)){
case 1:
loc = "left hand";
break;
case 2:
loc = "right hand";
break;
}
break;

case 8:
obj = get_eq_char(victim,WEAR_ARMS);
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
switch(number_range(1,4)){
case 1:
loc = "left bicep";
break;
case 2:
loc = "left elbow";
break;
case 3:
loc = "right bicep";
break;
case 4:
loc = "right elbow";
break;
}
break;

case 9:
obj = get_eq_char(victim,WEAR_WAIST);
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
loc = "waist";
break;

case 10:
if ( number_range(1,2) == 1 ){
obj = get_eq_char(victim,WEAR_WRIST_L);
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
loc = number_range(1,2) == 1 ? "left wrist" : "left forearm";
}
else {
obj = get_eq_char(victim,WEAR_WRIST_R);
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
loc = number_range(1,2) == 1 ? "right wrist" : "right forearm";
}
break;

case 11:
obj = get_eq_char(victim,WEAR_FACE);
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
switch(number_range(1,4)){
case 1:
loc = "face";
break;
case 2:
loc = "eyes";
break;
case 3:
loc = "nose";
break;
case 4:
loc = "jaw";
break;
}
break;
}

if (obj) { dam *= 200 - obj->condition; dam /= 100; }
else dam *= 2;

if (!loc) loc = "(no loc)";

// if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;

/* If victim's hp are less/equal to 'damp', attacker gets a death blow */
if (IS_NPC(victim)) damp = 0;
else damp = -10;
if ((victim->hit - dam > damp ) || (dt >= 0 && dt < MAX_SKILL) ||
(IS_NPC(victim) && IS_SET(victim->act, ACT_NOPARTS)))
{
punct = (dam <= 250) ? ' ' : ' ';
if ( dt == TYPE_HIT && !IS_NPC(ch) && !IS_VAMPAFF(ch,VAM_CLAWS) )
{
if (dam == 0)
{
sprintf( buf1, "$n %s $N's %s #g<#G<#7%d#G>#g>#n", vp, loc, dam );
sprintf( buf2, "You %s $N's %s #g<#G<#7%d#G>#g>#n", vs, loc, dam );
sprintf( buf3, "$n %s your %s", vp, loc );
}
else
{
sprintf( buf1, "$n %s $N's %s #g<#G<#7%d#G>#g>#n", vp, loc, dam );
sprintf( buf2, "You %s $N's %s #g<#G<#7%d#G>#g>#n", vs, loc, dam );
sprintf( buf3, "$n %s your %s #g<#G<#7%d#G>#g>#n", vp, loc, dam );
critical = TRUE;
}
}
else if ( dt == TYPE_HIT && !IS_NPC(ch) && IS_SET(ch->newbits, NEW_MONKFLAME))
{
if (dam >= 1)
{
if (!IS_CLASS(ch, CLASS_WEREWOLF) && !IS_CLASS(ch, CLASS_UNDEAD_LYCAN))
{
sprintf( buf1, "$n's flaming hands %s $N's %s #g<#G<#7%d#G>#g>#n", vp, loc, dam );
sprintf( buf2, "Your flaming hands %s $N's %s #g<#G<#7%d#G>#g>#n", vs, loc, dam );
sprintf( buf3, "$n's flaming hands %s your %s #g<#G<#7%d#G>#g>#n", vp, loc, dam );
}
else
{
sprintf( buf1, "$n's flaming claws %s $N's %s #g<#G<#7%d#G>#g>#n", vp, loc, dam );
sprintf( buf2, "Your flaming claws %s $N's %s #g<#G<#7%d#G>#g>#n", vs, loc, dam );
sprintf( buf3, "$n's flaming claws %s your %s #g<#G<#7%d#G>#g>#n", vp, loc, dam );
}
}
else
{
sprintf( buf1, "$n's hit %s $N's %s #g<#G<#7%d#G>#g>#n", vp, loc, dam );
sprintf( buf2, "Your hit %s $N's %s #g<#G<#7%d#G>#g>#n", vs, loc, dam );
sprintf( buf3, "$n's hit %s your %s #g<#G<#7%d#G>#g>#n", vp, loc, dam );
critical = TRUE;
}
}
else
{
if ( dt == TYPE_HIT && !IS_NPC(ch) && (IS_VAMPAFF(ch,VAM_CLAWS)))
{
attack = attack_table[dt - TYPE_HIT + 5];
attack2 = attack_table2[dt - TYPE_HIT + 5];
}
else if ( dt >= 0 && dt < MAX_SKILL )
{
attack = skill_table[dt].noun_damage;
attack2 = skill_table[dt].noun_damage;
}
else if (dt >= TYPE_HIT && dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]))
{
attack = attack_table[dt - TYPE_HIT];
attack2 = attack_table2[dt - TYPE_HIT];
}
else
{
dt = TYPE_HIT;
attack = attack_table[0];
attack2 = attack_table2[0];
}

if (dam == 0)
{
sprintf( buf1, "$n's %s %s $N's %s #g<#G<#7%d#G>#g>#n", attack, vp, loc, dam );
sprintf( buf2, "Your %s %s $N's %s #g<#G<#7%d#G>#g>#n", attack, vp, loc, dam );
sprintf( buf3, "$n's %s %s your %s #g<#G<#7%d#G>#g>#n", attack, vp, loc, dam );
}
else if (IS_SET(ch->newbits, NEW_MONKFLAME) && (dam == 0))
{
sprintf( buf1, "$n's flaming %s %s $N's %s #g<#G<#7%d#G>#g>#n", attack2, vp, loc, dam );
sprintf( buf2, "Your flaming %s %s $N's %s #g<#G<#7%d#G>#g>#n", attack, vp, loc, dam );
sprintf( buf3, "$n's flaming %s %s your %s #g<#G<#7%d#G>#g>#n", attack2, vp, loc, dam );
}
else
{
if ( dt >= 0 && dt < MAX_SKILL )
{
sprintf( buf1, "$n's %s %s $N's %s #g<#G<#7%d#G>#g>#n", attack2, vp, loc, dam );
sprintf( buf2, "Your %s %s $N's %s #g<#G<#7%d#G>#g>#n", attack, vp, loc, dam );
sprintf( buf3, "$n's %s %s your %s #g<#G<#7%d#G>#g>#n", attack2, vp, loc, dam );
}
else if (IS_SET(ch->newbits, NEW_MONKFLAME))
{
sprintf( buf1, "$n's flaming %s %s $N's %s #g<#G<#7%d#G>#g>#n", attack2, vp, loc, dam);
sprintf( buf2, "Your flaming %s %s $N's %s #g<#G<#7%d#G>#g>#n", attack, vp, loc, dam);
sprintf( buf3, "$n's flaming %s %s your %s #g<#G<#7%d#G>#g>#n", attack2, vp, loc, dam);
}
else
{
sprintf( buf1, "$n's %s %s $N's %s #g<#G<#7%d#G>#g>#n", attack, vp, loc, dam );
sprintf( buf2, "Your %s %s $N's %s #g<#G<#7%d#G>#g>#n", attack, vp, loc, dam );
sprintf( buf3, "The $n's %s %s your %s #g<#G<#7%d#G>#g>#n", attack, vp, loc, dam );
critical = TRUE;
}
}
}
/*
* Message to attacker
*/
if (!(IS_SET(ch->act, PLR_BRIEF2) && (dam == 0 || dt == skill_lookup("lightning bolt") ||
dt == skill_lookup("acid blast") || dt == skill_lookup("chill touch") || dt == skill_lookup("fireball"))))
{
if (!(dt == skill_lookup("chaos blast") && !IS_NPC(victim)))
if (!IS_SET(ch->extra, EXTRA_BRIEF5))
{
act(buf2, ch, NULL, victim, TO_CHAR);
}
}

/*
* Message to victim
*/
if (!(IS_SET(victim->act, PLR_BRIEF2) && (dam == 0 || dt == skill_lookup("lightning bolt") ||
dt == skill_lookup("acid blast") || dt == skill_lookup("chill touch") || dt == skill_lookup("fireball"))))
if (!IS_SET(victim->extra, EXTRA_BRIEF5))
{
act(buf3, ch, NULL, victim, TO_VICT);
}
/*
* Message to ROOM -xrak added
*/
/* if (!(IS_SET(victim->act, PLR_BRIEF2) && (dam == 0 || dt ==
skill_lookup("lightning bolt") ||
dt == skill_lookup("acid blast") || dt == skill_lookup("chill touch") || dt == skill_lookup("fireball"))))
if (!IS_SET(victim->extra, EXTRA_BRIEF5))
{
act(buf3, ch, NULL, victim, TO_ROOM);
}
*/
return;
}

if ( dt == TYPE_HIT && !IS_NPC( ch ) && !IS_VAMPAFF(ch,VAM_CLAWS) &&!IS_VAMPAFF(ch,VAM_FANGS))
{
damp=number_range(1,5);
if ( damp == 1 )
{
act("You ram your fingers into $N's eye sockets and rip $S face off.", ch, NULL, victim, TO_CHAR);
act("$n rams $s fingers into $N's eye sockets and rips $S face off.", ch, NULL, victim, TO_NOTVICT);
act("$n rams $s fingers into your eye sockets and rips your face off.", ch, NULL, victim, TO_VICT);
make_part(victim,"face");
}
else if ( damp == 2 )
{
act("You grab $N by the throat and tear $S windpipe out.", ch, NULL, victim, TO_CHAR);
act("$n grabs $N by the throat and tears $S windpipe out.", ch, NULL, victim, TO_NOTVICT);
act("$n grabs you by the throat and tears your windpipe out.", ch, NULL, victim, TO_VICT);
make_part(victim,"windpipe");
}
else if ( damp == 3 )
{
act("You punch your fist through $N's stomach and rip out $S entrails.", ch, NULL, victim, TO_CHAR);
act("$n punches $s fist through $N's stomach and rips out $S entrails.", ch, NULL, victim, TO_NOTVICT);
act("$n punches $s fist through your stomach and rips out your entrails.", ch, NULL, victim, TO_VICT);
make_part(victim,"entrails");
}
else if ( damp == 4 )
{
if (!IS_BODY(victim,BROKEN_SPINE))
SET_BIT(victim->loc_hp[1],BROKEN_SPINE);
act("You hoist $N above your head and slam $M down upon your knee.\n\rThere is a loud cracking sound as $N's spine snaps.", ch, NULL, victim, TO_CHAR);
act("$n hoists $N above $s head and slams $M down upon $s knee.\n\rThere is a loud cracking sound as $N's spine snaps.", ch, NULL, victim, TO_NOTVICT);
act("$n hoists you above $s head and slams you down upon $s knee.\n\rThere is a loud cracking sound as your spine snaps.", ch, NULL, victim, TO_VICT);
}
else if ( damp == 5 )
{
act("You lock your arm around $N's head, and give it a vicious twist.", ch, NULL, victim, TO_CHAR);
act("$n locks $s arm around $N's head, and gives it a vicious twist.", ch, NULL, victim, TO_NOTVICT);
act("$n locks $s arm around your head, and gives it a vicious twist.", ch, NULL, victim, TO_VICT);
if (!IS_BODY(victim,BROKEN_NECK))
{
act("There is a loud snapping noise as your neck breaks.", victim, NULL, NULL, TO_CHAR);
act("There is a loud snapping noise as $n's neck breaks.", victim, NULL, NULL, TO_ROOM);
SET_BIT(victim->loc_hp[1],BROKEN_NECK);
}
}
return;
}
if (dt >= 0 && dt < MAX_SKILL) attack = skill_table[dt].noun_damage;
else if ( dt >= TYPE_HIT && dt < TYPE_HIT + sizeof(attack_table)/sizeof(attack_table[0]))
attack = attack_table[dt - TYPE_HIT];
else
{
dt = TYPE_HIT;
attack = attack_table[0];
}
if ( attack == "slash" || attack == "slice" )
{
damp=number_range(1,8);
if ( damp == 1 )
{
act("You swing your blade in a low arc, rupturing $N's abdominal cavity.\n\r$S entrails spray out over a wide area.", ch, NULL, victim, TO_CHAR);
act("$n swings $s blade in a low arc, rupturing $N's abdominal cavity.\n\r$S entrails spray out over a wide area.", ch, NULL, victim, TO_NOTVICT);
act("$n swings $s blade in a low arc, rupturing your abdominal cavity.\n\rYour entrails spray out over a wide area.", ch, NULL, victim, TO_VICT);
make_part(victim,"entrails");
}
else if ( damp == 2 )
{
act("You thrust your blade into $N's mouth and twist it viciously.\n\rThe end of your blade bursts through the back of $S head.", ch, NULL, victim, TO_CHAR);
act("$n thrusts $s blade into $N's mouth and twists it viciously.\n\rThe end of the blade bursts through the back of $N's head.", ch, NULL, victim, TO_NOTVICT);
act("$n thrusts $s blade into your mouth and twists it viciously.\n\rYou feel the end of the blade burst through the back of your head.", ch, NULL, victim, TO_VICT);
}
else if ( damp == 3 )
{
if (!IS_BODY(victim,CUT_THROAT)) SET_BIT(victim->loc_hp[1],CUT_THROAT);
if (!IS_BLEEDING(victim,BLEEDING_THROAT)) SET_BIT(victim->loc_hp[6],BLEEDING_THROAT);
act("Your blow slices open $N's carotid artery, spraying blood everywhere.", ch, NULL, victim, TO_CHAR);
act("$n's blow slices open $N's carotid artery, spraying blood everywhere.", ch, NULL, victim, TO_NOTVICT);
act("$n's blow slices open your carotid artery, spraying blood everywhere.", ch, NULL, victim, TO_VICT);
make_part(victim,"blood");
}
else if ( damp == 4 )
{
if (!IS_BODY(victim,CUT_THROAT)) SET_BIT(victim->loc_hp[1],CUT_THROAT);
if (!IS_BLEEDING(victim,BLEEDING_THROAT)) SET_BIT(victim->loc_hp[6],BLEEDING_THROAT);
act("You swing your blade across $N's throat, showering the area with blood.", ch, NULL, victim, TO_CHAR);
act("$n swings $s blade across $N's throat, showering the area with blood.", ch, NULL, victim, TO_NOTVICT);
act("$n swings $s blade across your throat, showering the area with blood.", ch, NULL, victim, TO_VICT);
make_part(victim,"blood");
}
else if ( damp == 5 )
{
if (!IS_HEAD(victim,BROKEN_SKULL))
{
act("You swing your blade down upon $N's head, splitting it open.\n\r$N's brains pour out of $S forehead.", ch, NULL, victim, TO_CHAR);
act("$n swings $s blade down upon $N's head, splitting it open.\n\r$N's brains pour out of $S forehead.", ch, NULL, victim, TO_NOTVICT);
act("$n swings $s blade down upon your head, splitting it open.\n\rYour brains pour out of your forehead.", ch, NULL, victim, TO_VICT);
make_part(victim,"brain");
SET_BIT(victim->loc_hp[0],BROKEN_SKULL);
}
else
{
act("You plunge your blade deep into $N's chest.", ch, NULL, victim, TO_CHAR);
act("$n plunges $s blade deep into $N's chest.", ch, NULL, victim, TO_NOTVICT);
act("$n plunges $s blade deep into your chest.", ch, NULL, victim, TO_VICT);
}
}
else if ( damp == 6 )
{
act("You swing your blade between $N's legs, nearly splitting $M in half.", ch, NULL, victim, TO_CHAR);
act("$n swings $s blade between $N's legs, nearly splitting $M in half.", ch, NULL, victim, TO_NOTVICT);
act("$n swings $s blade between your legs, nearly splitting you in half.", ch, NULL, victim, TO_VICT);
}
else if ( damp == 7 )
{
if (!IS_ARM_L(victim,LOST_ARM))
{
act("You swing your blade in a wide arc, slicing off $N's arm.", ch, NULL, victim, TO_CHAR);
act("$n swings $s blade in a wide arc, slicing off $N's arm.", ch, NULL, victim, TO_NOTVICT);
act("$n swings $s blade in a wide arc, slicing off your arm.", ch, NULL, victim, TO_VICT);
make_part(victim,"arm");
SET_BIT(victim->loc_hp[2],LOST_ARM);
if (!IS_BLEEDING(victim,BLEEDING_ARM_L)) SET_BIT(victim->loc_hp[6],BLEEDING_ARM_L);
if (IS_BLEEDING(victim,BLEEDING_HAND_L)) REMOVE_BIT(victim->loc_hp[6],BLEEDING_HAND_L);
}
else if (!IS_ARM_R(victim,LOST_ARM))
{
act("You swing your blade in a wide arc, slicing off $N's arm.", ch, NULL, victim, TO_CHAR);
act("$n swings $s blade in a wide arc, slicing off $N's arm.", ch, NULL, victim, TO_NOTVICT);
act("$n swings $s blade in a wide arc, slicing off your arm.", ch, NULL, victim, TO_VICT);
make_part(victim,"arm");
SET_BIT(victim->loc_hp[3],LOST_ARM);
if (!IS_BLEEDING(victim,BLEEDING_ARM_R)) SET_BIT(victim->loc_hp[6],BLEEDING_ARM_R);
if (IS_BLEEDING(victim,BLEEDING_HAND_R)) REMOVE_BIT(victim->loc_hp[6],BLEEDING_HAND_R);
}
else
{
act("You plunge your blade deep into $N's chest.", ch, NULL, victim, TO_CHAR);
act("$n plunges $s blade deep into $N's chest.", ch, NULL, victim, TO_NOTVICT);
act("$n plunges $s blade deep into your chest.", ch, NULL, victim, TO_VICT);
}
}
else if ( damp == 8 )
{
if (!IS_LEG_L(victim,LOST_LEG))
{
act("You swing your blade in a low arc, slicing off $N's leg at the hip.", ch, NULL, victim, TO_CHAR);
act("$n swings $s blade in a low arc, slicing off $N's leg at the hip.", ch, NULL, victim, TO_NOTVICT);
act("$n swings $s blade in a wide arc, slicing off your leg at the hip.", ch, NULL, victim, TO_VICT);
make_part(victim,"leg");
SET_BIT(victim->loc_hp[4],LOST_LEG);
if (!IS_BLEEDING(victim,BLEEDING_LEG_L)) SET_BIT(victim->loc_hp[6],BLEEDING_LEG_L);
if (IS_BLEEDING(victim,BLEEDING_FOOT_L)) REMOVE_BIT(victim->loc_hp[6],BLEEDING_FOOT_L);
}
else if (!IS_LEG_R(victim,LOST_LEG))
{
act("You swing your blade in a low arc, slicing off $N's leg at the hip.", ch, NULL, victim, TO_CHAR);
act("$n swings $s blade in a low arc, slicing off $N's leg at the hip.", ch, NULL, victim, TO_NOTVICT);
act("$n swings $s blade in a wide arc, slicing off your leg at the hip.", ch, NULL, victim, TO_VICT);
make_part(victim,"leg");
SET_BIT(victim->loc_hp[5],LOST_LEG);
if (!IS_BLEEDING(victim,BLEEDING_LEG_R)) SET_BIT(victim->loc_hp[6],BLEEDING_LEG_R);
if (IS_BLEEDING(victim,BLEEDING_FOOT_R)) REMOVE_BIT(victim->loc_hp[6],BLEEDING_FOOT_R);
}
else
{
act("You plunge your blade deep into $N's chest.", ch, NULL, victim, TO_CHAR);
act("$n plunges $s blade deep into $N's chest.", ch, NULL, victim, TO_NOTVICT);
act("$n plunges $s blade deep into your chest.", ch, NULL, victim, TO_VICT);
}
}
}
else if ( attack == "stab" || attack == "pierce" )
{
damp=number_range(1,5);
if ( damp == 1 )
{
act("You defty invert your weapon and plunge it point first into $N's chest.\n\rA shower of blood sprays from the wound, showering the area.", ch, NULL, victim, TO_CHAR);
act("$n defty inverts $s weapon and plunge it point first into $N's chest.\n\rA shower of blood sprays from the wound, showering the area.", ch, NULL, victim, TO_NOTVICT);
act("$n defty inverts $s weapon and plunge it point first into your chest.\n\rA shower of blood sprays from the wound, showering the area.", ch, NULL, victim, TO_VICT);
make_part(victim,"blood");
}
else if ( damp == 2 )
{
act("You thrust your blade into $N's mouth and twist it viciously.\n\rThe end of your blade bursts through the back of $S head.", ch, NULL, victim, TO_CHAR);
act("$n thrusts $s blade into $N's mouth and twists it viciously.\n\rThe end of the blade bursts through the back of $N's head.", ch, NULL, victim, TO_NOTVICT);
act("$n thrusts $s blade into your mouth and twists it viciously.\n\rYou feel the end of the blade burst through the back of your head.", ch, NULL, victim, TO_VICT);
}
else if ( damp == 3 )
{
act("You thrust your weapon up under $N's jaw and through $S head.", ch, NULL, victim, TO_CHAR);
act("$n thrusts $s weapon up under $N's jaw and through $S head.", ch, NULL, victim, TO_NOTVICT);
act("$n thrusts $s weapon up under your jaw and through your head.", ch, NULL, victim, TO_VICT);
}
else if ( damp == 4 )
{
act("You ram your weapon through $N's body, pinning $M to the ground.", ch, NULL, victim, TO_CHAR);
act("$n rams $s weapon through $N's body, pinning $M to the ground.", ch, NULL, victim, TO_NOTVICT);
act("$n rams $s weapon through your body, pinning you to the ground.", ch, NULL, victim, TO_VICT);
}
else if ( damp == 5 )
{
act("You stab your weapon into $N's eye and out the back of $S head.", ch, NULL, victim, TO_CHAR);
act("$n stabs $s weapon into $N's eye and out the back of $S head.", ch, NULL, victim, TO_NOTVICT);
act("$n stabs $s weapon into your eye and out the back of your head.", ch, NULL, victim, TO_VICT);
if (!IS_HEAD(victim,LOST_EYE_L) && number_percent() < 50) SET_BIT(victim->loc_hp[0],LOST_EYE_L);
else if (!IS_HEAD(victim,LOST_EYE_R)) SET_BIT(victim->loc_hp[0],LOST_EYE_R);
else if (!IS_HEAD(victim,LOST_EYE_L)) SET_BIT(victim->loc_hp[0],LOST_EYE_L);
}
}
else if ( attack == "blast" || attack == "pound" || attack == "crush" )
{
damp=number_range(1,3);
bodyloc = 0;
if ( damp == 1)
{
act("Your blow smashes through $N's chest, caving in half $S ribcage.", ch, NULL, victim, TO_CHAR);
act("$n's blow smashes through $N's chest, caving in half $S ribcage.", ch, NULL, victim, TO_NOTVICT);
act("$n's blow smashes through your chest, caving in half your ribcage.", ch, NULL, victim, TO_VICT);
if (IS_BODY(victim,BROKEN_RIBS_1 )) {bodyloc += 1; REMOVE_BIT(victim->loc_hp[1],BROKEN_RIBS_1);}
if (IS_BODY(victim,BROKEN_RIBS_2 )) {bodyloc += 2; REMOVE_BIT(victim->loc_hp[1],BROKEN_RIBS_2);}
if (IS_BODY(victim,BROKEN_RIBS_4 )) {bodyloc += 4; REMOVE_BIT(victim->loc_hp[1],BROKEN_RIBS_4);}
if (IS_BODY(victim,BROKEN_RIBS_8 )) {bodyloc += 8; REMOVE_BIT(victim->loc_hp[1],BROKEN_RIBS_8);}
if (IS_BODY(victim,BROKEN_RIBS_16)) {bodyloc += 16; REMOVE_BIT(victim->loc_hp[1],BROKEN_RIBS_16);}
bodyloc += number_range(1,3);
if (bodyloc > 24) bodyloc = 24;
if (bodyloc >= 16) {bodyloc -= 16; SET_BIT(victim->loc_hp[1],BROKEN_RIBS_16);}
if (bodyloc >= 8) {bodyloc -= 8; SET_BIT(victim->loc_hp[1],BROKEN_RIBS_8);}
if (bodyloc >= 4) {bodyloc -= 4; SET_BIT(victim->loc_hp[1],BROKEN_RIBS_4);}
if (bodyloc >= 2) {bodyloc -= 2; SET_BIT(victim->loc_hp[1],BROKEN_RIBS_2);}
if (bodyloc >= 1) {bodyloc -= 1; SET_BIT(victim->loc_hp[1],BROKEN_RIBS_1);}
}
else if ( damp == 2)
{
act("Your blow smashes $N's spine, shattering it in several places.", ch, NULL, victim, TO_CHAR);
act("$n's blow smashes $N's spine, shattering it in several places.", ch, NULL, victim, TO_NOTVICT);
act("$n's blow smashes your spine, shattering it in several places.", ch, NULL, victim, TO_VICT);
if (!IS_BODY(victim,BROKEN_SPINE)) SET_BIT(victim->loc_hp[1],BROKEN_SPINE);
}
else if ( damp == 3)
{
if (!IS_HEAD(victim,BROKEN_SKULL))
{
act("You swing your weapon down upon $N's head.\n\r$N's head cracks open like an overripe melon, leaking out brains.", ch, NULL, victim, TO_CHAR);
act("$n swings $s weapon down upon $N's head.\n\r$N's head cracks open like an overripe melon, covering you with brains.", ch, NULL, victim, TO_NOTVICT);
act("$n swings $s weapon down upon your head.\n\rYour head cracks open like an overripe melon, spilling your brains everywhere.", ch, NULL, victim, TO_VICT);
make_part(victim,"brain");
SET_BIT(victim->loc_hp[0],BROKEN_SKULL);
}
else
{
act("You hammer your weapon into $N's side, crushing bone.", ch, NULL, victim, TO_CHAR);
act("$n hammers $s weapon into $N's side, crushing bone.", ch, NULL, victim, TO_NOTVICT);
act("$n hammers $s weapon into your side, crushing bone.", ch, NULL, victim, TO_VICT);
}
}
}
else if ( !IS_NPC( ch ) && (attack == "bite" ||IS_VAMPAFF(ch,VAM_FANGS)))
{
act("You sink your teeth into $N's throat and tear out $S jugular vein.\n\rYou wipe the blood from your chin with one hand.", ch, NULL, victim, TO_CHAR);
act("$n sink $s teeth into $N's throat and tears out $S jugular vein.\n\r$n wipes the blood from $s chin with one hand.", ch, NULL, victim, TO_NOTVICT);
act("$n sink $s teeth into your throat and tears out your jugular vein.\n\r$n wipes the blood from $s chin with one hand.", ch, NULL, victim, TO_VICT);
make_part(victim,"blood");
if (!IS_BODY(victim,CUT_THROAT)) SET_BIT(victim->loc_hp[1],CUT_THROAT);
if (!IS_BLEEDING(victim,BLEEDING_THROAT)) SET_BIT(victim->loc_hp[6],BLEEDING_THROAT);
}
else if ( !IS_NPC(ch) && (attack == "claw" || IS_VAMPAFF(ch,VAM_CLAWS)))
{
damp=number_range(1,2);
if ( damp == 1 )
{
act("You tear out $N's throat, showering the area with blood.", ch, NULL, victim, TO_CHAR);
act("$n tears out $N's throat, showering the area with blood.", ch, NULL, victim, TO_NOTVICT);
act("$n tears out your throat, showering the area with blood.", ch, NULL, victim, TO_VICT);
make_part(victim,"blood");
if (!IS_BODY(victim,CUT_THROAT)) SET_BIT(victim->loc_hp[1],CUT_THROAT);
if (!IS_BLEEDING(victim,BLEEDING_THROAT)) SET_BIT(victim->loc_hp[6],BLEEDING_THROAT);
}
if ( damp == 2 )
{
if (!IS_HEAD(victim,LOST_EYE_L) && number_percent() < 50)
{
act("You rip an eyeball from $N's face.", ch, NULL, victim, TO_CHAR);
act("$n rips an eyeball from $N's face.", ch, NULL, victim, TO_NOTVICT);
act("$n rips an eyeball from your face.", ch, NULL, victim, TO_VICT);
make_part(victim,"eyeball");
SET_BIT(victim->loc_hp[0],LOST_EYE_L);
}
else if (!IS_HEAD(victim,LOST_EYE_R))
{
act("You rip an eyeball from $N's face.", ch, NULL, victim, TO_CHAR);
act("$n rips an eyeball from $N's face.", ch, NULL, victim, TO_NOTVICT);
act("$n rips an eyeball from your face.", ch, NULL, victim, TO_VICT);
make_part(victim,"eyeball");
SET_BIT(victim->loc_hp[0],LOST_EYE_R);
}
else if (!IS_HEAD(victim,LOST_EYE_L))
{
act("You rip an eyeball from $N's face.", ch, NULL, victim, TO_CHAR);
act("$n rips an eyeball from $N's face.", ch, NULL, victim, TO_NOTVICT);
act("$n rips an eyeball from your face.", ch, NULL, victim, TO_VICT);
make_part(victim,"eyeball");
SET_BIT(victim->loc_hp[0],LOST_EYE_L);
}
else
{
act("You claw open $N's chest.", ch, NULL, victim, TO_CHAR);
act("$n claws open $N's chest.", ch, NULL, victim, TO_NOTVICT);
act("$n claws open $N's chest.", ch, NULL, victim, TO_VICT);
}
}
}
else if ( attack == "whip" )
{
act("You entangle $N around the neck, and squeeze out $S life.", ch, NULL, victim, TO_CHAR);
act("$n entangles $N around the neck, and squeezes out $S life.", ch, NULL, victim, TO_NOTVICT);
act("$n entangles you around the neck, and squeezes the life out of you.", ch, NULL, victim, TO_VICT);
if (!IS_BODY(victim,BROKEN_NECK)) SET_BIT(victim->loc_hp[1],BROKEN_NECK);
}
else if ( attack == "suck" || attack == "grep" )
{
act("You place your weapon on $N's head and suck out $S brains.", ch, NULL, victim, TO_CHAR);
act("$n places $s weapon on $N's head and suck out $S brains.", ch, NULL, victim, TO_NOTVICT);
act("$n places $s weapon on your head and suck out your brains.", ch, NULL, victim, TO_VICT);
}
else
{
/*bug( "Dam_message: bad dt %d.", dt );*/
}
return;
}
23 Sep, 2010, David Haley wrote in the 2nd comment:
Votes: 0
All of your cases assume that the target is actually wearing something on those locations. For example…

case 1:
if ( number_range(1,2) == 1 ) obj = get_eq_char(victim,WEAR_FINGER_L);
else obj = get_eq_char(victim,WEAR_FINGER_R);
loc = number_range(1,2) == 1 ? "left hand fingers" : "right hand fingers";
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
break;

What if WEAR_FINGER_L is chosen, but there's nothing worn there? Same for WEAR_FINGER_R.

Also, your 'loc' string code is wrong – there's no guarantee that the random number generator will give you the same random number. You should set it inside the random number check.
24 Sep, 2010, Xrakisis wrote in the 3rd comment:
Votes: 0
yay!!

i changed….
if (IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;
to…..
if (obj != NULL && IS_SET(obj->spectype2, XITEM_LIGHTPLATE)) dam *= 0.5;

and its not crashing anymore..
0.0/3