-
Notifications
You must be signed in to change notification settings - Fork 80
SMODS.Voucher
Casimir Eisenach edited this page Jan 22, 2025
·
1 revision
Class prefix: v
-
Required parameters:
-
key
, -
loc_txt
or localization entry (reference)
-
-
Optional parameters (defaults):
-
atlas = 'Voucher', pos = { x = 0, y = 0 }
(reference) -
config = {}, unlocked = true, discovered = false, no_collection, prefix_config, dependencies, display_size, pixel_size
(reference) -
cost = 10
, -
requires
: specify a list of one or more vouchers by their full key (e.g.'v_grabber'
for vanilla vouchers, or'v_pref_myvoucher'
for a modded voucher from the mod with prefix'pref'
)
-
-
calculate(self, card, context)
(reference) -
loc_vars, locked_loc_vars, generate_ui
(reference) -
redeem(self, card)
- Defines the behavior of a Voucher when redeemed.
-
set_ability(self, card, initial, delay_sprites)
- Set up initial ability values or manipulate sprites in an advanced way.
-
add_to_deck(self, card, from_debuff)
- Modify the game state when this card is obtained.
- Cards are considered added when they become undebuffed (in this case,
from_debuff
will be true).
-
remove_from_deck(self, card, from_debuff)
- Modify the game state when this card is sold, destroyed, or otherwise removed.
- Cards are considered removed when debuffed (in this case,
from_debuff
will be true).
-
in_pool(self, args) -> bool, { allow_duplicates = bool }
- Define custom logic for when a card is allowed to spawn. A card can spawn if
in_pool
returns true and all other checks are met. -
allow_duplicates
allows this card to spawn when one already exists, even without Showman. - When called from
generate_card_ui
, the_append
key is passed asargs.source
.
- Define custom logic for when a card is allowed to spawn. A card can spawn if
-
update(self, card, dt)
- For actions that happen every frame.
-
set_sprites(self, card, front)
- For advanced sprite manipulation that happens when a card is created or loaded.
-
load(self, card, card_table, other_card)
- For modifications to sprites or the card itself when a run is reloaded.
-
check_for_unlock(self, args) -> bool
- Configure unlock conditions. Refer to the function
check_for_unlock
in Balatro's code for more information.
- Configure unlock conditions. Refer to the function
-
set_badges(self, card, badges)
- Add additional badges, leaving existing badges intact. This function doesn't return; add badges by appending to
badges
. - Avoid overwriting existing elements. It will cause text to appear on the top left corner of your screen instead.
- Function for creating badges:
create_badge(_string, _badge_col, _text_col, scaling)
-
_string
: Text displayed on the badge. -
_badge_col = G.C.GREEN
: Background colour. -
_text_col = G.C.WHITE
: Text colour. -
_scaling = 1
: Relative size of the badge.
-
- Example:
{ set_badges = function(self, card, badges) badges[#badges+1] = create_badge(localize('k_your_string'), G.C.RED, G.C.BLACK, 1.2 ) end, }
- Add additional badges, leaving existing badges intact. This function doesn't return; add badges by appending to
-
set_card_type_badge(self, card, badges)
- Same as
set_badges
, but bypasses creation of the card type / rarity badge, allowing you to replace it with a custom one.
- Same as
-
draw(self, card, layer)
- Draws the sprite and shader of the card.
Game Objects
- API Documentation
- SMODS.Achievement
- SMODS.Atlas
- SMODS.Blind
- SMODS.Center
- SMODS.Challenge
- SMODS.DeckSkin
- SMODS.Keybind
- SMODS.Language
- SMODS.ObjectType
- SMODS.PokerHand
- SMODS.Rarity
- SMODS.Seal
- SMODS.Sound
- SMODS.Stake
- SMODS.Sticker
- SMODS.Suit and SMODS.Rank
- SMODS.Tag
Guides
- Your First Mod
- Mod Metadata
- Joker Calculation
- Calculate Functions
- Logging
- Event Manager
- Localization
- Mod functions
- UI Structure
- Utility Functions
Found an issue, or want to add something? Submit a PR to the Wiki repo.