version 1.61 | | version 1.62 |
---|
| | |
/* | | /* |
* static char *rcsid_attack_c = | | * static char *rcsid_attack_c = |
* "$Id: attack.c,v 1.61 2001/12/16 07:13:16 darth_bob Exp $"; | | * "$Id: attack.c,v 1.62 2001/12/16 09:06:15 darth_bob Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
if (attacknum == ATNR_INTERNAL) return dam; | | if (attacknum == ATNR_INTERNAL) return dam; |
| | |
if (hitter->slaying) { | | if (hitter->slaying) { |
if( | | if(((op->race != NULL) && strstr(hitter->slaying, op->race)) || |
((op->race != NULL) && | | (op->arch && (op->arch->name != NULL) && |
strstr(hitter->slaying, op->race) | | |
) || | | |
(op->arch && | | |
(op->arch->name != NULL) && | | |
strstr(op->arch->name, hitter->slaying)) | | strstr(op->arch->name, hitter->slaying)) |
) { | | ) { |
doesnt_slay = 0; | | doesnt_slay = 0; |
| | |
/* basically: dam = dam*(100-op->resist[attacknum])/100; | | /* basically: dam = dam*(100-op->resist[attacknum])/100; |
* in case 0>dam>1, we try to "simulate" a float value-effect */ | | * in case 0>dam>1, we try to "simulate" a float value-effect */ |
dam *= (100-op->resist[attacknum]); | | dam *= (100-op->resist[attacknum]); |
if (dam >= 100) | | if (dam >= 100) dam /= 100; |
dam /= 100; | | |
else | | else |
dam = (dam > (random_roll(0, 99, op, PREFER_LOW))) ? 1 : 0; | | dam = (dam > (random_roll(0, 99, op, PREFER_LOW))) ? 1 : 0; |
/* why not simulate for all values? | | |
* dam = (dam / 100) + (((dam % 100) > (random_roll(0, 99, op, PREFER_LOW))) ? 1 : 0) | | |
*/ | | |
} | | } |
| | |
/* Special hack. By default, if immune to something, you | | /* Special hack. By default, if immune to something, you |
| | |
* special processing is needed */ | | * special processing is needed */ |
| | |
if ((op->resist[attacknum] >= 100) && | | if ((op->resist[attacknum] >= 100) && |
doesnt_slay && | | doesnt_slay && (attacknum != ATNR_ACID)) |
(attacknum != ATNR_ACID)) | | |
return 0; | | return 0; |
| | |
/* Keep this in order - makes things easier to find */ | | /* Keep this in order - makes things easier to find */ |
| | |
((random_roll(1, 20, op, PREFER_LOW) + | | ((random_roll(1, 20, op, PREFER_LOW) + |
op->resist[attacknum]/10) < savethrow[level_diff])) { | | op->resist[attacknum]/10) < savethrow[level_diff])) { |
| | |
switch(attacknum) { | | |
/* Player has been hit by something */ | | /* Player has been hit by something */ |
case ATNR_CONFUSION: | | if (attacknum == ATNR_CONFUSION) confuse_player(op,hitter,dam); |
confuse_player(op,hitter,dam); | | else if (attacknum == ATNR_POISON) poison_player(op,hitter,dam); |
break; | | else if (attacknum == ATNR_SLOW) slow_player(op,hitter,dam); |
case ATNR_POISON: | | else if (attacknum == ATNR_PARALYZE) paralyze_player(op,hitter,dam); |
poison_player(op,hitter,dam); | | else if (attacknum == ATNR_FEAR) SET_FLAG(op, FLAG_SCARED); |
break; | | else if (attacknum == ATNR_CANCELLATION) cancellation(op); |
case ATNR_SLOW: | | else if (attacknum == ATNR_DEPLETE) drain_stat(op); |
slow_player(op,hitter,dam); | | else if (attacknum == ATNR_BLIND && !QUERY_FLAG(op,FLAG_UNDEAD) && |
break; | | !QUERY_FLAG(op,FLAG_GENERATOR)) blind_player(op,hitter,dam); |
case ATNR_PARALYZE: | | |
paralyze_player(op,hitter,dam); | | |
break; | | |
case ATNR_FEAR: | | |
SET_FLAG(op, FLAG_SCARED); | | |
break; | | |
case ATNR_CANCELLATION: | | |
cancellation(op); | | |
break; | | |
case ATNR_DEPLETE: | | |
drain_stat(op); | | |
break; | | |
case ATNR_BLIND: | | |
if(!QUERY_FLAG(op,FLAG_UNDEAD) && | | |
!QUERY_FLAG(op,FLAG_GENERATOR)) | | |
blind_player(op,hitter,dam); | | |
break; | | |
} | | |
} | | } |
dam = 0; /* These are all effects and don't do real damage */ | | dam = 0; /* These are all effects and don't do real damage */ |
} break; | | } break; |
| | |
{ | | { |
object *tmp; | | object *tmp; |
for(tmp=op->inv; tmp!=NULL; tmp=tmp->below) { | | for(tmp=op->inv; tmp!=NULL; tmp=tmp->below) { |
| | |
if(!QUERY_FLAG(tmp, FLAG_APPLIED) || | | if(!QUERY_FLAG(tmp, FLAG_APPLIED) || |
(tmp->resist[ATNR_ACID] >= 10)) | | (tmp->resist[ATNR_ACID] >= 10)) |
/* >= 10% acid res. on itmes will protect these */ | | /* >= 10% acid res. on itmes will protect these */ |
continue; | | continue; |
| | |
if(!(tmp->material & M_IRON)) | | if(!(tmp->material & M_IRON)) |
continue; | | continue; |
if(tmp->magic < -4) /* Let's stop at -5 */ | | if(tmp->magic < -4) /* Let's stop at -5 */ |
continue; | | continue; |
| | |
if(tmp->type==RING || | | if(tmp->type==RING || |
/* removed boots and gloves from exclusion list in | | /* removed boots and gloves from exclusion list in |
PR */ | | PR */ |
| | |
new_draw_info_format(NDI_UNIQUE|NDI_RED,0, op, | | new_draw_info_format(NDI_UNIQUE|NDI_RED,0, op, |
"The %s's acid corrodes your %s!", | | "The %s's acid corrodes your %s!", |
query_name(hitter), query_name(tmp)); | | query_name(hitter), query_name(tmp)); |
} | | |
flag = 1; | | flag = 1; |
tmp->magic--; | | tmp->magic--; |
if(op->type == PLAYER) | | if(op->type == PLAYER) |
| | |
| | |
/* if undead are not an enemy of your god, you turn them | | /* if undead are not an enemy of your god, you turn them |
* at half strength */ | | * at half strength */ |
if ( ! god || ! god->slaying | | if (! god || ! god->slaying || |
|| strstr (god->slaying, undead_name) == NULL) | | strstr (god->slaying, undead_name) == NULL) |
div = 2; | | div = 2; |
/* Give a bonus if you resist turn undead */ | | /* Give a bonus if you resist turn undead */ |
if (op->level * div < | | if (op->level * div < |
| | |
undead? */ | | undead? */ |
} break; | | } break; |
case ATNR_DEATH: | | case ATNR_DEATH: |
{ | | |
deathstrike_player(op, hitter, &dam); | | deathstrike_player(op, hitter, &dam); |
} break; | | break; |
case ATNR_CHAOS: | | case ATNR_CHAOS: |
{ | | |
LOG(llevError, | | LOG(llevError, |
"%s was hit by %s with non-specific chaos.\n", | | "%s was hit by %s with non-specific chaos.\n", |
query_name(op), | | query_name(op), |
query_name(hitter)); | | query_name(hitter)); |
dam = 0; | | dam = 0; |
} break; | | break; |
case ATNR_COUNTERSPELL: | | case ATNR_COUNTERSPELL: |
{ | | |
LOG(llevError, | | LOG(llevError, |
"%s was hit by %s with counterspell attack.\n", | | "%s was hit by %s with counterspell attack.\n", |
query_name(op), | | query_name(op), |
| | |
* seperately and filtered out. If this does happen, | | * seperately and filtered out. If this does happen, |
* Counterspell has no effect on anything but spells, so it | | * Counterspell has no effect on anything but spells, so it |
* does no damage. */ | | * does no damage. */ |
} break; | | break; |
case ATNR_HOLYWORD: | | case ATNR_HOLYWORD: |
{ | | { |
/* Holyword only affects a limited range of creatures */ | | /* This has already been handled by hit_player, |
/* Affects enemies of your god (*3 for slaying applied above) * | | * no need to check twice -- DAMN */ |
* Affects undead even if not enemies, unless they are friends * | | |
* -- DAMN */ | | |
/* if ((op->race != NULL && hitter->slaying != NULL && strstr(hitter->slaying,op->race) != NULL) || | | |
* (QUERY_FLAG(op,FLAG_UNDEAD) && | | |
* (hitter->title == NULL || | | |
* (strstr(find_god(determine_god(hitter))->race,undead_name)==NULL)))) { | | |
* This has already been handled by hit_player, no need to check * | | |
* twice -- DAMN */ | | |
object *owner = get_owner(hitter)==NULL?hitter:get_owner(hitter); | | object *owner = get_owner(hitter)==NULL?hitter:get_owner(hitter); |
| | |
/* As with turn undead above, give a bonus on the saving throw */ | | /* As with turn undead above, give a bonus on the saving throw */ |
if((op->level+(op->resist[ATNR_HOLYWORD]/100)) < owner->level+turn_bonus[owner->stats.Wis]) | | if((op->level+(op->resist[ATNR_HOLYWORD]/100)) < |
| | owner->level+turn_bonus[owner->stats.Wis]) |
SET_FLAG(op, FLAG_SCARED); | | SET_FLAG(op, FLAG_SCARED); |
} break; | | } break; |
} | | } |
return dam; | | return dam; |
} | | } |
| | } |
| | |
/* GROS: This code comes from hit_player. It has been made external to | | /* GROS: This code comes from hit_player. It has been made external to |
* allow script procedures to "kill" objects in a combat-like fashion. | | * allow script procedures to "kill" objects in a combat-like fashion. |