bag of tricks, horn of plenty, #tip (trunk only)
<Someone> reported that he applied an unID'd bag and it became
discovered as a bag of tricks even though a spellbook appeared on the floor
next to him rather than having a monster show up (the monster was a mimic).
Suppress the bag discovery unless you can see or sense a monster appear.
(This doesn't really achieve much for most players, who'll recognize the
bag because they know that only one type of container doesn't prompt to
take things out and/or put things in, but I think it does make sense.)
While mucking with bag of tricks I decided that to be consistent with
the behavior of other containers, the #tip command should release all the
monsters in the bag instead of just one.
And after doing that, I realized that horn of plenty ought to behave
much the same, so #tip will operate on it now. However, it won't be listed
as a likely candidate in the "which item?" prompt unless/until it has been
discovered. (Attempting to empty any other type of horn yields "nothing
happens", same as for a horn of plenty with no charges left.) Emptying a
horn of plenty in a shop can be extremely verbose, but I don't think that
qualifies as a bug and don't currently have any plans to alter it.
This commit is contained in:
29
src/pickup.c
29
src/pickup.c
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)pickup.c 3.5 2006/02/03 */
|
||||
/* SCCS Id: @(#)pickup.c 3.5 2006/06/17 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -2502,7 +2502,7 @@ dotip()
|
||||
if (!cobj) return 0;
|
||||
|
||||
/* normal case */
|
||||
if (Is_container(cobj)) {
|
||||
if (Is_container(cobj) || cobj->otyp == HORN_OF_PLENTY) {
|
||||
tipcontainer(cobj);
|
||||
return 1;
|
||||
}
|
||||
@@ -2555,6 +2555,9 @@ struct obj *box; /* or bag */
|
||||
{
|
||||
boolean empty_it = FALSE;
|
||||
|
||||
/* caveat: this assumes that cknown, lknown, olocked, and otrapped
|
||||
fields haven't been overloaded to mean something special for the
|
||||
non-standard "container" horn of plenty */
|
||||
box->lknown = 1;
|
||||
if (box->olocked) {
|
||||
pline("It's locked.");
|
||||
@@ -2566,10 +2569,24 @@ struct obj *box; /* or bag */
|
||||
nomul(-1);
|
||||
nomovemsg = "";
|
||||
}
|
||||
} else if (box->otyp == BAG_OF_TRICKS && box->spe > 0) {
|
||||
/* apply (not loot) this bag; uses up one charge */
|
||||
bagotricks(box);
|
||||
box->cknown = 1;
|
||||
} else if (box->otyp == BAG_OF_TRICKS || box->otyp == HORN_OF_PLENTY) {
|
||||
boolean bag = box->otyp == BAG_OF_TRICKS;
|
||||
int old_spe = box->spe;
|
||||
|
||||
/* apply this bag/horn until empty or monster/object creation fails
|
||||
(if the latter occurs, force the former...) */
|
||||
do {
|
||||
if (!(bag ? bagotricks(box, TRUE) : hornoplenty(box, TRUE)))
|
||||
break;
|
||||
} while (box->spe > 0);
|
||||
|
||||
if (box->spe < old_spe) {
|
||||
/* check_unpaid wants to see a non-zero charge count */
|
||||
box->spe = old_spe;
|
||||
check_unpaid_usage(box, TRUE);
|
||||
box->spe = 0; /* empty */
|
||||
box->cknown = 1;
|
||||
}
|
||||
} else if (box->spe) {
|
||||
char yourbuf[BUFSZ];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user