more issue #1253 - shape change vs Eleberth

I happened to restore a save file left over from testing yesterday's
attempt to fix github issue #1253 and had a werejackal change from
human to beast while next to my hero on "Elbereth", then attack me.

This should be sufficient to prevent that.  I'm not sure why the
previous fix attempt seemed to be adequate when testing it.  The new
fix relies on the previous one.
This commit is contained in:
PatR
2024-06-05 22:58:44 -07:00
parent cfb053157a
commit d02028fe66

View File

@@ -671,7 +671,15 @@ mattacku(struct monst *mtmp)
also, were creature might change from human to animal or vice versa */
if (mtmp->cham == NON_PM && !mtmp->mcan && !range2
&& (is_demon(mdat) || is_were(mdat))) {
boolean already_fleeing = mtmp->mflee != 0;
summonmu(mtmp, youseeit);
/* were-creature might have changed to beast form; if that has
caused it to become afraid (due to non-human reacting to scroll
of scare monster or engraved "Elbereth" which was being ignored
while in human form), don't continue this attack */
if (mtmp->mflee && !already_fleeing)
return 0;
mdat = mtmp->data; /* update cached value in case of were change */
}