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

@@ -1151,16 +1151,17 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
place_monster(mtmp, u.ux, u.uy);
set_ustuck(mtmp);
newsym(mtmp->mx, mtmp->my);
if (is_animal(mtmp->data) && u.usteed) {
/* 3.7: dismount for all engulfers, not just for purple worms */
if (u.usteed) {
char buf[BUFSZ];
/* Too many quirks presently if hero and steed
* are swallowed. Pretend purple worms don't
* like horses for now :-)
*/
Strcpy(buf, mon_nam(u.usteed));
urgent_pline("%s lunges forward and plucks you off %s!",
Monnam(mtmp), buf);
urgent_pline("%s %s forward and plucks you off %s!",
Some_Monnam(mtmp),
is_animal(mtmp->data) ? "lunges"
: amorphous(mtmp->data) ? "oozes"
: "surges",
buf);
dismount_steed(DISMOUNT_ENGULFED);
} else {
urgent_pline("%s engulfs you!", Monnam(mtmp));
@@ -1184,7 +1185,11 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
if (touch_petrifies(g.youmonst.data) && !resists_ston(mtmp)) {
/* put the attacker back where it started;
the resulting statue will end up there */
the resulting statue will end up there
[note: if poly'd hero could ride or non-poly'd hero could
acquire touch_petrifies() capability somehow, this code
would need to deal with possibility of steed having taken
engulfer's previous spot when hero was forcibly dismounted] */
remove_monster(mtmp->mx, mtmp->my); /* u.ux,u.uy */
place_monster(mtmp, omx, omy);
minstapetrify(mtmp, TRUE);