Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#1151 closed bug (fixed (in master))

max object level generation not always enforced

Reported by: eddiegrove@… Owned by: fizzix
Milestone: 3.2.0 Keywords: items


Every so often, I find a too-deep object such as a potion of toughness at DL90+. Probably there are more such items I don't see because they are squelched. I think it is likely they come only from chests, possibly only from chests within chests. FWIW, I think an interior chest should count as 10 DLs deeper for object generation purposes.

Change History (6)

comment:1 Changed 10 years ago by magnate

  • Keywords items added
  • Milestone changed from Triage to 3.1.3

comment:2 Changed 10 years ago by magnate

  • Milestone changed from 3.2.0 to Future

Punting to Future per takkaria: this needs looking at after #1088 is fixed - unless somebody claims before then that it is not related to chests after all.

comment:3 Changed 10 years ago by magnate

  • Owner set to fizzix
  • Status changed from new to assigned

Difficult to confirm but possible with fizzix's monte carlo code.

comment:4 Changed 10 years ago by magnate

Ok, a bit of source diving (grip is a recursive grep alias which ignores .o files and other cruft):

chrisc@junior:~/workspace/angband-github$ grip make_object *
src/object/obj-util.c:		if (!make_object(i_ptr, level, TRUE, great)) continue;
src/object/obj-make.c: * We are only called from "make_object()", and we assume that
src/object/obj-make.c:bool make_object(object_type *j_ptr, int lev, bool good, bool great)
src/object/object.h:bool make_object(object_type *j_ptr, int lev, bool good, bool great);
src/generate.c:	if (make_object(i_ptr, level, good, great))
src/wizard.c:			make_object(i_ptr, level, good, great);
src/monster/monster2.c:			if (!make_object(i_ptr, level, good, great)) continue;
src/cmd2.c:			if (!make_object(i_ptr, value, FALSE, FALSE))

So, there are only five calls to make_object, one of which is wizmode object creation. The one in obj-util.c is acquirement, and the one in generate.c is for floor objects during level generation. Both these use p_ptr->depth to determine the object depth, so they cannot generate objects if the player is below their max depth.

The "level" of monster drops is the deepest of monster level and the average of monster level and current depth. So monsters CAN drop objects below their max depths: if you kill a snaga on dl98, it can drop a ring of resist fire, even though max depth for that ring is 50. This is intentional, as it provides a disincentive to seeking out easy prey at deeper levels.

The "value" of a chest is set by its pval (which is its trap level), and this in turn is set by its sval (type of chest). So a small wooden chest can only ever generate items as if on dl15, even if the chest itself was generated at dl98. This will lead to a lot of beyond-max-depth items coming out of such chests.

I suggest changing this so that the chest "value" is based on its origin_depth (i.e. the depth at which it was created), modified by its sval. So steel chests are still better than wooden chests, but wooden chests can still drop stuff vaguely near the current dlev.

comment:5 Changed 10 years ago by magnate

  • Milestone changed from Future to 3.2.0
  • Status changed from assigned to pending

Fixed in [a9c62f1]

comment:6 Changed 10 years ago by magnate

  • Resolution set to fixed
  • Status changed from pending to closed

Now in master as of [4f278ae]

Note: See TracTickets for help on using tickets.