version 1.30 | | version 1.31 |
---|
| | |
/* | | /* |
* static char *rcsid_attack_c = | | * static char *rcsid_attack_c = |
* "$Id: attack.c,v 1.30 2001/01/19 05:43:31 cvs Exp $"; | | * "$Id: attack.c,v 1.31 2001/02/06 05:56:28 cvs Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
{ | | { |
object *tmp,*owner; | | object *tmp,*owner; |
| | |
/* This shouldn't happen, but will prevent divide by zero errors below if it does. */ | | /* Save some work if we know it isn't going to affect the player */ |
if (op->resist[ATNR_BLIND]==100) return; | | if (op->resist[ATNR_BLIND]==100) return; |
| | |
tmp = present_in_ob(BLINDNESS,op); | | tmp = present_in_ob(BLINDNESS,op); |
| | |
/* use floats so we don't lose too much precision due to rounding errors. | | /* use floats so we don't lose too much precision due to rounding errors. |
* speed is a float anyways. | | * speed is a float anyways. |
*/ | | */ |
tmp->speed = 100.0 * tmp->speed / (100.0 - (float)op->resist[ATNR_BLIND]); | | tmp->speed = tmp->speed * (100.0 - (float)op->resist[ATNR_BLIND]) / 100; |
| | |
tmp = insert_ob_in_ob(tmp,op); | | tmp = insert_ob_in_ob(tmp,op); |
change_abil(op,tmp); /* Mostly to display any messages */ | | change_abil(op,tmp); /* Mostly to display any messages */ |
| | |
float effect,max; | | float effect,max; |
object *tmp; | | object *tmp; |
| | |
/* Same note as blindness above */ | | |
if (op->resist[ATNR_PARALYZE]==100) return; | | |
| | |
if((tmp=present(PARAIMAGE,op->map,op->x,op->y))==NULL) { | | if((tmp=present(PARAIMAGE,op->map,op->x,op->y))==NULL) { |
tmp=clone_arch(PARAIMAGE); | | tmp=clone_arch(PARAIMAGE); |
| | |
insert_ob_in_map_simple(tmp,op->map); | | insert_ob_in_map_simple(tmp,op->map); |
} | | } |
/* Do this as a float - otherwise, rounding might very well reduce this to 0 */ | | /* Do this as a float - otherwise, rounding might very well reduce this to 0 */ |
effect = (float)dam * 3.0 / (100.0 - (float) op->resist[ATNR_PARALYZE]); | | effect = (float)dam * 3.0 * (100.0 - op->resist[ATNR_PARALYZE]) / 100; |
| | |
| | if (effect==0) return; |
| | |
op->speed_left-=FABS(op->speed)*effect; | | op->speed_left-=FABS(op->speed)*effect; |
tmp->stats.food+=(signed short) effect/op->speed; | | tmp->stats.food+=(signed short) effect/op->speed; |