container groundwork
Move a couple of instances of container contents manipulation into their own routines. Behavior for items disappearing from cursed bags of holding isn't quite identical but is effectively the same. I think its use of stolen_value (or simply the behavior of the latter) is buggy, but I haven't tried to fix that. (Cursed bag of holding destroying a player owned bag containing shopped owned items definitely doesn't work well.)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)makemon.c 3.4 2002/02/07 */
|
||||
/* SCCS Id: @(#)makemon.c 3.4 2003/03/29 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1719,6 +1719,30 @@ assign_sym:
|
||||
mtmp->mappearance = appear;
|
||||
}
|
||||
|
||||
/* release a monster from a bag of tricks */
|
||||
void
|
||||
bagotricks(bag)
|
||||
struct obj *bag;
|
||||
{
|
||||
if (!bag || bag->otyp != BAG_OF_TRICKS) {
|
||||
impossible("bad bag o' tricks");
|
||||
} else if (bag->spe < 1) {
|
||||
pline(nothing_happens);
|
||||
} else {
|
||||
boolean gotone = FALSE;
|
||||
int cnt = 1;
|
||||
|
||||
check_unpaid(bag);
|
||||
bag->spe--;
|
||||
if (!rn2(23)) cnt += rn1(7, 1);
|
||||
while (cnt-- > 0) {
|
||||
if (makemon((struct permonst *)0, u.ux, u.uy, NO_MM_FLAGS))
|
||||
gotone = TRUE;
|
||||
}
|
||||
if (gotone) makeknown(BAG_OF_TRICKS);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* OVLB */
|
||||
|
||||
/*makemon.c*/
|
||||
|
||||
Reference in New Issue
Block a user