version 1.19 | | version 1.20 |
---|
| | |
/* | | /* |
* static char *rcsid_attack_c = | | * static char *rcsid_attack_c = |
* "$Id: attack.c,v 1.19 2000/11/08 20:17:41 avogl Exp $"; | | * "$Id: attack.c,v 1.20 2000/11/17 11:16:45 peterm Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
* any further action (like destroying the item). | | * any further action (like destroying the item). |
*/ | | */ |
| | |
int did_make_save_item(object *op, int type) { | | int did_make_save_item(object *op, int type,object *originator) { |
int i, saves=0,materials=0, orig_type=type; | | int i, saves=0,materials=0, orig_type=type; |
| | |
type &= (~op->immune & ~op->protected); | | type &= (~op->immune & ~op->protected); |
| | |
materials++; | | materials++; |
if(RANDOM()%20+1>=material[i].save[type]-op->magic) | | if(RANDOM()%20+1>=material[i].save[type]-op->magic) |
saves++; | | saves++; |
| | /* if the attack is too weak */ |
| | if((20-material[i].save[type])/3 > originator->stats.dam) saves++; |
} | | } |
if (saves==materials || materials==0) return 1; | | if (saves==materials || materials==0) return 1; |
if ((saves==0) || (RANDOM()%materials+1 > saves)) return 0; | | if ((saves==0) || (RANDOM()%materials+1 > saves)) return 0; |
| | |
| | |
void save_throw_object (object *op, int type, object *originator) | | void save_throw_object (object *op, int type, object *originator) |
{ | | { |
if ( ! did_make_save_item (op, type)) | | if ( ! did_make_save_item (op, type,originator)) |
{ | | { |
object *env=op->env; | | object *env=op->env; |
int x=op->x,y=op->y; | | int x=op->x,y=op->y; |
| | |
retflag |=1; | | retflag |=1; |
if (was_destroyed (op, op_tag)) | | if (was_destroyed (op, op_tag)) |
break; | | break; |
} else if (tmp->material) { | | } else if (tmp->material && op->stats.dam > 0) { |
save_throw_object(tmp,type,op); | | save_throw_object(tmp,type,op); |
if (was_destroyed (op, op_tag)) | | if (was_destroyed (op, op_tag)) |
break; | | break; |