Skip to content

Commit

Permalink
prevent weightless statues
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
PatR committed Jul 12, 2023
1 parent 4fc96b0 commit dbd39f2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
3 changes: 2 additions & 1 deletion doc/fixes3-7-0.txt
Original file line number Diff line number Diff line change
@@ -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
-----------------------------------
Expand Down Expand Up @@ -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
Expand Down
26 changes: 21 additions & 5 deletions src/mkobj.c
Original file line number Diff line number Diff line change
@@ -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. */
Expand Down Expand Up @@ -1837,11 +1837,27 @@ weight(struct obj *obj)
}
if (Is_container(obj) || obj->otyp == STATUE) {
struct obj *contents;
register int cwt = 0;

if (obj->otyp == STATUE && obj->corpsenm >= LOW_PM)
wt = (int) obj->quan * ((int) mons[obj->corpsenm].cwt * 3 / 2);
int cwt;

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);
/*
Expand Down

0 comments on commit dbd39f2

Please sign in to comment.