MCPcopy Create free account
hub / github.com/NetHack/NetHack / keep_mon_accessible

Function keep_mon_accessible

src/dog.c:767–785  ·  view source on GitHub ↗

when hero leaves a level, some monsters should be placed on the migrating_mons list instead of being stashed inside the level's file */

Source from the content-addressed store, hash-verified

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 */
767staticfn boolean
768keep_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 */
788void

Callers 1

keepdogsFunction · 0.85

Calls 1

on_levelFunction · 0.85

Tested by

no test coverage detected