From dbd39f2cd5c4648228860c4090a6b9742f208c81 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 12 Jul 2023 09:48:24 -0700 Subject: [PATCH] prevent weightless statues From a reddit thread: statue weight is one and half times corpse weight and some monsters that don't leave a corpse are defined as having mons[].cwt==0 so statues of those weighed nothing. Rather than assigning a non-zero corpse weight to every type of creature, statues that weigh less than an arbitrary value based on monster size have their weight increased to that value. The weight of a statue of a killer bee jumps from 1 to 100, that of a leprechaun increases from 90 to 100, that of a yellow light is changed from 0 to 300, wraith from 0 to 500, and air elemental from 0 to 900. That last one is actually too low but making the formula more complex doesn't seem worth it. --- doc/fixes3-7-0.txt | 3 ++- src/mkobj.c | 24 ++++++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index edfcc231f..34bb787ed 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1,4 +1,4 @@ -DT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1201 $ $NHDT-Date: 1687036542 2023/06/17 21:15:42 $ +DT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1220 $ $NHDT-Date: 1689180503 2023/07/12 16:48:23 $ General Fixes and Modified Features ----------------------------------- @@ -1222,6 +1222,7 @@ in wizard mode, #terrain has offers to view all map locations as single- restore the ability for trap creation via magic which creates pits to destroy 'furniture' allow #sit while flying over a squeaky board trap to trigger it +weight of statues of wraiths and of monsters which never leave a corpse was 0 Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/mkobj.c b/src/mkobj.c index b7b3baa45..36a43e0e9 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 mkobj.c $NHDT-Date: 1654881236 2022/06/10 17:13:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.237 $ */ +/* NetHack 3.7 mkobj.c $NHDT-Date: 1689180492 2023/07/12 16:48:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.272 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1837,11 +1837,27 @@ weight(struct obj *obj) } if (Is_container(obj) || obj->otyp == STATUE) { struct obj *contents; - register int cwt = 0; + int cwt; - if (obj->otyp == STATUE && obj->corpsenm >= LOW_PM) - wt = (int) obj->quan * ((int) mons[obj->corpsenm].cwt * 3 / 2); + if (obj->otyp == STATUE && obj->corpsenm >= LOW_PM) { + int msize = (int) mons[obj->corpsenm].msize, /* 0..7 */ + minwt = (msize + msize + 1) * 100; + /* default statue weight is 1.5 times corpse weight */ + wt = 3 * (int) mons[obj->corpsenm].cwt / 2; + /* some monsters that never leave a corpse when they die have + corpse weight defined as 0; statues resembling them need to + have non-zero weight; others are so tiny (killer bee) that + they weigh barely more than nothing or so insubstantial + (wraith) that they actually weigh nothing; statues of such + need more heft */ + if (wt < minwt) + wt = minwt; + /* this has no effect because statues don't stack */ + wt *= (int) obj->quan; + } + + cwt = 0; /* contents weight */ for (contents = obj->cobj; contents; contents = contents->nobj) cwt += weight(contents); /*