NetHack / NetHack

Official NetHack Git Repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Potions of oil with wrong age

AmyBSOD opened this issue · comments

I've discovered several ways in which potions of oil can be created with their "age" field initialized improperly:

  • in mkobj.c, if the horn of plenty calls "obj->otyp = rnd_class(POT_BOOZE, POT_WATER);" and that rolls oil, it doesn't set obj->age to 400
  • in zap.c, when polypiling potions and the resulting potion happens to be polymorph, it's rerolled: "otmp->otyp = rnd_class(POT_GAIN_ABILITY, POT_WATER);" and once again, if that rolls oil it doesn't set otmp->age to 400
  • in potion.c, random alchemy can call "obj->otyp = otmp->otyp;" and if otmp happens to be POT_OIL, once again obj doesn't get the age set to 400

While this cannot be exploited to get a very long-lasting oil lamp (the refilling code caps the resulting fuel at 1500), it can result in a potion of oil that lasts for tens of thousands of turns, because the improperly initialized potion will have its "age" value set to the amount of turns at its creation.

Fix available here: SLASHEM-Extended/SLASHEM-Extended@651460de