SpelunkyFan wiki

Double Jar roll

Verified against the spelunky.ai port v0.1.10 on .

The double Jar roll is a quirk of Spelunky Classic in which a Jar broken by the Whip rolls for its contents twice, so it can let out two things.

Every other way of breaking a Jar (throwing it, shooting it, blowing it up) rolls once. Whipping one gives it two chances at gold or gems, and two at a Spider or a Snake, with twice the smoke, the pieces and the sound.

What happens

#

The player cracks the Whip at a Jar. It shatters twice over in the same step: two puffs of smoke, six pieces of pot where a Jar makes three, and two treasures, a gold chunk and a big emerald [1].

A whipped jar pays out twice. The player cracks the whip at a jar. It shatters twice over in the same instant, two puffs of smoke and six pieces, and lets out two treasures, a gold chunk and a big emerald, where a jar broken any other way gives one.

Why

#

The Jar's collision with the whip breaks it itself: the sound, a puff of smoke, three pieces, and a roll down the chain of contents, a gold chunk 1 time in 3, then a nugget, the big gems, a Spider and a Snake. Then it destroys the Jar [2]:

if (rand(1,3) == 1) instance_create(x, y, oGoldChunk);
else if (rand(1,6) == 1) instance_create(x, y, oGoldNugget);
else if (rand(1,12) == 1) instance_create(x, y, oEmeraldBig);
else if (rand(1,12) == 1) instance_create(x, y, oSapphireBig);
else if (rand(1,12) == 1) instance_create(x, y, oRubyBig);
else if (rand(1,6) == 1) instance_create(x-8, y-8, oSpider);
else if (rand(1,12) == 1) instance_create(x-8, y-8, oSnake);
if (held)
{
    oPlayer1.holdItem = 0;
    oPlayer1.pickupItemType = "";
}
instance_destroy();
objects/oJar/collision_oWhip.gml:9-21, from spelunky.gmk, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC (Spelunky User License v1.1b).

instance_destroy() runs the Jar's destroy event, which is how every other break works: if breakPieces is set, it plays the sound, makes the smoke and the pieces and rolls the same chain. Nothing in the whip code clears breakPieces, which the Jar's create event sets, so the destroy event does it all again [3]. A thrown, shot or bombed Jar only runs the destroy event, and rolls once.

The Machete's slash and the Mattock's hit are kinds of whip in the code (children of oWhip), so they break a Jar the same way [4].

Reproducing it

#

Whip any Jar: every Jar the Whip, the Machete or the Mattock breaks rolls twice. Whether the second roll shows depends on what it rolls, as both rolls can come up empty. The replay of the clip's scene, on a custom level, breaks a Jar that lets out a gold chunk and a big emerald [5].

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 [4], and the oracle's fingerprint of the replay pins the two rolls. No option turns it off.

FAQ

#
Does whipping a Jar give more treasure in Spelunky Classic?

Yes, on average. A Jar the Whip breaks rolls for its contents twice, so it can let out two treasures, or a treasure and a Spider, where a Jar thrown, shot or blown up rolls once.

Is the double Jar roll a bug?

It's a slip in the Jar's code: its whip code breaks the Jar and rolls, then destroys it, and destroying it runs its breaking code again. The game has always done it, and the spelunky.ai port keeps it.

Do the Machete and the Mattock roll a Jar twice too?

Yes. The game counts the Machete's slash and the Mattock's hit as kinds of whip, so a Jar either breaks rolls twice as well.

See also

#

References

#
  1. Clip quirks/jar-whip-rolls-twice
  2. objects/oJar/collision_oWhip.gml:1-21
  3. objects/oJar/destroy.gml:3-28
  4. Quirk 1 (docs/quirks.md)
  5. Replay fidelity/replays/item-jar-whip-rolls-twice.txt

Source code

  • objects/oJar/collision_oWhip.gml
  • objects/oJar/destroy.gml
#