Spelunky is © 2008, 2009 Derek Yu and Mossmouth, LLC, and is used under the [Spelunky User License v1.1b](https://spelunky.ai/LICENSE.txt). spelunky.ai is an unofficial fan project, not affiliated with or endorsed by Mossmouth. The game and its assets may not be sold.

Music by George Buzinkai and Jonathan Perry; sound effects made in SFXR. From Spelunky Classic 1.1, © 2008, 2009 Derek Yu and Mossmouth, LLC.

# Two General Stores

From the spelunky.ai wiki: <https://spelunky.ai/wiki/two-general-stores>. Verified against the spelunky.ai port [v0.1.10](https://github.com/851-labs/spelunky/releases/tag/v0.1.10) on 28 October 2026.

Two General Stores is a quirk of Spelunky Classic in which one Black Market in five has a second General Store in place of the shop it was about to make.

| Quirk     |                                                                                                                                                                                                                                   |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Status    | GML + Oracle                                                                                                                                                                                                                      |
| Where     | `scripts/scrRoomGenMarket.gml:117-141`                                                                                                                                                                                            |
| Pinned by | `fidelity/replays/shop-seed-9-market-two-general-stores.txt`                                                                                                                                                                      |
| Row       | [docs/quirks.md §1, Bugs and leftovers in the 1.1 source](https://github.com/851-labs/spelunky/blob/main/docs/quirks.md#1-bugs-and-leftovers-in-the-11-source): “A Black Market's fifth item shop can be a second General Store.” |

The [Black Market](https://spelunky.ai/wiki/black-market) has five item shops, one of each kind: a
[General Store](https://spelunky.ai/wiki/general-store), a [Bomb Shop](https://spelunky.ai/wiki/bomb-shop), a [Weapon Shop](https://spelunky.ai/wiki/weapon-shop), a
[Rare Shop](https://spelunky.ai/wiki/rare-shop) and a [Clothing Shop](https://spelunky.ai/wiki/clothing-shop), with the Ankh's shop beside them. The loop that
gives each its kind checks whether it has gone round once after every try, the one that succeeds included, so
the fifth shop can find the last kind and be made a General Store all the same.

## What happens

The fifth shop, with only the Rare Shop's kind left, finds it and is made a General Store all the same, so the
market has two and no Rare Shop. The player walks into Duke's Supply Shop, then down into Lemmy's[^1].

**Clip: A Black Market with two General Stores.** The Black Market's fifth item shop, with only the Rare Shop's kind left, finds it and is made a General Store all the same, so the market has two and no Rare Shop. The player walks into Duke's Supply Shop, then down into Lemmy's. ([video](https://spelunky.ai/wiki/media/39b784c6a7dfc9d3/clips/quirks/market-two-general-stores/clip.mp4))

## Why

For each item shop, the market's room script picks a first kind at random, `m`, and tries it and each kind
after it in turn, General, Bomb, Weapon, Rare and Clothing, then round again, taking the first the market
hasn't made. If it comes back to `m`, it gives up with a General Store[^2]:

```gml scripts/scrRoomGenMarket.gml:133-139
        n += 1;
        if (n > 5) n = 1;
        if (n == m)
        {
            shopType = "General";
            break;
        }
```

`scripts/scrRoomGenMarket.gml:133-139`, from `spelunky.gmk`, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC ([Spelunky User License v1.1b](https://spelunky.ai/LICENSE.txt)).

The test runs after every try, once `n` has moved on, including the try that just found a kind. For the
fifth shop, with one kind left, a first pick just after that kind finds it on the fifth try, the last before
`n` is back at `m`: the script marks the kind as made, then overwrites the shop's kind with General. That's
one first pick in five, and it shows unless the kind left was the General Store's own[^3].

## Reproducing it

It depends on the level's seed: visit Black Markets until one has two General Stores. The replay pins one:
seed 9's market, where the fifth shop finds the Rare Shop's kind and is made a General Store, and the player is
greeted in Duke's Supply Shop and in Lemmy's, with no Rare Shop on the level[^4]. Other routes into the same
seed's market have all five kinds[^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[^3], and the oracle's fingerprint of the replay pins the shops. No option turns it off.

## FAQ

### Why does the Black Market have two General Stores in Spelunky Classic?

The script that picks each shop's kind gives up one try too early. One market in five, its fifth shop finds the last kind left and is made a [General Store](https://spelunky.ai/wiki/general-store) anyway, so the market has two and none of the kind left.

### Which shop is missing when the Black Market has two General Stores?

The kind the fifth shop found: a [Rare Shop](https://spelunky.ai/wiki/rare-shop), a [Bomb Shop](https://spelunky.ai/wiki/bomb-shop), a [Weapon Shop](https://spelunky.ai/wiki/weapon-shop) or a [Clothing Shop](https://spelunky.ai/wiki/clothing-shop), whichever the first four didn't make.

### How often does the Black Market have two General Stores?

One market in five lets the fifth shop's last kind go, and it shows unless that kind was the General Store, so a little less often than that.

## See also

- **Related:** [Black Market](https://spelunky.ai/wiki/black-market), [General Store](https://spelunky.ai/wiki/general-store), [Rare Shop](https://spelunky.ai/wiki/rare-shop), [Bomb Shop](https://spelunky.ai/wiki/bomb-shop), [Weapon Shop](https://spelunky.ai/wiki/weapon-shop), [Clothing Shop](https://spelunky.ai/wiki/clothing-shop)

## References

[^1]: Clip quirks/market-two-general-stores

[^2]: `scripts/scrRoomGenMarket.gml:117-141`

[^3]: Quirk 1 (docs/quirks.md)

[^4]: Replay `fidelity/replays/shop-seed-9-market-two-general-stores.txt`

[^5]: Replay `fidelity/replays/jungle-seed-9-market.txt`

### Source code

- `scripts/scrRoomGenMarket.gml`
