| 233 | } |
| 234 | |
| 235 | staticfn unsigned long |
| 236 | target_on(int mask, struct monst *mtmp) |
| 237 | { |
| 238 | short otyp; |
| 239 | struct obj *otmp; |
| 240 | struct monst *mtmp2; |
| 241 | |
| 242 | if (!M_Wants(mask)) |
| 243 | return (unsigned long) STRAT_NONE; |
| 244 | |
| 245 | otyp = which_arti(mask); |
| 246 | if (!mon_has_arti(mtmp, otyp)) { |
| 247 | if (you_have(mask)) { |
| 248 | mtmp->mgoal.x = u.ux; |
| 249 | mtmp->mgoal.y = u.uy; |
| 250 | return (STRAT_PLAYER | mask); |
| 251 | } else if ((otmp = on_ground(otyp))) { |
| 252 | mtmp->mgoal.x = otmp->ox; |
| 253 | mtmp->mgoal.y = otmp->oy; |
| 254 | return (STRAT_GROUND | mask); |
| 255 | } else if ((mtmp2 = other_mon_has_arti(mtmp, otyp)) != 0 |
| 256 | /* when seeking the Amulet, avoid targeting the Wizard |
| 257 | or temple priests (to protect Moloch's high priest) */ |
| 258 | && (otyp != AMULET_OF_YENDOR |
| 259 | || (!mtmp2->iswiz && !inhistemple(mtmp2)))) { |
| 260 | mtmp->mgoal.x = mtmp2->mx; |
| 261 | mtmp->mgoal.y = mtmp2->my; |
| 262 | return (STRAT_MONSTR | mask); |
| 263 | } |
| 264 | } |
| 265 | mtmp->mgoal.x = mtmp->mgoal.y = 0; |
| 266 | return (unsigned long) STRAT_NONE; |
| 267 | } |
| 268 | |
| 269 | staticfn unsigned long |
| 270 | strategy(struct monst *mtmp) |
no test coverage detected