version 1.10 | | version 1.11 |
---|
| | |
/* | | /* |
* static char *rcsid_attack_c = | | * static char *rcsid_attack_c = |
* "$Id: attack.c,v 1.10 2000/05/26 10:14:55 jec Exp $"; | | * "$Id: attack.c,v 1.11 2000/05/26 12:36:49 jec Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
int hit_map(object *op,int dir,int type) { | | int hit_map(object *op,int dir,int type) { |
object *tmp,*next=NULL; | | object *tmp,*next=NULL; |
int retflag=0; /* added this flag.. will return 1 if it hits a monster */ | | int retflag=0; /* added this flag.. will return 1 if it hits a monster */ |
| | tag_t tag; |
| | |
| | if (QUERY_FLAG (op, FLAG_FREED)) { |
| | LOG (llevError, "BUG: hit_map(): free object\n"); |
| | return 0; |
| | } |
| | |
if (op->head) op=op->head; | | if (op->head) op=op->head; |
| | |
| | tag = op->count; |
| | |
if (!op->map) { | | if (!op->map) { |
LOG(llevDebug,"hit_map called, but %s has no map", op->name); | | LOG(llevDebug,"hit_map called, but %s has no map", op->name); |
return 0; | | return 0; |
| | |
else if(QUERY_FLAG(tmp,FLAG_ALIVE)) { | | else if(QUERY_FLAG(tmp,FLAG_ALIVE)) { |
hit_player(tmp,op->stats.dam,op,type); | | hit_player(tmp,op->stats.dam,op,type); |
retflag |=1; | | retflag |=1; |
| | if (was_destroyed (op, tag)) |
| | break; |
} /* It is possible the object has been relocated to know longer be | | } /* It is possible the object has been relocated to know longer be |
* on the map (ie, in an icecube.) If we no longer have a map, | | * on the map (ie, in an icecube.) If we no longer have a map, |
* just ignore. | | * just ignore. |
| | |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
object *old_hitter=NULL; /* this is used in case of servant monsters */ | | object *old_hitter=NULL; /* this is used in case of servant monsters */ |
int maxdam=0,ndam,attacktype=1,attacknum,magic=(type & AT_MAGIC); | | int maxdam=0,ndam,attacktype=1,attacknum,magic=(type & AT_MAGIC); |
| | tag_t hitter_tag; |
| | |
| | if (QUERY_FLAG (op, FLAG_FREED) || QUERY_FLAG (hitter, FLAG_FREED)) { |
| | LOG (llevError, "BUG: hit_player(): freed object\n"); |
| | return 0; |
| | } |
| | hitter_tag = hitter->count; |
| | |
if(op->head!=NULL) { | | if(op->head!=NULL) { |
if(op->head==op) { | | if(op->head==op) { |
| | |
op=op->head; | | op=op->head; |
} | | } |
| | |
if(op->type==DOOR && op->inv && op->inv->type==RUNE) | | if(op->type==DOOR && op->inv && op->inv->type==RUNE) { |
spring_trap(op->inv,hitter); | | spring_trap(op->inv,hitter); |
| | if (was_destroyed (hitter, hitter_tag)) |
/* If its already dead, or we're the wizard, don't attack it - no point */ | | |
if(QUERY_FLAG(op,FLAG_WIZ)||!QUERY_FLAG(op,FLAG_ALIVE)||op->stats.hp<0) | | |
return 0; | | return 0; |
| | } |
| | |
/* If its already dead, or we're the wizard, don't attack it - no point */ | | /* If its already dead, or we're the wizard, don't attack it - no point */ |
if(hitter->name==NULL) { | | if(QUERY_FLAG(op,FLAG_WIZ)||!QUERY_FLAG(op,FLAG_ALIVE)||op->stats.hp<0) |
LOG(llevDebug, "hit_player: hitter has no name\n"); | | |
return 0; | | return 0; |
} | | |
| | |
#ifdef ATTACK_DEBUG | | #ifdef ATTACK_DEBUG |
LOG(llevDebug,"hit player: attacktype %d, dam %d\n", type, dam); | | LOG(llevDebug,"hit player: attacktype %d, dam %d\n", type, dam); |