From: copperwater Date: Mon, 28 May 2018 23:36:23 +0000 (-0400) Subject: Change logic for immobilized displacement, fixing a bug X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9eb81e0c70a3454cf9156c3e3bdaf128899ce68;p=nethack Change logic for immobilized displacement, fixing a bug The bug was that you could easily displace peaceful sleeping monsters. The source of this was that there was no check for sleeping in the attack() function that checks for immobilization. As well as adding the sleeping check, this logic is modified so that it makes more sense: if a monster is immobilized at all (sleeping, frozen, or mcanmove = 0) it always "doesn't seem to move!" You can't randomly displace it anyway 1/6 of the time. Sessile monsters who are otherwise not immobilized don't move 5/6 of the time, but can be displaced with the other 1/6. --- diff --git a/src/uhitm.c b/src/uhitm.c index 8059ce748..5c9b9a62a 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -368,8 +368,8 @@ register struct monst *mtmp; You("stop. %s is in the way!", buf); end_running(TRUE); return TRUE; - } else if ((mtmp->mfrozen || (!mtmp->mcanmove) - || (mtmp->data->mmove == 0)) && rn2(6)) { + } 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); return TRUE;