Polypiling

From NetHackWiki
Revision as of 19:18, 5 October 2011 by 130.127.112.144 (talk) (SLASH'EM: Put in time to unpolymorph.)
Jump to navigation Jump to search

Polypiling is the action of polymorphing a pile of items in hopes of getting some useful items as a result. Objects polypiled are often referred to as polyfodder. The polyfodder often consists of junk. Polypile comes in book, wand, and potion forms. The spell and wand supply a beam with a random range between 7 and 13 (long enough to hit 3 to 6 piles if they are all in line and contiguous and you are adjacent to the first) so you can work on several piles at once but keep the things you want morphed closest. The potion works on one item stack at a time, the item stack you dip into it.

While the main reason to read this page is probably to learn about polypiling, everything here applies to any polymorphed item, not just those you deliberately polymorph for profit.

Polymorphed items do not change item class. Potions will always yield potions, scrolls will yield into scrolls, etc. Unicorn horns are especially popular polyfodder because they may polymorph into other magical tools for instance magic markers. Another useful thing to do if you gain polymorph in the early game is to polypile spellbooks.

When considering polypiling it is important to distinguish stacks of items, which are all of one type, e.g. "4 blessed scrolls of blank paper", from piles of items, which are all of the items on one square. The terms stack and pile will be used rigorously on this page.

Polypiling has its drawbacks. Polyfodder may be destroyed, and golems may be generated. See the next section for more details, the exact mechanics of item destruction are rather complex, but understanding them is important if you want to get the most out of your resources (wall-clock time, game time, power, wands, potions, and polyfodder, that is).

Golem creation can help identify worthless glass: polypiling worthless glass can produce glass golems, which are guaranteed to drop additional worthless glass when they die. If any of the gems it drops are unknown to you, then you've just identified a new color of glass. This is usually a net loss of material, so use pieces of glass, the fake gems, not other glass items like wands.

When Polymorphing wands and spellbooks, their quality degrades. A spellbook will act as if it had been read once more. If the book's combined read/polymorph-count is four or more and it is a spell you already know, you will be told that the book is too faint to read anymore; if you do not know the spell, you can read it once to learn the spell but it will become "too faint" immediately thereafter. The only way to "cure" spellbooks too faint to be read anymore is to write a new spell on them with a magic marker.

Likewise, a wand may count as if it had been recharged, increasing the chance of an explosion if you attempt to recharge it; thus, it is not generally worthwhile to polypile empty wands, even if they become something worth charging, the chances of the new wand exploding instead of charging are already higher than normal. The chance of a wand's charge counter being incremented by polymorphing it is x/7 where x is number of the times the wand has been recharged[1]

The recharge count of tools is not effected by polymorphing them, unless the tool becomes a magic markers, in which case its charge counter will be set to 1.

Polypiling items that belong to a shopkeeper can anger the shopkeeper.

Probability of item loss and golem generation for wand and spell

The polymorph beam generated by the wand and spell acts on each pile separately.[2]

First, there is a chance for each item stack on the pile to "shudder" (undergo a system shock).[3][4]

The probability of an item stack undergoing system shock depends on its BUC status, unless it is a wand:[5]

  • Wands: 1/3
  • Blessed other item: 1/12
  • Uncursed other item: 1/8
  • Cursed other item: 1/3

Note that stacks of more than 4 items have double the odds of system shock for those stacks only.[6]

The number of items in the stack destroyed by a system shock is given by d(number of items in stack - 1), unless the stack contains only one item, in which case it is guaranteed to be destroyed.[7]

For each item stack in the pile that undergoes a system shock, there is a chance for a golem to be created. For each item in a shuddering stack (counting those items destroyed by the shock itself) there is a 1/(luck + 45) probability of creating a golem.[8] No more than one golem can be created per pile.[9] However, even after Nethack has decided to create a golem, additional stacks in the pile can shudder. A 1/(luck + 45) chance for each item in the stack gives a (1 - ((luck + 44)/(luck + 45))^(stack size)) chance of a golem forming from that stack. (Probability of a golem NOT forming, raised to the number of times it must not form, subtracted from one to yield the probability of it forming.)

If an item stack shuddered, even if some of the items that were in the stack remain, it will NOT be polymorphed. The rest of the stacks in the pile still have a chance to be polymorphed.[10][11][12][13]

For any stack that did not shudder, the process continues. There is a (number of items in stack/1000) probability that the entire stack merges into a single item.[14]

The actual polymorph is now performed. See the next section for exactly what your item stack will be turning into.

This process is repeated for each item stack in the pile.

If a golem is created from ANY stack in a pile, then that golem can absorb material (read: destroy) additional item stacks in the pile. Not that the material absorbed (destroyed) by the golem is SEPARATE from that destroyed by the original system shock(s). If, after every stack has been polymorphed, zero or one item remains in the pile (due perhaps to bad system shocks), golem creation is aborted, if it had been planned at all. According to a comment in the source "no golems if you zap only one object -- not enough stuff", though note that the comment isn't entirely accurate. It's possible to zap several items, reach this point in the code, and have the material check fail because all or all but one of the items were destroyed by system shocks.[15]

The golem will attempt to absorb a number of individual items (not item stacks, "4 scrolls" counts for 4, not 1), equal to its weight.[16][17][18] Only items that are made of the same material as the item stack who's shuddering cause the golem to form are eligible for absorption. E.g., if a mithril coat shudders and results in an iron golem, that iron golem will absorb other mithril items on the pile, but leave iron items untouched (though some of the iron items may also have shuddered). Each eligible item stack has a 1 in (golem weight + 1) chance to avoid being absorbed. Note that, given the high weights of golems, 400 for straw and paper up to 2000 for iron, it is highly unlikely that ANY eligible item will survive this process. Also note that this absorption occurs after the items have been polymorphed. If a mithril item shudders, creating an iron golem, and several other mithril objects on the pile are polymorphed into other materials, e.g. leather coats or iron helmets, they will NOT be absorbed, though any leather coats or iron helmets polymorphed into mithril items WILL be absorbed. [19]

Since each stack in a pile is polymorphed separately, from the most recently dropped item out to the item dropped longest ago, and the type of golem is determined by the material of the first item stack to shudder and result in golem creation, you can influence what material the golem is made of. The most recently dropped items are more likely to be the ones to decide golem material choice. If you want paper golems instead of iron golems, drop the iron items first, and then the paper items last. Since paper golems drop the most useful material--paper--and iron golems drop worthless iron chains, it's probably a good idea to do this. In fact, it is even better to add several stacks of rocks on top, causing the creation of a clay golem instead and conserving all your other items, because rocks are generally overabundant.[20][21][22]

This process, from the start of this section of the page, is repeated for each pile hit by the beam.

The invocation artifacts and the Amulet of Yendor cannot shudder, polymorph, or be absorbed by forming golems. Normal artifacts have a 95% chance resist. If this 95% chance fails, they are polymorphed just like every other item, first undergoing a shuddering check and then, if they aren't destroyed, undergoing a polymorph to a random non-artifact weapon. Normal artifacts, however, have NO resistance to being absorbed by a forming golem. Excalibur may be mostly safe from shuddering or polymorphing atop that pile of iron junk, but if an iron golem forms it is virtually guaranteed that Excalibur will be absorbed (destroyed).[23]

In other words, there are 3 ways polyfodder can be destroyed:

  • Shuddering, which chance is decreased by blessing, polymorphing items other than wands, and keep the size of individual stacks under 4.
  • Merging, which chance is reduced by lowering the size of individual stacks.
  • Absorption into forming golems, which chance is reduced by:
    • Increasing your luck, reducing the chance of golem formation.
    • Reducing the size of the individual item stacks, reducing the chance of golem formation.
    • Reducing the number of item stacks on the pile, reducing the number of opportunities for golems to form.
    • Limiting the number of items on the pile that are made of the same material, reducing the number of items a forming golem can absorb.
      • In particular, it is desirable to have the items on the top of the stack, the ones you drop last, be of a different material than the most valuable items, thus making potential golems less likely to be of the same material as those valuable items, and therefore less likely to absorb them.

Probability of item transformation

When polymorphing a magical object, the game will try to change it into another random magical object, re-trying up to two times if the replacement would be non-magical[24]. The third item generated will be used, regardless if it is magical. The reverse is true when polymorphing a non-magical object. The upshot is that a magical object has a significantly higher probability than a non-magical object of turning into another magical object. So don't expect many magic markers from polypiling pick-axes and mirrors; you will have much better odds polypiling unicorn horns. The exceptions are potions of water, blank scrolls, blank spellbooks, and wands of nothing, all of which have a high chance of becoming more-useful items of the same type.

Class Magical -> Non-magical Non-magical -> Magical
Armour 54% 0.60%
Gem 92% negligible
Potion 1.70% 41%
Spellbook negligible 95%
Tool 60% 0.30%
Wand negligible 93%

Forbidden items

The following items cannot be produced by polymorph:

Additionally, wands, potions and spellbooks of polymorph cannot be polymorphed. Artifacts have a 95% chance to resist, but can eventually be polymorphed into normal items. Stacks of more than four valuable gems will never be created. Invocation artifacts and the Amulet of Yendor cannot be polymorphed at all, nor can they be absorbed into forming golems or shuddered.

Strategy

Polypiling is often used to get ascension kit armor (and completed by wishing). Therefore, you might want to collect all those elven cloaks and boots in the game.

Polypiling is most often used by conduct players who need certain items: It can substitute for wishing, prayer/sacrifice benefits, or literacy, and it can be done relatively safely. Generated monsters offer an almost unlimited supply of polyfodder. However, polypiling is time-consuming and tedious. Generally, it is not worth it unless you are trying for conducts, or unless you are looking for many items at once.

Over preparing is the other common reason for polypiling. This goes for many first ascenders, pacifist characters who want the most protection, or even an attempt to get an absurdly high score by polypiling rocks into gems.

General Tips

  • Never handle both polyfodder and items you want to keep in your main inventory at the same time, and never ever drop anything useful on your polypile line. People have wondered where their bag of holding with all the artifacts went.
  • Even if you do not care about polyfodder loss, #name rocks to get stacks of at most four. There is a limit to how many gems can be created.
  • Max out your Luck to minimize golem creation. That reduces the total material lost. This is particular useful for larger stacks.
  • Configure autopickup exceptions to pick up good morphs and your want-to-keeps from the pile.
  • Polypile your items in a general store to help identify good morphs.
  • Familiarize yourself with the ways polyfodder is lost, in order to determine how much risk to take on, given your available polyfodder and the amount of polypile sources you have available to you. Your patience is also a factor, perfect optimization is time consuming and tedious.

Preparing

  • To minimize loss, it is a good idea to mass-bless magical polyfodder, which is much less abundant than ordinary junk. Potions and scrolls can be cancelled so they will stack, and then dipped in holy water. Name and separate them into stacks of at most four items before polymorphing. Only armor and weapons (and wands) retain their enchantment; these should be cancelled if negative before blessing. A large stack of darts can be enchanted to +7 in one go and then polypiled individually for silver weapons or the future Excalibur etc as side benefit. Magical armor and tools tend to become non-magical rather than shuddering, so there is no point blessing them.
  • Non-stackables, such as rings, require more work to bless. Often, it is not worth the costs. The most efficient way is with a blessed, confused scroll of remove curse: In a safe location, pick up as much polyfodder as possible but carry no other uncursed items. Then confuse yourself, read a blessed scroll of remove curse, end confusion, and mass-uncurse cursed items via the spell of remove curse at a skilled level. The light blue aura boon when carefully praying on an altar or even another scroll can also uncurse your entire main inventory. This procedure yields 12.5 blessings per scroll on average.
  • Unless you will need only one read, name spellbooks individually how often you have read them, and sort them accordingly. Under each pile you intend to polymorph, engrave that number. Any nameless books after the polymorph will count as read one more time. Keep in mind how often you will have to re-read the spells you get.
  • Sort polyfodder by BUC status so you won't have to re-test after polypiling.

When to Polypile

Main article: Common polymorphs
  • If a game has been unforgiving, a good time to consider polypiling is when there are many things needed at once: the odds of getting at least one of them is improved. For example, if you're looking for a magic marker in particular, getting a tinning kit would be seen as a waste. However, if you were looking for both a magic marker and a tinning kit, the effective odds of getting something you want go up. If you're looking for a horn of plenty, a magic marker, a pair of lenses, and a tinning kit all at once, polypiling unicorn horns begins to look increasingly attractive.
  • Potions are attractive to polymorph, due to the ease of creating fruit juice and water, and mass blessing them. Furthermore, with the help of alchemy, a good third of the available potions are useful in some way. While you may not get the potion of enlightenment, or gain level, that you wanted, you are likely to end with various healing potions, levitation, etc, that can be quickly used to work towards what you really want.
  • Scrolls are commonly polymorphed for similar reasons. Here, part of the motivation is in doing away with magic markers. It adds a great deal of randomness to the mix, but scrolls are still cheaper than marker charges.
  • Magical tools. Unicorn horns are a common fodder, due to the large number of useful magical tools, and the abundance of unicorn horns. (For farmers: revived unicorns have a 5% chance of leaving another horn.) Certainly, the magic marker is generally what most would go for, but in the attempt you might find other goodies: A horn of plenty, which spawns potion you can polypile. A fire/frost horn may also be of help, as may a magic harp or magic flute. This is especially helpful to Tourists or neutral players with the PYEC.
  • Magical armor. This mostly to finish off an ascension kit, and most often using the various abundant elven equipment as fodder. This is mostly only useful to (wishless) conduct players, as the castle's guaranteed five wishes are good enough to get all the missing types of armor; furthermore, its armor stores might contain missing pieces.
  • A common trick is to polymorph elven armor, which can safely be enchanted to +7, into a +7 T-shirt. The number of +7 armors isn't terribly prohibitive: the blessed scroll of enchant armor (to get to +7) will also bless the armor and reduce the odds of shuddering.
Confidence Base Chance 25% 50% 75% 95%
Polymorphs 1 in 100 28.62 68.97 137.94 298.07
Shuddering 1 in 12 3.31 7.97 15.93 34.43
Armors needed (est.) 3.59 8.66 17.32 37.41
  • Rings. This mostly to finish off an ascension kit, and namely, to get a ring of levitation, slow digestion, or even free action if for some reason the RNG wasn't benevolent enough to give the player one. But usually you find those even before the Medusa level. Most other rings are only useful in specific situations, polypiling or not.
  • One cheesy trick is to polypile for rings of protection or increase damage, with the intention of eating them. It's possible to get a ridiculously low AC or ridiculously high damage. The former is pointless, other than to sound impressive, because you can reasonably get to -40AC without such mind-numbing busywork, and that is enough to make even a minotaur barely scrape the polish on your armor. The latter may be for Death farming to a ludicrously high score.
  • Spellbooks, if you are happy with any random book and accept you cannot re-read it. Early in the game, when you don't know many spells yet, you can get dozens of new ones out of a few spellbooks. Due to a bug in NetHack, a book will never be "too faint to be read anymore" if that adds a spell to your repository. This has proven popular among speed runners. Newbies might carry books and rings along (unencumbered) into a Minetown shop in the early game and polymorph there.
  • A large pile of junk armor. Shirts are annoyingly rare in the main dungeon, but other armors are not. Zapping a wand of polymorph at that 15 pages pile of items in Fort Ludios is probably the easiest way to get a shirt outside of wishing or playing a Tourist.

When Not to Polypile

  • Wands are generally not worth it. This is mostly because by the time the player has a serious stash of wands, and abundant means to polymorph objects (read: the spell), there is only one wand seriously worth going after: death. But this late into the game, there are only four monsters that it matters on—Pestilence, Famine, Rodney, and the High priest of Moloch. Likely (but not necessarily), you already have enough wands of death to deal with those enemies. Also, polymorped wands will more likely explode if charged again.
  • In the midgame, however, it may be worth it. If the player doesn't quite have enough items to make a full polypile line, a square of scrap wands may not make anything that you need, but it might make a wand you've yet to identify (if it has charges left). It may also be that you need a wand's special properties—for example, a wand of fire's ability to engrave a permanent Elbereth square.
  • Specific Spellbooks. If you only need one specific spellbook (or a book of polymorph to start with), there are better methods than polypiling: Wizards with sufficient Luck can write one using a magic marker. Anyone willing to do the altar work can get books from their god, especially the last few ones you do not yet know. For spells you do know, polypiling is terrible, as it takes only a few rounds of polymorph to make even previously unread books "too faint to read".
  • There are better ways to get various other items. For example, a trident, while normally quite rare, can be found in the death drop of a salamander or a horned devil. A silver saber, very desirable for twoweapon combat, can be found in the inventory of the Minetown watch, or the various captains that show up in the Castle.
  • Items not generated randomly aren't available from polypiling, e.g. athames.

After these preparations, individually name stackables to separate them, and make six piles in a straight line, each pile containing a good mix of different types of material. These can be polymorphed in one zap. If you only have a limited number of polymorphs, such as from a wand, you could add more items, but you probably want to wait for the spell.

SLASH'EM

In SLASH'EM, polymorphed items (and monster) can eventually revert back to their original form in 500–999 turns [29]. The in-game term for this, which can only be seen in wizard mode, is "hazy." Hazy items, however, can be "fixed" by dipping them in a potion of restore ability. The transmutation limits the usefulness of polypiling somewhat, as obtaining permanent items requires a commensurate supply of said potions. However, polypiling is still just as useful to obtain items that can be useful right away or relatively soon; for example, a polypiled magic marker can be immediately used to write a few scrolls, and then allowed to transmute back after it is empty. Also, one can use the transmutation property to one's advantage when polypiling magical items: if they turn into non-magical items, one can simply wait for them to revert, and try again.

Code

bhito in zap.c is the root of item polymorphs from the spell and from the wand. It is called for each stack of items a polymorph zap hits by bhitpile. First it refuses to poly polymorph sources, and allows items to resists [30] It calls obj_shudders to check for system shocks [31] and calls do_osshock to perform them [32]. Finally bhito calls polyobj to actually transform the stack. [33].

do_osshock determines whether or not to generate a golem, and after all the stacks in the pile have been polymorphed by repeated calls to bhito, bhitpile calls create_polymon to actually generate the golem.

If create_polymon is called, it possibly creates the golem and then, if the golem was created, in turn calls polyuse to consume additional polyfodder.[34]

References

  1. Zap.c#line1333rn2(recharge count) to see if polymorph increments charge counter on wands.
  2. zap.c#line2744bhit calls bhitpile for each square/pile
  3. zap.c#line1773bhitpile goes through each stack separately, calling bhito--to which a function pointer has been passed in as fhito--to perform the actual polymorph
  4. zap.c#line1515bhito calls object_shudders on just one object, and object_shudders does not inspect other items on the square, i.e. in the pile
  5. zap.c#object_shuddersobj_shutters determines whether a given stack will shudder.
  6. zap.c#line1016object_shudders doubles shuttering chance for stacks with more than 4 items
  7. zap.c#line1169do_osshock determines how many items in the stack to destroy.
  8. zap.c#line1162do_osshock decides whether or not it should make a golem
  9. zap.c#line1160poly_zapped is a file level static variable, visible to every function in zap.c, -1 means no golem created yet, else it contains the material of the item who's shuddering resulted in golem creation. do_osshock checks that its -1 before trying to make a golem.
  10. zap.c#line1508if the obj shuddered, bhito exits WITHOUT polymorphing the object.
  11. mkobj.c#splitobjIf any items remained after the shuddering occurred, they will have been reinserted in the item tracking linked list, but they will have been inserted before the deleted ones, and bhitpile will not return to them.
  12. zap.c#line1735bhitpile decides the next object before bhito has a chance to call do_osshock and destroy/split item stacks.
  13. zap.c#line1521poly_obj is called AFTER do_osshock has finished with the stack.
  14. zap.c#line1331poly_obj decides whether or not to merge the items in the stack
  15. Zap.c#line1076golem creation aborted for not enough items
  16. zap.c#line1140mons[pm_index] is a permonst structure, defined in permonst.h, the cwt field is the weight of the monsters corpse, which is defined for golems even though they leave no corpses.
  17. zap.c#line1035polyuse doesn't stop absorbing items until minwt is 0, minwt is initialized to golem corpse weight
  18. zap.c#line1054not that polyuse is subtracting the QUANTITY of objects from minwt, not the WEIGHT of those objects. iron golems will absorb up to 2000 iron items
  19. zap.c#line1043which items are eligible for absorption; note that "mat" is the material of the shuddered item stack NOT of the golem created
  20. zap.c#line1160once Nethack decides to create a golem it records the shuddering stack's material and stops trying to create golems for additional stacks.
  21. zap.c#line1733bhitpile goes through objects forwards through the list
  22. mkobj.c#line1115place_object adds dropped objects to the front of the list, where bhitpile will encounter them first.
  23. zap.c#line1038resistance check only serves to protect the invocation items and the amulet
  24. Zap.c#line1215
  25. zap.c#line1319 (no magic lamps)
  26. zap.c#line1329 (no wands of wishing or polymorph)
  27. zap.c#line1338 (no potions of polymorph)
  28. zap.c#line1343 (no spellbooks of polymorph)
  29. SLASH'EM 0.0.7E7F2/timeout.c#line455
  30. Zap.c#line1503bhito does a resistance check for each item
  31. Zap.c#line1515bhito checks for system shocks
  32. Zap.c#line1518bhito performs a system shock
  33. Zap.c#line1521bhito calls polyobj
  34. zap.c#line1140create_polymon calls polyuse

External links