version 1.28 | | version 1.29 |
---|
| | |
/* | | /* |
* static char *rcsid_attack_c = | | * static char *rcsid_attack_c = |
* "$Id: attack.c,v 1.28 2001/01/08 20:39:59 avogl Exp $"; | | * "$Id: attack.c,v 1.29 2001/01/15 23:49:21 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. */ |
| | if (op->resist[ATNR_BLIND]==100) return; |
| | |
tmp = present_in_ob(BLINDNESS,op); | | tmp = present_in_ob(BLINDNESS,op); |
if(!tmp) { | | if(!tmp) { |
tmp = get_archetype("blindness"); | | tmp = get_archetype("blindness"); |
SET_FLAG(tmp, FLAG_BLIND); | | SET_FLAG(tmp, FLAG_BLIND); |
SET_FLAG(tmp, FLAG_APPLIED); | | SET_FLAG(tmp, FLAG_APPLIED); |
| | /* use floats so we don't lose too much precision due to rounding errors. |
| | * speed is a float anyways. |
| | */ |
| | tmp->speed = 100.0 * tmp->speed / (100.0 - (float)op->resist[ATNR_BLIND]); |
| | |
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 */ |
fix_player(op); /* This takes care of some other stuff */ | | fix_player(op); /* This takes care of some other stuff */ |
| | |
} | | } |
| | |
void paralyze_player(object *op, object *hitter, int dam) | | void paralyze_player(object *op, object *hitter, int dam) |
{ object *tmp; | | { |
| | float effect,max; |
| | 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); |
tmp->x=op->x,tmp->y=op->y; | | tmp->x=op->x,tmp->y=op->y; |
| | |
*/ | | */ |
insert_ob_in_map_simple(tmp,op->map); | | insert_ob_in_map_simple(tmp,op->map); |
} | | } |
op->speed_left-=(float)FABS(op->speed)*(dam*3); | | /* Do this as a float - otherwise, rounding might very well reduce this to 0 */ |
tmp->stats.food+=(signed short) (dam*3)/op->speed; | | effect = (float)dam * 3.0 / (100.0 - (float) op->resist[ATNR_PARALYZE]); |
if(op->speed_left< -(FABS(op->speed)*40)) { | | |
op->speed_left = (float) -(FABS(op->speed)*40); | | op->speed_left-=FABS(op->speed)*effect; |
tmp->stats.food = (signed short) (40/FABS(op->speed)); | | tmp->stats.food+=(signed short) effect/op->speed; |
| | |
| | /* max number of ticks to be affected for. */ |
| | max = (100 - op->resist[ATNR_PARALYZE])/ 2; |
| | |
| | if (op->speed_left< -(FABS(op->speed)*max)) { |
| | op->speed_left = (float) -(FABS(op->speed)*max); |
| | tmp->stats.food = (signed short) (max/FABS(op->speed)); |
} | | } |
} | | } |
| | |