Container

From NetHackWiki
(Redirected from Bag)
Jump to: navigation, search

A container is one of the following items:

Each can store an unlimited number of items (objects or money), but may become too heavy to lift as a consequence. You can open an unlocked container by using the #loot command.

Even though the bag of tricks is defined with the `CONTAINER` macro in objects.c, it cannot actually store items in vanilla NetHack.

A statue can also function as a container; this causes messages like, "The statue of the Foo is empty."[1] The contents correspond to the inventory of that monster before it was stoned. Some statues are generated with spellbooks inside.

The floor and ice are also technically containers, and can store buried items (e.g. under a randomly generated headstone). These items can be accessed by digging a pit.

General properties of containers

As long as a container is not destroyed or polymorphed, all its contents stay unchanged, protected from any magical or physical influence, with four exceptions:

  • Rot. Only the ice box preserves eggs and corpses from (further) rotting, in other containers they rot as usual. Furthermore, trolls will resurrect in containers, unless the container is locked.
  • Water. If you get into or under the water without wearing a oilskin cloak, only a non-cursed oilskin sack, a chest, an ice box, or a large box completely protects its contents from the water damage. Other containers offer only partial protection.
  • Fragile objects. If a container is kicked, thrown, or dropped from height, fragile objects in it may break.
  • Opening a cursed bag of holding. Each time you do it, some of its contents may vanish.

In particular, containers completely protect their contents from fire, cold, shock, cancellation, being stolen or picked up by monsters, being identified, and changing their BUC. There is no monster in the game that can access containers' contents (but see below for gelatinous cubes).

When you carry a container, its contents do not take up slots (letters) in your inventory. Therefore, you can normally carry only 52 object stacks in your main inventory, but with a container, you can carry an unlimited number of objects.

If a container is trapped, opening it manually will trigger the trap.

The unique items cannot be placed into containers. The cheap plastic imitation of the Amulet of Yendor can, however; this is commonly used to determine whether an Amulet is the real thing.

All of the containers except ice boxes can be eaten by gelatinous cubes; the contents will be engulfed but unharmed. They can be found on the cube's corpse. If you are polymorphed into a gelatinous cube, you can eat these containers only if they are empty.

When a container is polymorphed (even to another container, or even to the same container), all of its contents are destroyed.

Containers within containers

Generally, containers may contain other containers. However, there are exceptions.

  • Large boxes, ice boxes and chests are too big to fit into any other container.
  • If you put a bag of holding, bag of tricks, or wand of cancellation into a bag of holding, the bag will explode, destroying all its contents including the item that caused the explosion.

Attempting to place a container into itself yields the message "That would be an interesting topological exercise."

Generation

Containers are generated uncursed, with the contents as described below.

Containers will not be generated containing tools, weapons, armor or rocks. Containers in your starting inventory will be empty.

If the container can be locked, then there is an 80% chance that it will be generated locked and, independently, a 10% chance that it will be trapped.

Container Contents Lockable Probability
sack 0-1 items No 3.5%
large box 0-3 items Yes 4.0%
chest 0-5 items Yes 3.5%
ice box 0-20 corpses No 0.5%
bag of holding 0-1 items No 2.0%
bag of tricks 1-20 charges No 2.0%
oilskin sack 0-1 items No 0.5%

Tools can be generated in the main dungeon (8% of all objects) and Gehennom (12% of all objects). Each tool has the given probability of being a container.

Quantum mechanics may carry a large box containing a housecat named Schroedinger's Cat.

Items generated in a container (other than an ice box) will each be one of the following types:

Type Probability
gem or stone 18%
food 15%
potion 18%
scroll 18%
spellbook 12%
gold 7%
wand 6%
ring 5%
amulet 1%

Weapons, armor, and tools (including other containers) will never be generated in a container. Gold generated in containers will be 2.5 times the usual amount. Gemstones, glass, luckstones, and loadstones can all be generated, but flint stones, touchstones, and rocks cannot. A wand of cancellation will never be generated in a bag of holding.

Unlocking

To unlock a locked container, you can:

  • Apply an unlocking tool to it.
  • Zap a wand of opening at it.
  • Kick it. Because this often destroys some of the items (e.g. potions and glass items) inside, it's not the best method.
  • Cast a spell of knock at it
  • Force the lock with the currently-wielded weapon. Using a blunt weapon (such as a war hammer, staff, or mace) exercises Strength but risks destroying the container and/or its contents. Using a sharp weapon (such as a dagger, sword, or axe) exercises Dexterity but risks destroying the weapon. Artifact weapons are much less likely to break. Cursed weapons will never break, preventing locks from being used to get rid of them.

Usually, you will find enough disposable uncursed orcish daggers to force with until you get an unlocking tool. If no other options are available, you could use a junk artifact such as Sting, but chest contents in the early game aren't usually worth risking a good weapon or creating Sting.

Messages

You succeed in unlocking the <container>.
You successfully applied an unlocking tool.
Klick!
You unlocked it magically, with either the spell of knock or a wand of opening.
THUD!
You kicked it and didn't open it.
THUD! The lid slams open, then falls shut.
It wasn't locked, and you kicked it open.
You break open the lock!
It was locked, and you kicked the lid open.
You hear a muffled shatter.
You kicked it, and at least one breakable item inside was destroyed.
You hear a muffled cracking.
You kicked it, and at least one egg inside was destroyed.

Breakable items

If a container is kicked, thrown, or dropped from a height, fragile contents (any item with the random description "glass", all potions, mirrors, eggs) may be destroyed. Pieces of worthless glass do not break.

When glass objects in a bag, large box, or chest break, you hear a muffled shatter. An egg gives a muffled cracking when it breaks. You will lose that object and will not know what it was.

If a mirror in a box is destroyed through your actions, you will still incur a Luck penalty. However, mirrors and other tools are never randomly generated inside boxes.

Prior to NetHack 3.2.0, a popular technique for identifying worthless glass was called "kickboxing". One would gather a large pile of gems, name all of them "fake red" or whatever color, dump them in a box, and then repeatedly kick the box until no more muffled shatters were heard. One would then retrieve the remaining gems and un-name them. In this way, glass of all colors could be identified. Starting with NetHack 3.2.0, worthless glass no longer breaks, so kickboxing no longer works.

Variants

Iron safe

This is a container added to SporkHack (and later to UnNetHack). It is possible to open it using a wand of opening, spell of knock or stethoscope.

Magic chest

In DynaHack, magic chests are dungeon features (not items!) that are placed at fixed places in the dungeon. They share their content, so putting items in in one place makes them available for looting in all other magic chest locations[2].

In NetHack Fourk, magic chests generally work as they do in DynaHack, except that it already has items in it when you first open one, somewhat akin to a "secondary" starting inventory.

In dNetHack, like in DynaHack, magic chests has no content in them when you open them for the first time. However, dNetHack chests have 10 slots for different compartments for those willing to categorize items. All of the compartments are shared similarly across each chest. One important difference in dNetHack is that magic chests are ordinary objects, rather than dungeon features. As a reseult, they can be wished for as long as you're not in the Planes. Note that they're heavier than the normal theoretical max capacity, but with some of the items in dNetHack that increases it further, this can be worked around. Items in a chest do not add to the weight, allowing you to theoretically carry an infinite amount of items in them if you can comfortably carry a magic chest. You can however not open them from the inventory, so they can't make a normal bag of holding fully obsolete.

References

  1. end.c in NetHack 3.4.3, line 948
  2. https://github.com/tung/DynaHack/commit/b97d99ed27123fa0717ef8368b4f0d49d815c2c8