temporarily override 'safepet' (by faking use of 'F' prefix) when possibly unintentionally attacking peaceful monsters and optionally pets */
| 429 | /* temporarily override 'safepet' (by faking use of 'F' prefix) when possibly |
| 430 | unintentionally attacking peaceful monsters and optionally pets */ |
| 431 | boolean |
| 432 | force_attack(struct monst *mtmp, boolean pets_too) |
| 433 | { |
| 434 | boolean attacked, save_Forcefight; |
| 435 | |
| 436 | save_Forcefight = svc.context.forcefight; |
| 437 | /* always set forcefight On for hostiles and peacefuls, maybe for pets */ |
| 438 | if (pets_too || !mtmp->mtame) |
| 439 | svc.context.forcefight = TRUE; |
| 440 | attacked = do_attack(mtmp); |
| 441 | svc.context.forcefight = save_Forcefight; |
| 442 | return attacked; |
| 443 | } |
| 444 | |
| 445 | /* try to attack; return False if monster evaded; |
| 446 | u.dx and u.dy must be set */ |