supply chest fixes for "odd encumbrance behavior"
Changing the quantity to 2 (50:50 chance) when creating a potion of
healing (also 50:50 chance for each attempt) to place inside a supply
chest wasn't updating the potion stack's weight, resulting in the odd
encumbrance behavior that was reported last December.
Taking the stack out of the container doesn't fix the weight but
drinking one of the potions splits the stack of 2 into two stacks
of 1 and does update the weight for both. That gives the hero higher
encumbrance when the formerly weightless one has its proper weight.
Finishing drinking the potion uses it up, removing second potion's
weight again. When below an encumbrance threshold by the weight of
one potion or less, player will see encumbrance increase and then
decrease, with healing message given before both due to sequencing.
Supply chests weren't having their own weight updated when they were
populated, so would behave as if empty if hero carried them around.
Removing something, breaking something by kicking the chest, or adding
something would update its weight to match its contents.
I also noticed a refutation (or should that be rebuttable?) to my own
remarks in this:
| commit cd91d0630b
| Author: PatR <rankin@nethack.org>
| Date: Sat Dec 30 17:10:39 2023 -0800
|
| github issue #1180 - humans and murder
|
| Issue reported by Umbire: reviving a human corpse into a human
| monster and then killing it entails murder penalty even when it is
| hostile.
|
| This is probably a non-issue. Human monsters tend to not leave
| human corpses, they leave shopkeeper corpses or sergeant corpses
[...]
Dead fake hero corpses placed at trap locations on early levels are
leaving plain human|dwarf|elf|gnome|orc corpses rather than fake
player monster ones (which are always human but resurrect as player
monsters rather than as plain humans), so there are more plain human
corpses now than there were in 3.6.x or early to-be-3.7. I've added
a comment about the situation.
This commit is contained in:
25
src/mkobj.c
25
src/mkobj.c
@@ -220,6 +220,8 @@ mkobj_erosions(struct obj *otmp)
|
||||
}
|
||||
}
|
||||
|
||||
/* make a random object of class 'let' at a specific location;
|
||||
'let' might be random class; place_object() will validate <x,y> */
|
||||
struct obj *
|
||||
mkobj_at(char let, coordxy x, coordxy y, boolean artif)
|
||||
{
|
||||
@@ -230,8 +232,12 @@ mkobj_at(char let, coordxy x, coordxy y, boolean artif)
|
||||
return otmp;
|
||||
}
|
||||
|
||||
/* make a specific object at a specific location */
|
||||
struct obj *
|
||||
mksobj_at(int otyp, coordxy x, coordxy y, boolean init, boolean artif)
|
||||
mksobj_at(
|
||||
int otyp,
|
||||
coordxy x, coordxy y,
|
||||
boolean init, boolean artif)
|
||||
{
|
||||
struct obj *otmp;
|
||||
|
||||
@@ -240,12 +246,13 @@ mksobj_at(int otyp, coordxy x, coordxy y, boolean init, boolean artif)
|
||||
return otmp;
|
||||
}
|
||||
|
||||
|
||||
/* used for extra orctown loot */
|
||||
struct obj *
|
||||
mksobj_migr_to_species(
|
||||
int otyp,
|
||||
unsigned int mflags2,
|
||||
boolean init,
|
||||
boolean artif)
|
||||
unsigned mflags2,
|
||||
boolean init, boolean artif)
|
||||
{
|
||||
struct obj *otmp;
|
||||
|
||||
@@ -371,6 +378,7 @@ mkbox_cnts(struct obj *box)
|
||||
}
|
||||
(void) add_to_container(box, otmp);
|
||||
}
|
||||
/* caller will update box->owt */
|
||||
}
|
||||
|
||||
/* select a random, common monster type */
|
||||
@@ -848,8 +856,7 @@ unknow_object(struct obj *obj)
|
||||
obj->known = objects[obj->otyp].oc_uses_known ? 0 : 1;
|
||||
}
|
||||
|
||||
/* do some initialization to a newly created object.
|
||||
object otyp must be set. */
|
||||
/* do some initialization to newly created object; otyp must already be set */
|
||||
static void
|
||||
mksobj_init(struct obj *otmp, boolean artif)
|
||||
{
|
||||
@@ -1124,7 +1131,7 @@ mksobj_init(struct obj *otmp, boolean artif)
|
||||
otmp->corpsenm = rndmonnum();
|
||||
if (!verysmall(&mons[otmp->corpsenm])
|
||||
&& rn2(level_difficulty() / 2 + 10) > 10)
|
||||
(void) add_to_container(otmp,
|
||||
(void) add_to_container(otmp, /* callber will update owt */
|
||||
mkobj(SPBOOK_no_NOVEL, FALSE));
|
||||
}
|
||||
/* boulder init'd below in the 'regardless of !init' code */
|
||||
@@ -2578,6 +2585,10 @@ add_to_minv(struct monst *mon, struct obj *obj)
|
||||
/*
|
||||
* Add obj to container, make sure obj is "free". Returns (merged) obj.
|
||||
* The input obj may be deleted in the process.
|
||||
*
|
||||
* Caveat: this does not update the container's weight [possibly to
|
||||
* prevent that from being recalculated repeatedly when adding multiple
|
||||
* items].
|
||||
*/
|
||||
struct obj *
|
||||
add_to_container(struct obj *container, struct obj *obj)
|
||||
|
||||
Reference in New Issue
Block a user