diff --git a/src/dog.c b/src/dog.c index 95af76a21..064cbd1a5 100644 --- a/src/dog.c +++ b/src/dog.c @@ -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; diff --git a/src/teleport.c b/src/teleport.c index 4374d0e3c..808ac09f1 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -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); } diff --git a/src/wizard.c b/src/wizard.c index 50137c763..9d0fb0e03 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -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 + " 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: