version 1.60 | | version 1.61 |
---|
| | |
/* | | /* |
* static char *rcsid_attack_c = | | * static char *rcsid_attack_c = |
* "$Id: attack.c,v 1.60 2001/12/14 10:31:34 darth_bob Exp $"; | | * "$Id: attack.c,v 1.61 2001/12/16 07:13:16 darth_bob Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
} | | } |
| | |
/* Adjust the damage for resistance. Note that neg. values increase damage. */ | | /* Adjust the damage for resistance. Note that neg. values increase damage. */ |
if(1) { // if (op->resist[attacknum] || 1) { // This is a nop! | | if (op->resist[attacknum]) { |
/* 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]); |
| | |
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? | | /* why not simulate for all values? |
// dam = (dam / 100) + (((dam % 100) > (random_roll(0, 99, op, PREFER_LOW))) ? 1 : 0) | | * 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 |
| | |
if ((op->resist[attacknum] >= 100) && | | if ((op->resist[attacknum] >= 100) && |
doesnt_slay && | | doesnt_slay && |
(attacknum != ATNR_ACID)) | | (attacknum != ATNR_ACID)) |
return 0; // why do we carefully propagate dam everywhere else? | | return 0; |
| | |
/* Keep this in order - makes things easier to find */ | | /* Keep this in order - makes things easier to find */ |
| | |
| | |
case ATNR_PARALYZE: | | case ATNR_PARALYZE: |
case ATNR_FEAR: | | case ATNR_FEAR: |
case ATNR_CANCELLATION: | | case ATNR_CANCELLATION: |
case AT_DEPLETE: | | case ATNR_DEPLETE: |
case AT_BLIND: { | | case ATNR_BLIND: { |
/* chance for inflicting a special attack depends on the | | /* chance for inflicting a special attack depends on the |
difference between attacker's and defender's level */ | | difference between attacker's and defender's level */ |
int level_diff = MIN(110, MAX(0, op->level - hitter->level)); | | int level_diff = MIN(110, MAX(0, op->level - hitter->level)); |
| | |
| | |
switch(attacknum) { | | switch(attacknum) { |
/* Player has been hit by something */ | | /* Player has been hit by something */ |
case AT_CONFUSION: | | case ATNR_CONFUSION: |
confuse_player(op,hitter,dam); | | confuse_player(op,hitter,dam); |
break; | | break; |
case AT_POISON: | | case ATNR_POISON: |
poison_player(op,hitter,dam); | | poison_player(op,hitter,dam); |
break; | | break; |
case AT_SLOW: | | case ATNR_SLOW: |
slow_player(op,hitter,dam); | | slow_player(op,hitter,dam); |
break; | | break; |
case AT_PARALYZE: | | case ATNR_PARALYZE: |
paralyze_player(op,hitter,dam); | | paralyze_player(op,hitter,dam); |
break; | | break; |
case AT_FEAR: | | case ATNR_FEAR: |
SET_FLAG(op, FLAG_SCARED); | | SET_FLAG(op, FLAG_SCARED); |
break; | | break; |
case AT_CANCELLATION: | | case ATNR_CANCELLATION: |
cancellation(op); | | cancellation(op); |
break; | | break; |
case AT_DEPLETE: | | case ATNR_DEPLETE: |
drain_stat(op); | | drain_stat(op); |
break; | | break; |
case AT_BLIND: | | case ATNR_BLIND: |
if(!QUERY_FLAG(op,FLAG_UNDEAD) && | | if(!QUERY_FLAG(op,FLAG_UNDEAD) && |
!QUERY_FLAG(op,FLAG_GENERATOR)) | | !QUERY_FLAG(op,FLAG_GENERATOR)) |
blind_player(op,hitter,dam); | | blind_player(op,hitter,dam); |