fix issue #836 - engulfing mounter hero

Reported by copperwater:  if an engulfer swallowed a mounted hero,
odd things could happen if the hero dismounted.  The steed would be
silently expelled and float-down flooreffects were attempted.

It turns out that if the engulfer is classified as an animal (so
purple worm, lurker above, trapper), the hero got "plucked from
<steed>'s saddle" and was forcibly dismounted prior to completing
the engulf operation, but non-animals (vortices, air elemental,
ocher jelly, Juiblex) swallowed the hero+steed intact.  The most
straightforward fix to dismounting-while-engulfed issues is to change
engulfing to always pluck the hero from the saddle even when the
engulfer isn't an animal.

If there's no room on the level to place the former steed, it gets
killed off.  I looked at changing that to put the steed into limbo,
waiting to migrate back to the current level if hero leaves and
subsequently returns, but that breaks movemon()'s assumption that
when monsters are in the process of moving, only the currently moving
one can be taken off the fmon list to be placed on migrating_mons.

[The recently added monster knockback code violates that assumption
too when knocking the victim into a level changer trap.  It needs to
be fixed in one fashion or another.]
This commit is contained in:
PatR
2022-08-09 16:22:50 -07:00
parent fd9745f9c6
commit e9ec89a903
6 changed files with 71 additions and 33 deletions

View File

@@ -20,7 +20,6 @@ static void m_detach(struct monst *, struct permonst *);
static void set_mon_min_mhpmax(struct monst *, int);
static void lifesaved_monster(struct monst *);
static boolean ok_to_obliterate(struct monst *);
static void deal_with_overcrowding(struct monst *);
static void m_restartcham(struct monst *);
static boolean restrap(struct monst *);
static int pick_animal(void);
@@ -3444,7 +3443,7 @@ elemental_clog(struct monst *mon)
/* make monster mtmp next to you (if possible);
might place monst on far side of a wall or boulder */
void
mnexto(struct monst* mtmp, unsigned int rlocflags)
mnexto(struct monst *mtmp, unsigned int rlocflags)
{
coord mm;
@@ -3463,8 +3462,8 @@ mnexto(struct monst* mtmp, unsigned int rlocflags)
return;
}
static void
deal_with_overcrowding(struct monst* mtmp)
void
deal_with_overcrowding(struct monst *mtmp)
{
if (In_endgame(&u.uz)) {
debugpline1("overcrowding: elemental_clog on %s", m_monnam(mtmp));
@@ -3477,7 +3476,7 @@ deal_with_overcrowding(struct monst* mtmp)
/* like mnexto() but requires destination to be directly accessible */
void
maybe_mnexto(struct monst* mtmp)
maybe_mnexto(struct monst *mtmp)
{
coord mm;
struct permonst *ptr = mtmp->data;