Skip to content

Voucher unredeeming

Oinite edited this page Jun 15, 2026 · 1 revision

(mechanic from Cryptlib)

Unredeeming a voucher is a process that is reverse of redeeming a voucher, that is, the voucher's effects are nullified and considered no longer in use in a run.

To unredeem a voucher voucher, use the method voucher:unredeem() to play the unredeeming animation, or voucher:unapply_to_run(center) to skip said animation; center is optional - it is some voucher's prototype whose unapply effect overrides that of voucher.

To be able to unredeem a voucher, the unredeem method in the voucher's register must be defined:

SMODS.Voucher {
  -- ...
  unredeem = function(self, card)
    -- effect...
  end
  -- ...
}

All vanilla vouchers have unredeem effects defined in Spectrallib.vanilla_unapply_results. It is not recommended to add unredeeming effects for modded vouchers in this table; instead define unredeeming effects using the vouchers's unredeem function.

Card methods

Card:unredeem() -> nil

Calls the unredeem method of Card's center (if defined), as well as plays an animation similar to that when redeeming a voucher.

Card:unapply_to_run(center) -> nil

Only calls the unredeem method of Card's center (if defined). If center is defined, its unredeem method will be called instead.

Supplementary functions

Spectrallib.update_used_vouchers() -> nil

Updates the global table G.GAME.used_vouchers, which is a run's list of vouchers that are considered in active use.

Clone this wiki locally