Skip to content

Deck redeeming

Oinite edited this page Jun 15, 2026 · 1 revision

(mechanic from Entropy)

Decks can be redeemed to apply their effects to the current run, mid-run. If a card has a center set to a deck (i.e. Card:set_ability(deck_key)), a button to redeem it can be clicked.

If CardSleeves is installed, sleeves can also be redeemed. For convenient documentation, only decks will be referred to, but many of the principles described here also apply to sleeves.

Note

This API does not implement naturally-occurring deck cards.

Technical details

To be specific, the following will occur when redeeming a deck:

  1. The deck's apply function will be called.
    • If a sleeve is redeemed, the first argument in apply will point to the sleeve's center.
    • Otherwise, the first argument is nil.
  2. Each value in the deck's config table will be interpreted and applied accordingly.
  3. Additional effects are performed for Checkered Deck/Sleeve.
  4. The following calculation context is sent out:
{
	pull_card = true,
	card = deck
}

Config interpretation

The table Spectrallib.deck_config_apply_effects describes how to interpret each value in a deck's config table, depending on the associated key. Values of the table Spectrallib.deck_config_apply_effects are functions of the form function (deck_center, value), where deck_center is an SMODS.Back, and value is the config value.

If your mod adds a custom config key, it is recommended to also add to this table. The following config keys are implemented by default:

  • hands
  • discards
  • joker_slot
  • hand_size
  • dollars
  • spectral_rate
  • jokers
  • voucher
  • consumables
  • vouchers
  • consumable_slot
  • ante_scaling
  • boosters_in_shop
  • no_interest
  • extra_hand_bonus
  • extra_discard_bonus
  • no_faces
  • randomize_rank_suit

Functions/methods

G.FUNCS.buy_deckorsleeve(e) -> nil

Applies the effects of a redeemed deck. e should be of the following form:

e = {
	config = {
		ref_table = card
	}
}

where card is the card that is used to redeem a deck.

Card:redeem_deck() -> nil

Redeems a deck, playing its corresponding animation in the process.

G.UIDEF.bought_decks() -> UINode

Generates the UI to display redeemed decks in the Run Info menu. Used internally.

Hooks

This API hooks the following functions:

  • SMODS.calculate_context - In addition to calling the run's deck's calculate function, the calculate function of each redeemed deck is also called.
  • Back.trigger_effect - Ditto, for vanilla decks (specifically Anaglyph Deck and Plasma Deck).

Clone this wiki locally