finding level's vault guard

Extend findgd() to bring a migrating guard back 'early' if there is
one and an active guard is wanted but none is present on the level.
It the level is full then the found guard is likely to be sent into
limbo (scheduled to migrate back), so one can end up moving back and
forth.  Unlikely to occur during normal play.

Also, when a guard is needed and there's a dead one parked at <0,0>,
revive it.  The dead guard has temporary corridor info in its
mon->mextra->egd that a new one won't have.  (This might introduce
unexpected changes in vault behavior but if so, the old behavior was
probably buggy.)

When the hero is in a vault, don't find a guard unless u.uinvault is
ready to bring it into play.  It was finding one every turn and then
ignoring the result for 29 turns out of 30.

Change guard appearance timing:  the first appearance is still after
30 turns, but if it goes away, bring it back after 15 more turns
rather than another 30 and repeat as needed.
This commit is contained in:
PatR
2022-07-22 14:11:16 -07:00
parent 96084b2c68
commit 04e8fbf249
2 changed files with 39 additions and 22 deletions

View File

@@ -347,7 +347,7 @@ mon_arrive(struct monst *mtmp, int when)
/* some monsters might need to do something special upon arrival
_after_ the current level has been fully set up; see dochug() */
mtmp->mstrategy |= STRAT_ARRIVE;
mtmp->mstate &= ~MON_MIGRATING;
mtmp->mstate &= ~(MON_MIGRATING | MON_LIMBO);
/* make sure mnexto(rloc_to(set_apparxy())) doesn't use stale data */
mtmp->mux = u.ux, mtmp->muy = u.uy;