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.
This commit is contained in:
copperwater
2018-05-28 19:36:23 -04:00
committed by Pasi Kallinen
parent 6134c6f165
commit a9eb81e0c7

View File

@@ -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;