version 1.21 | | version 1.22 |
---|
| | |
/* | | /* |
* static char *rcsid_monster_c = | | * static char *rcsid_monster_c = |
* "$Id: monster.c,v 1.21 2001/05/23 06:14:41 mwedel Exp $"; | | * "$Id: monster.c,v 1.22 2001/05/29 04:41:53 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
if(QUERY_FLAG(op,FLAG_READY_HORN)&&!(RANDOM()%5)) | | if(QUERY_FLAG(op,FLAG_READY_HORN)&&!(RANDOM()%5)) |
if(monster_use_horn(op,part,enemy,dir)) | | if(monster_use_horn(op,part,enemy,dir)) |
return 0; | | return 0; |
#ifdef ALLOW_SKILLS | | |
if(QUERY_FLAG(op,FLAG_READY_SKILL)&&!(RANDOM()%3)) | | if(QUERY_FLAG(op,FLAG_READY_SKILL)&&!(RANDOM()%3)) |
if(monster_use_skill(op,part,enemy,dir)) | | if(monster_use_skill(op,part,enemy,dir)) |
return 0; | | return 0; |
#endif | | |
if(QUERY_FLAG(op,FLAG_READY_BOW)&&!(RANDOM()%2)) | | if(QUERY_FLAG(op,FLAG_READY_BOW)&&!(RANDOM()%2)) |
if(monster_use_bow(op,part,enemy,dir)) | | if(monster_use_bow(op,part,enemy,dir)) |
return 0; | | return 0; |
| | |
if(QUERY_FLAG(op,FLAG_RUN_AWAY)) { | | if(QUERY_FLAG(op,FLAG_RUN_AWAY)) { |
signed char tmp = (signed char)((float)part->stats.wc*(float)2); | | signed char tmp = (signed char)((float)part->stats.wc*(float)2); |
part->stats.wc+=tmp; | | part->stats.wc+=tmp; |
#ifdef ALLOW_SKILLS | | |
(void)skill_attack(enemy,part,0,NULL); | | (void)skill_attack(enemy,part,0,NULL); |
#else | | |
(void)attack_ob(enemy,part); | | |
#endif | | |
part->stats.wc-=tmp; | | part->stats.wc-=tmp; |
} else | | } else |
#ifdef ALLOW_SKILLS | | |
(void)skill_attack(enemy,part,0,NULL); | | (void)skill_attack(enemy,part,0,NULL); |
#else | | |
(void) attack_ob(enemy,part); | | |
#endif | | |
} /* if monster is in attack range */ | | } /* if monster is in attack range */ |
| | |
if(QUERY_FLAG(part,FLAG_FREED)) /* Might be freed by ghost-attack or hit-back */ | | if(QUERY_FLAG(part,FLAG_FREED)) /* Might be freed by ghost-attack or hit-back */ |
| | |
return cast_spell(part,part,dir,sp_typ,ability, spellNormal,NULL); | | return cast_spell(part,part,dir,sp_typ,ability, spellNormal,NULL); |
} | | } |
| | |
#ifdef ALLOW_SKILLS | | |
/* monster_use_skill()-implemented 95-04-28 to allow monster skill use. | | /* monster_use_skill()-implemented 95-04-28 to allow monster skill use. |
* Note that monsters do not need the skills SK_MELEE_WEAPON and | | * Note that monsters do not need the skills SK_MELEE_WEAPON and |
* SK_MISSILE_WEAPON to make those respective attacks, if we | | * SK_MISSILE_WEAPON to make those respective attacks, if we |
| | |
return do_skill(head,dir,NULL); | | return do_skill(head,dir,NULL); |
} | | } |
| | |
#endif | | |
| | |
/* For the future: Move this function together with case 3: in fire() */ | | /* For the future: Move this function together with case 3: in fire() */ |
| | |
| | |
check_good_armour(mon,item); | | check_good_armour(mon,item); |
break; | | break; |
case SKILL: | | case SKILL: |
#ifdef ALLOW_SKILLS | | |
if((flag=QUERY_FLAG(mon,FLAG_CAN_USE_SKILL))) { | | if((flag=QUERY_FLAG(mon,FLAG_CAN_USE_SKILL))) { |
if(!QUERY_FLAG(item,FLAG_APPLIED)) manual_apply(mon,item,0); | | if(!QUERY_FLAG(item,FLAG_APPLIED)) manual_apply(mon,item,0); |
if (item->type==SKILL&&present_in_ob(SKILL,mon)!=NULL) | | if (item->type==SKILL&&present_in_ob(SKILL,mon)!=NULL) |
SET_FLAG(mon, FLAG_READY_SKILL); | | SET_FLAG(mon, FLAG_READY_SKILL); |
} | | } |
#endif | | |
break; | | break; |
case RING: | | case RING: |
flag=QUERY_FLAG(mon,FLAG_USE_RING); | | flag=QUERY_FLAG(mon,FLAG_USE_RING); |