when hero leaves a level, some monsters should be placed on the migrating_mons list instead of being stashed inside the level's file */
| 765 | /* when hero leaves a level, some monsters should be placed on the |
| 766 | migrating_mons list instead of being stashed inside the level's file */ |
| 767 | staticfn boolean |
| 768 | keep_mon_accessible(struct monst *mon) |
| 769 | { |
| 770 | /* the Wizard is kept accessible so that his harassment can fetch |
| 771 | him instead of creating a new instance but also so that he can |
| 772 | be put back at his current location if hero returns to his level */ |
| 773 | if (mon->iswiz) |
| 774 | return TRUE; |
| 775 | /* monsters with special attachment to a particular level only need |
| 776 | to be kept accessible when on some other level */ |
| 777 | if (mon->mextra |
| 778 | && ((mon->isshk && !on_level(&u.uz, &ESHK(mon)->shoplevel)) |
| 779 | || (mon->ispriest && !on_level(&u.uz, &EPRI(mon)->shrlevel)) |
| 780 | || (mon->isgd && !on_level(&u.uz, &EGD(mon)->gdlevel)))) |
| 781 | return TRUE; |
| 782 | /* normal monsters go into the level save file instead of being held |
| 783 | on the migrating_mons list for off-level accessibility */ |
| 784 | return FALSE; |
| 785 | } |
| 786 | |
| 787 | /* called when you move to another level */ |
| 788 | void |