-
Notifications
You must be signed in to change notification settings - Fork 80
SMODS.Suit and SMODS.Rank
Casimir Eisenach edited this page Jan 22, 2025
·
4 revisions
-
Required parameters:
key
-
card_key
: Used to create keys for playing cards, formatted likeS_R
, whereS
is the suit's andR
is the rank's card key. Your mod prefix gets prepended by default. -
pos
: This is a partialpos
table that only needs ay
coordinate. As such, your atlas should organize suits in rows. -
ui_pos
: Sprite position of the miniature suit symbol used in deck view. -
loc_txt
or localization entry (reference)-
loc_txt
should contain asingular
andplural
string only. When using localization files, assign tomisc.suits_singular[key]
andmisc.suits_plural[key]
respectively.
-
-
Optional parameters (defaults):
-
lc_atlas = 'cards_1'
: Atlas to use when high-contrast cards are disabled. -
hc_atlas = 'cards_2'
: Atlas to use when high-contrast cards are enabled. -
lc_ui_atlas = 'ui_1'
: Atlas for miniature suit symbols when high-contrast cards are disabled. -
hc_ui_atlas = 'ui_2'
: Atlas for miniature suit symbols when high-contrast cards are enabled. -
lc_colour = [white]
: Text colour when high-contrast cards are disabled. -
hc_colour = [white]
: Text colour when high-contrast cards are enabled.
-
-
Required parameters:
key
-
card_key
: Used to create keys for playing cards, formatted likeS_R
, whereS
is the suit's andR
is the rank's card key. Your mod prefix gets prepended by default. -
pos
: This is a partialpos
table that only needs anx
coordinate. As such, your atlas should organize ranks in columns. -
nominal
: The amount of chips this rank should score. -
loc_txt
or localization entry (reference)-
loc_txt
should contain only aname
string. For localization files, place this string inmisc.ranks[key]
.
-
-
Optional parameters (defaults):
-
lc_atlas = 'cards_1', hc_atlas = 'cards_2'
: Atlas to use for low-contrast and high-contrast settings respectively. Use the same atlas key if you don't have separate high contrast textures. (reference) -
shorthand = key
: Short descriptor used in deck preview. -
face_nominal
: Numeric value (normally between 0 and 1) that determines the displayed order of ranks with the same nominal value. -
face = false
: whether this rank counts as a face card. -
next = {}
: The keys contained in thenext
table are considered to come after this card, e.g. for the purpose of evaluating straights. -
strength_effect = { fixed = 1 }
: Determines how cards of this rank behave when Strength is used.- If
strength_effect.fixed
is a numeric value andnext
indexed at that value is a valid rank's key, always convert into that rank. - If
strength_effect.random
istrue
, choose a random rank fromnext
. - If
strength_effect.ignore
istrue
or none of the above apply, do nothing.
- If
-
straight_edge = false
: If this istrue
, this card behaves like an Ace in straights, i.e., it can only be used as the lowest- or highest-order card in the hand. -
suit_map = { Hearts = 0, Clubs = 1, Diamonds = 2, Spades = 3 }
- For any suit keys present as keys in
suit_map
, prefer using this rank's atlas over the suit's atlas. The value at the suit's key will be used as each sprite'sx
position instead of the one specified by the suit. - This indicates that you provide sprites for certain suits with your rank. Combinations of suits and ranks where neither side supports the other, blank sprites are used instead.
- For any suit keys present as keys in
-
These methods are available for both suits and ranks.
-
loc_vars
(reference)- This method provides very limited functionality compared to its counterpart on other classes. It has no support for any return values, but it does allow you to add tooltips to
info_queue
.
- This method provides very limited functionality compared to its counterpart on other classes. It has no support for any return values, but it does allow you to add tooltips to
-
draw(self, card, layer)
- Draws additional sprites or shaders on cards.
- Suits and Ranks have special support for
in_pool
with an extended argument signature:in_pool(self, args)
.args.initial_deck
indicates when a starting deck is being generated. This can be used to set rules for when your cards should be added to starting decks independently of whether they can show up in other places. - Even though
SMODS.Suits
andSMODS.Ranks
are unordered tables, it is possible to feed them directly intopseudorandom_element
to get a random suit or rank while respectingin_pool
. Example:local rank = pseudorandom_element(SMODS.Ranks, pseudoseed('myrank'))
.
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.