fix github issue #431 - failed displacing

Being able to swap places with peaceful monsters instead of just
with pets made it possible to cause them to flee. Shopkeepers
wouldn't abandon the shop door but temple priests would attack
if hero tried to chat while they were fleeing.
This commit is contained in:
PatR
2020-12-31 11:23:29 -08:00
parent 565cdf3cba
commit 4c8a8bcfee
3 changed files with 17 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.410 $ $NHDT-Date: 1609281273 2020/12/29 22:34:33 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.413 $ $NHDT-Date: 1609442596 2020/12/31 19:23:16 $
General Fixes and Modified Features
-----------------------------------
@@ -469,6 +469,7 @@ wizard mode sanity check complained about Wizard's clone mimicking a monster
new ^G gender-naming handling code required a guard against null permonst
pointer which could occur under some circumstances
replace some monster names in .lua files with their new equivalents
attempting to swap places with a peaceful monster might cause it to flee
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 hack.c $NHDT-Date: 1608673692 2020/12/22 21:48:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.274 $ */
/* NetHack 3.7 hack.c $NHDT-Date: 1609442596 2020/12/31 19:23:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.276 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1913,8 +1913,9 @@ domove_core()
You("%s %s.", mtmp->mpeaceful ? "swap places with" : "frighten",
x_monnam(mtmp,
mtmp->mtame ? ARTICLE_YOUR
: (!has_mgivenname(mtmp) && !type_is_pname(mtmp->data))
? ARTICLE_THE : ARTICLE_NONE,
: (!has_mgivenname(mtmp)
&& !type_is_pname(mtmp->data)) ? ARTICLE_THE
: ARTICLE_NONE,
(mtmp->mpeaceful && !mtmp->mtame) ? "peaceful" : 0,
has_mgivenname(mtmp) ? SUPPRESS_SADDLE : 0, FALSE));

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 uhitm.c $NHDT-Date: 1607076540 2020/12/04 10:09:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.288 $ */
/* NetHack 3.7 uhitm.c $NHDT-Date: 1609442602 2020/12/31 19:23:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.292 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -346,9 +346,14 @@ register struct monst *mtmp;
* if your pet is a long worm with a tail.
* There's also a chance of displacing a "frozen" monster:
* sleeping monsters might magically walk in their sleep.
* This block of code used to only be called for pets; now
* that it also applies to peacefuls, non-pets mustn't be
* forced to flee.
*/
boolean foo = (Punished || !rn2(7)
|| (is_longworm(mtmp->data) && mtmp->wormno)),
|| (is_longworm(mtmp->data) && mtmp->wormno)
|| (IS_ROCK(levl[u.ux][u.uy].typ)
&& !passes_walls(mtmp->data))),
inshop = FALSE;
char *p;
@@ -360,17 +365,17 @@ register struct monst *mtmp;
break;
}
}
if (inshop || foo || (IS_ROCK(levl[u.ux][u.uy].typ)
&& !passes_walls(mtmp->data))) {
if (inshop || foo) {
char buf[BUFSZ];
monflee(mtmp, rnd(6), FALSE, FALSE);
if (mtmp->mtame) /* see 'additional considerations' above */
monflee(mtmp, rnd(6), FALSE, FALSE);
Strcpy(buf, y_monnam(mtmp));
buf[0] = highc(buf[0]);
You("stop. %s is in the way!", buf);
end_running(TRUE);
return TRUE;
} else if (mtmp->mfrozen || mtmp->msleeping || (!mtmp->mcanmove)
} else if (mtmp->mfrozen || mtmp->msleeping || !mtmp->mcanmove
|| (mtmp->data->mmove == 0 && rn2(6))) {
pline("%s doesn't seem to move!", Monnam(mtmp));
end_running(TRUE);