version 1.31 | | version 1.32 |
---|
| | |
/* | | /* |
* static char *rcsid_monster_c = | | * static char *rcsid_monster_c = |
* "$Id: monster.c,v 1.31 2001/10/20 07:07:54 garbled Exp $"; | | * "$Id: monster.c,v 1.32 2001/10/30 00:49:03 michtoen Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
/* enemy should already be on this map, so don't really need to check | | /* enemy should already be on this map, so don't really need to check |
* for that. | | * for that. |
*/ | | */ |
if (rv->distance < QUERY_FLAG(enemy, FLAG_STEALTH)?(radius/2)+1:radius) { | | if (rv->distance < (QUERY_FLAG(enemy, FLAG_STEALTH)?(radius/2)+1:(int)radius)) { |
CLEAR_FLAG(op,FLAG_SLEEP); | | CLEAR_FLAG(op,FLAG_SLEEP); |
return 1; | | return 1; |
} | | } |
| | |
| | |
| | |
/* If we cast a spell, only use up casting_time speed */ | | /* If we cast a spell, only use up casting_time speed */ |
head->speed_left+=1.0 - spells[sp_typ].time/20.0*FABS(head->speed); | | head->speed_left+=(float)1.0 - spells[sp_typ].time/(float)20.0*(float)FABS(head->speed); |
| | |
head->stats.sp-=SP_level_spellpoint_cost(head,head,sp_typ); | | head->stats.sp-=SP_level_spellpoint_cost(head,head,sp_typ); |
/* choose the spell the monster will cast next */ | | /* choose the spell the monster will cast next */ |
| | |
/* &32 reverses behaviour. See global.h */ | | /* &32 reverses behaviour. See global.h */ |
if(!QUERY_FLAG(item,FLAG_APPLIED)) | | if(!QUERY_FLAG(item,FLAG_APPLIED)) |
manual_apply(mon,item,0); | | manual_apply(mon,item,0); |
if (item->type==BOW&&present_in_ob(item->stats.maxsp,mon)!=NULL) | | if (item->type==BOW&&present_in_ob((unsigned char)item->stats.maxsp,mon)!=NULL) |
SET_FLAG(mon, FLAG_READY_BOW); | | SET_FLAG(mon, FLAG_READY_BOW); |
} | | } |
return; | | return; |
| | |
} | | } |
| | |
int dist_att (int dir , object *ob, object *enemy, object *part, rv_vector *rv) { | | int dist_att (int dir , object *ob, object *enemy, object *part, rv_vector *rv) { |
int dist; | | |
| | |
if (can_hit(part,enemy,rv)) | | if (can_hit(part,enemy,rv)) |
return dir; | | return dir; |
if (rv->distance < 10) | | if (rv->distance < 10) |
return absdir(dir+4); | | return absdir(dir+4); |
/* This was 81 below? That seems outragously far - I'm thinking that was | | |
* a typo and it shoud be 18 | | else if (rv->distance>18) { |
*/ | | |
else if (dist>18) { | | |
return dir; | | return dir; |
} | | } |
return 0; | | return 0; |
| | |
| | |
/* INVISIBLE ENEMY. */ | | /* INVISIBLE ENEMY. */ |
if(!QUERY_FLAG(looker,FLAG_SEE_INVISIBLE) | | if(!QUERY_FLAG(looker,FLAG_SEE_INVISIBLE) |
&&(is_true_undead(looker)==QUERY_FLAG(enemy,FLAG_UNDEAD))) | | &&(is_true_undead(looker)==(int)(QUERY_FLAG(enemy,FLAG_UNDEAD)))) |
return 0; | | return 0; |
| | |
} else if(looker->type==PLAYER) /* for players, a (possible) shortcut */ | | } else if(looker->type==PLAYER) /* for players, a (possible) shortcut */ |