The stolen ware left unequipped
Verified against the spelunky.ai port v0.1.12 on .
The stolen ware left unequipped is a quirk of Spelunky Classic in which a ware carried out of a shop ahead of the player stays in his hands unworn.
Carrying a ware out of a shop unpaid angers the Shopkeeper and makes the ware the player's, and a piece of equipment, such as the Spike Shoes, goes on as if bought. But two pieces of code take the theft, the player's and the ware's, and only the player's puts it on. Whichever leaves the shop first decides it, so a ware carried out ahead of the player stays in his hands, unworn, until he picks it up again.
What happens
#In a Rare Shop on level 5 that opens to the left, the player picks up the Spike Shoes, priced at $5,200, and heads left out of the shop with them, jumping as he leaves. The Shopkeeper turns on him and fires, but the shoes, out of the shop first, stay in his hands rather than going on [1].
Out of the shop, he puts the shoes down and picks them up again, which puts them on, and then stomps a Caveman with them [2].
Why
#The player's step takes a theft when he's outside the shop's room with a ware that still has a price: it runs
scrStealItem, which puts a piece of equipment on, and angers the Shopkeeper
[3]. The ware's own step takes a theft when the ware is outside
the shop, and it only angers the Shopkeeper and makes the ware free:
// stealing makes shopkeeper angry
if (isRealLevel())
{
if (cost > 0 and forSale and not isInShop(x, y))
{
global.itemsStolen += 1;
scrShopkeeperAnger(0);
cost = 0;
}objects/oItem/step.gml:17-25, from spelunky.gmk, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC (Spelunky User License v1.1b).Once its cost is 0, the player's check no longer runs, so whichever is out first takes the theft. The ware
is held 4 pixels ahead of the player [4], but it tests where the step
before put it, while the player tests where he's just moved. Walking, at 3 pixels a step, it's out first only
when a step leaves him 1 pixel short of the room's edge; otherwise both are out on the same step, and the
player's step comes first, so the ware goes on. With the run key, faster than 4 pixels a step, the player is
always out first, and jumping out upwards, he crosses first [5]. A free ware goes on when it's picked up
[6].
Reproducing it
#Steal a piece of equipment by leaving the shop forwards so that it crosses the room's edge ahead of the player. It happens in normal play. The replay of the clips jumps out of a Rare Shop to the left with the Spike Shoes: the shoes leave the room a step before the player, so the Shopkeeper is angered (frame 1429) but the shoes stay in his hands. He puts them down (1463) and picks them up again, and they go on (1471) [7]. Running out on the ground with a Cape puts it on at once [8]. The Ankh is never for sale, so it's never left this way.
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 [5], and the oracle's fingerprint of the replay pins the theft, the unworn shoes and when they go on. No option turns it off.
FAQ
#- Why didn't the stolen Spike Shoes go on in Spelunky Classic?
They left the shop before the player did. A stolen ware goes on only if the player is out of the shop first; if the ware, held in front of him, crosses first, it's made free and stays in his hands.
- How do you put on a stolen item that stayed in your hands?
Put it down and pick it up again (down and the action key). Picking up a free piece of equipment puts it on.
- How do you steal a ware so it goes on at once?
Leave the shop ahead of it: hold the run key, which moves the player more than the 4 pixels the ware is held ahead of him each step, or jump out upwards. Walking out forwards, both usually cross on the same step, and it goes on too.
See also
#References
#- Clip rare-shop/theft
- Clip spike-shoes/stomp
objects/oPlayer1/step.gml:541-557objects/oItem/step.gml:41-42- Quirk 1 (docs/quirks.md)
objects/oPlayer1/step.gml:1297- Replay
fidelity/replays/item-seed-7-spike-stomp.txt - Replay
fidelity/replays/item-seed-35-cape.txt