fix grab/engulf by tame/peaceful monster (trunk only)

<Someone> reported being swallowed by his pet purple worm during
Conflict, then being stuck inside once Conflict ended.  I'm not entirely
sure what dog_move() intended by the "swallowed case handled above" comment.
It returns without letting the pet move when the distance between pet and
hero is 0; that wasn't much in the way of "handling" being swallowed.
Grabbing pets did let go, but peaceful monsters didn't until you actually
attempted to move away from them.  Now all four combinations (grabbed or
swallowed by tame or peaceful monster) are handled the same:  the monster
will let the hero go next time it gets a chance to try to move, using up
its move in the process.
This commit is contained in:
nethack.rankin
2006-08-17 04:35:08 +00:00
parent 2e8c4b08d4
commit e6bf8af74e
3 changed files with 31 additions and 13 deletions

View File

@@ -155,6 +155,7 @@ make region ttl field a long instead of short to get rid of lint warnings
pushing a boulder onto a level teleporter trap could issue repeat messages
if shopkeeper or priest gets teleported while inside his shop or temple,
give locations inside that room preference when choosing destination
tame/peaceful grabber/engulfer will release hero after conflict ends
Platform- and/or Interface-Specific Fixes

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dogmove.c 3.5 2005/10/14 */
/* SCCS Id: @(#)dogmove.c 3.5 2006/08/16 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -635,11 +635,13 @@ register int after; /* this is extra fast monster movement */
return 2; /* current monster is gone */
}
}
#if 0 /* [this is now handled in dochug()] */
if (!Conflict && !mtmp->mconf &&
mtmp == u.ustuck && !sticks(youmonst.data)) {
unstuck(mtmp); /* swallowed case handled above */
You("get released!");
}
#endif
if (!nohands(mtmp->data) && !verysmall(mtmp->data)) {
allowflags |= OPENDOOR;
if (monhaskey(mtmp, TRUE)) allowflags |= UNLOCKDOOR;

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)monmove.c 3.5 2005/10/14 */
/* SCCS Id: @(#)monmove.c 3.5 2006/08/16 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -8,13 +8,13 @@
extern boolean notonhead;
STATIC_DCL void FDECL(watch_on_duty,(struct monst *));
STATIC_DCL int FDECL(disturb,(struct monst *));
STATIC_DCL void FDECL(release_hero, (struct monst *));
STATIC_DCL void FDECL(distfleeck,(struct monst *,int *,int *,int *));
STATIC_DCL int FDECL(m_arrival, (struct monst *));
STATIC_DCL void FDECL(watch_on_duty,(struct monst *));
STATIC_DCL boolean FDECL(stuff_prevents_passage, (struct monst *));
STATIC_OVL int FDECL(vamp_shift, (struct monst *,struct permonst *));
STATIC_DCL int FDECL(vamp_shift, (struct monst *,struct permonst *));
boolean /* TRUE : mtmp died */
mb_trapped(mtmp)
@@ -203,6 +203,21 @@ disturb(mtmp)
return(0);
}
/* ungrab/expel held/swallowed hero */
STATIC_OVL void
release_hero(mon)
struct monst *mon;
{
if (mon == u.ustuck) {
if (u.uswallow) {
expels(mon, mon->data, TRUE);
} else if (!sticks(youmonst.data)) {
unstuck(mon); /* let go */
You("get released!");
}
}
}
/* monster begins fleeing for the specified time, 0 means untimed flee
* if first, only adds fleetime if monster isn't already fleeing
* if fleemsg, prints a message about new flight, otherwise, caller should */
@@ -213,14 +228,7 @@ int fleetime;
boolean first;
boolean fleemsg;
{
if (u.ustuck == mtmp) {
if (u.uswallow)
expels(mtmp, mtmp->data, TRUE);
else if (!sticks(youmonst.data)) {
unstuck(mtmp); /* monster lets go when fleeing */
You("get released!");
}
}
if (mtmp == u.ustuck) release_hero(mtmp); /* expels/unstuck */
if (!first || !mtmp->mflee) {
/* don't lose untimed scare */
@@ -360,6 +368,12 @@ register struct monst *mtmp;
if (mtmp->mflee && !mtmp->mfleetim
&& mtmp->mhp == mtmp->mhpmax && !rn2(25)) mtmp->mflee = 0;
/* cease conflict-induced swallow/grab if conflict has ended */
if (mtmp == u.ustuck && mtmp->mpeaceful && !mtmp->mconf && !Conflict) {
release_hero(mtmp);
return 0; /* uses up monster's turn */
}
set_apparxy(mtmp);
/* Must be done after you move and before the monster does. The
* set_apparxy() call in m_move() doesn't suffice since the variables
@@ -1517,4 +1531,5 @@ struct permonst *ptr;
}
return reslt;
}
/*monmove.c*/