Wizard of Yendor entering endgame

When entering the Plane of Earth (or level teleporting directly to
another endgame level in wizard mode), if the Wizard came off the
migrating_mons list instead being re-created from scratch, he would
be placed randomly on the level instead of next to the arrival point.
If his mstrategy field still had the STRAT_WAITFORU bit set and you
didn't move to where he could see you, he might never come after you,
at least until some future harassment event chose 'resurrect'.
This commit is contained in:
PatR
2022-08-05 14:22:27 -07:00
parent b01d81277e
commit 393283f05c
3 changed files with 25 additions and 5 deletions

View File

@@ -398,6 +398,9 @@ mon_arrive(struct monst *mtmp, int when)
else
mnexto(mtmp, RLOC_NOMSG);
return;
} else if (when == Wiz_arrive) {
/* resurrect() is bringing existing wizard to harass the hero */
xyloc = MIGR_WITH_HERO;
}
/*
* The monster arrived on this level independently of the player.
@@ -410,10 +413,9 @@ mon_arrive(struct monst *mtmp, int when)
long nmv = g.moves - 1L - mtmp->mlstmv;
mon_catchup_elapsed_time(mtmp, nmv);
mtmp->mlstmv = g.moves - 1L;
/* let monster move a bit on new level (see placement code below) */
wander = (xint16) min(nmv, 8);
wander = (xint16) min(nmv, 8L);
} else
wander = 0;
@@ -526,7 +528,7 @@ mon_arrive(struct monst *mtmp, int when)
if (when != Wiz_arrive)
/* losedogs() will deal with this */
relmon(mtmp, &failed_arrivals);
else
else /* when==Wiz_arrive => not being called by losedogs() */
m_into_limbo(mtmp);
}
}
@@ -629,6 +631,8 @@ mon_catchup_elapsed_time(
mtmp->mhp = mtmp->mhpmax;
else
mtmp->mhp += imv;
set_mon_lastmove(mtmp);
}
/* bookkeeping when mtmp is about to leave the current level;

View File

@@ -1377,7 +1377,10 @@ rloc_to(struct monst *mtmp, coordxy x, coordxy y)
}
void
rloc_to_flag(struct monst *mtmp, coordxy x, coordxy y, unsigned int rlocflags)
rloc_to_flag(
struct monst *mtmp,
coordxy x, coordxy y,
unsigned rlocflags)
{
rloc_to_core(mtmp, x, y, rlocflags);
}

View File

@@ -709,6 +709,9 @@ resurrect(void)
if (!helpless(mtmp)) {
*mmtmp = mtmp->nmon;
mon_arrive(mtmp, -1); /* -1: Wiz_arrive (dog.c) */
/* mx: mon_arrive() might have sent mtmp into limbo */
if (!mtmp->mx)
mtmp = 0;
/* note: there might be a second Wizard; if so,
he'll have to wait til the next resurrection */
break;
@@ -719,7 +722,16 @@ resurrect(void)
}
if (mtmp) {
mtmp->mtame = mtmp->mpeaceful = 0; /* paranoia */
/* if wizard ended up far away because of conjestion, clear his
wait-until-close flag; otherwise set that flag in case he just
came off the migrating_mons list to prevent him from triggering
"<mon> vanishes and reappears" on his first move */
if (!couldsee(mtmp->mx, mtmp->my))
mtmp->mstrategy &= ~STRAT_WAITMASK;
else
mtmp->mstrategy |= STRAT_WAITMASK;
mtmp->mtame = 0, mtmp->mpeaceful = 0; /* paranoia */
set_malign(mtmp);
if (!Deaf) {
pline("A voice booms out...");
@@ -734,6 +746,7 @@ void
intervene(void)
{
int which = Is_astralevel(&u.uz) ? rnd(4) : rn2(6);
/* cases 0 and 5 don't apply on the Astral level */
switch (which) {
case 0: