-
Notifications
You must be signed in to change notification settings - Fork 6
Voucher unredeeming
(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.
Calls the unredeem method of Card's center (if defined), as well as plays an animation similar to that when redeeming a voucher.
Only calls the unredeem method of Card's center (if defined). If center is defined, its unredeem method will be called instead.
Updates the global table G.GAME.used_vouchers, which is a run's list of vouchers that are considered in active use.