Owned equipment for sale
Verified against the spelunky.ai port v0.1.13 on .
Owned equipment for sale is a quirk of Spelunky Classic in which a shop sells equipment the player already wears, and buying it gets him nothing.
Equipment in Spelunky Classic is worn for the rest of the game, so having one of each is all there is. But a shop doesn't know what the player has: the General Store, the Clothing Shop and the Rare Shop can all sell him a second Compass, pair of Spectacles or Gloves, and paying for it spends the money on nothing.
What happens
#The player got a Compass from Kali on level 9, and wears it. Level 10's General Store sells another, and when he picks it up, the Shopkeeper prices it: "A COMPASS FOR $5400." [1].
Why
#Each shop picks its wares at random, and for a piece of equipment it only checks that the level has no instance of it yet:
else if (rand(1,10) == 1)
{
if (not instance_exists(oCompass)) { obj = instance_create(xpos+8, ypos+10, oCompass); break; }
}scripts/scrShopItemsGen.gml:169-172, from spelunky.gmk, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC (Spelunky User License v1.1b).That keeps a level to one of each, but it never looks at global.hasCompass, or any of the other flags that say
what the player wears [2]. The Clothing Shop's and the Rare Shop's equipment are checked the same
way [3]. Paying for a ware takes the money and runs the same code as
carrying it out [4], and for equipment, that only sets its flag,
which is already set [5]. Kali's gift does it right: it skips the
equipment the player has [6].
Reproducing it
#Get a piece of equipment, then find a shop on a later level that stocks the same one. It happens in normal play, on any level after the one the equipment came from. The replay of the clip gets a Compass from Kali on level 9 (frame 1111), and level 10's General Store stocks another (1961). The player picks it up, and the Shopkeeper offers it for $5,400, though he wears one (2028); he hasn't the money to buy it [7].
In the port
#The spelunky.ai port reproduces it exactly: it's in docs/quirks.md's list of the 1.1 source's bugs [2], and the oracle's fingerprint of the replay pins the second Compass. No option turns it off.
FAQ
#- Why is a shop selling a Compass I already have in Spelunky Classic?
Shops never check what the player wears. Each piece of equipment a shop picks is stocked as long as the level has no other one lying around, so a Compass, Spectacles, Gloves or any other worn item can be on sale again on any level after the one he got it on.
- What happens if you buy equipment you already have?
The money is spent and nothing changes: buying it, or carrying it out of the shop, only marks the item as worn again, which it already was.
- Does Kali give you equipment you already have?
No. Kali's first gift is picked from the eight pieces of equipment, skipping the ones the player has, so only shops make this mistake.
See also
#References
#- Clip quirks/shop-compass-restocked
- Quirk 1 (docs/quirks.md)
scripts/scrShopItemsGen.gml:68-175objects/oPlayer1/step.gml:1377-1384scripts/scrStealItem.gml:126-170scripts/scrGetFavorMsg.gml:85-98- Replay
fidelity/replays/shop-seed-11-compass-restocked.txt