From 586cad7fc9a0a160dc11787ac568e654c051ff2a Mon Sep 17 00:00:00 2001 From: "Derek S. Ray" Date: Thu, 30 Apr 2015 18:34:32 -0400 Subject: [PATCH] limit obj manipulation by handless creatures something that is M1_NOHANDS ought not to be able to pick up a pile of rocks, daggers, or gold pieces unless it has other features that would permit such a thing. --- src/mon.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/mon.c b/src/mon.c index 9c339a59d..f3af79b6f 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 mon.c $NHDT-Date: 1430396792 2015/04/30 12:26:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.169 $ */ +/* NetHack 3.5 mon.c $NHDT-Date: 1430433254 2015/04/30 22:34:14 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.171 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -938,6 +938,8 @@ struct obj *otmp; { int otyp = otmp->otyp, newload = otmp->owt; struct permonst *mdat = mtmp->data; + short nattk = 0; + boolean glomper = FALSE; if (notake(mdat)) return FALSE; /* can't carry anything */ @@ -950,6 +952,21 @@ struct obj *otmp; (otyp != BELL_OF_OPENING || !is_covetous(mdat))) return FALSE; + /* monsters without hands can't pick up multiple objects at once + * unless they have an engulfing attack + * + * ...dragons, of course, can always carry gold pieces somehow */ + if (otmp->quan > 1) { + for (nattk = 0; nattk < NATTK; nattk++) + glomper = (glomper || mtmp->data->mattk[nattk].aatyp == AT_ENGL); + + if ((mtmp->data->mflags1 & M1_NOHANDS) && !glomper + && (!(mtmp->data->mlet == S_DRAGON + && otmp->oclass == COIN_CLASS))) { + return FALSE; + } + } + /* Steeds don't pick up stuff (to avoid shop abuse) */ if (mtmp == u.usteed) return (FALSE); if (mtmp->isshk) return(TRUE); /* no limit */