refine pickup_thrown+pickup_stolen+dropped_nopick
If a monster picks up an item thrown by the hero, change its 'how_lost' flag from LOST_THROWN to LOST_STOLEN and pickup_stolen will be used instead of pickup_thrown to decide whether to override pickup_types and autopickup exceptions when hero eventually steps on it. If a monster picks up an item dropped by the hero, change its flag to LOST_NONE and autopickup will work normally without being overridden by dropped_nopick. If item is flagged as stolen, leave it that way.
This commit is contained in:
34
src/steal.c
34
src/steal.c
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 steal.c $NHDT-Date: 1646688070 2022/03/07 21:21:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.98 $ */
|
/* NetHack 3.7 steal.c $NHDT-Date: 1702529046 2023/12/14 04:44:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.114 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -573,17 +573,29 @@ mpickobj(struct monst *mtmp, struct obj *otmp)
|
|||||||
pline("%s out.", Tobjnam(otmp, "go"));
|
pline("%s out.", Tobjnam(otmp, "go"));
|
||||||
snuff_otmp = TRUE;
|
snuff_otmp = TRUE;
|
||||||
}
|
}
|
||||||
/* for hero owned object on shop floor, mtmp is taking possession
|
/* some object handling is only done if mtmp isn't a pet */
|
||||||
and if it's eventually dropped in a shop, shk will claim it */
|
if (!mtmp->mtame) {
|
||||||
if (!mtmp->mtame)
|
/* for hero owned object on shop floor, mtmp is taking possession
|
||||||
|
and if it's eventually dropped in a shop, shk will claim it */
|
||||||
otmp->no_charge = 0;
|
otmp->no_charge = 0;
|
||||||
/* if monster is unseen, info hero knows about this object becomes lost;
|
/* if monst is unseen, some info hero knows about this object becomes
|
||||||
continual pickup and drop by pets makes this too annoying if it is
|
lost; continual pickup and drop by pets makes this too annoying if
|
||||||
applied to them; when engulfed (where monster can't be seen because
|
it is applied to them; when engulfed (where monster can't be seen
|
||||||
vision is disabled), or when held (or poly'd and holding) while blind,
|
because vision is disabled), or when held (or poly'd and holding)
|
||||||
behave as if the monster can be 'seen' by touch */
|
while blind, behave as if the monster can be 'seen' by touch */
|
||||||
if (!mtmp->mtame && !(canseemon(mtmp) || mtmp == u.ustuck))
|
if (!canseemon(mtmp) && mtmp != u.ustuck)
|
||||||
unknow_object(otmp);
|
unknow_object(otmp);
|
||||||
|
/* if otmp has flags set for how it left hero's inventory, change
|
||||||
|
those flags; if thrown, now stolen and autopickup might override
|
||||||
|
pickup_types and autopickup exceptions based on 'pickup_stolen'
|
||||||
|
rather than 'pickup_thrown'; if previously stolen, stays stolen;
|
||||||
|
if previously dropped, now forgotten and autopickup will operate
|
||||||
|
normally regardless of the setting for 'dropped_nopick' */
|
||||||
|
if (otmp->how_lost == LOST_THROWN)
|
||||||
|
otmp->how_lost = LOST_STOLEN;
|
||||||
|
else if (otmp->how_lost == LOST_DROPPED)
|
||||||
|
otmp->how_lost = LOST_NONE;
|
||||||
|
}
|
||||||
/* Must do carrying effects on object prior to add_to_minv() */
|
/* Must do carrying effects on object prior to add_to_minv() */
|
||||||
carry_obj_effects(otmp);
|
carry_obj_effects(otmp);
|
||||||
/* add_to_minv() might free otmp [if merged with something else],
|
/* add_to_minv() might free otmp [if merged with something else],
|
||||||
|
|||||||
Reference in New Issue
Block a user