SMODS.Rank#
Required parameters:
keycard_key: Used to create keys for playing cards, formatted likeS_R, whereSis the suit’s andRis the rank’s card key. Your mod prefix gets prepended by default.pos: This is a partialpostable that only needs anxcoordinate. As such, your atlas should organize ranks in columns.nominal: The amount of chips this rank should score.loc_txtor localization entry (reference)loc_txtshould contain only anamestring. For localization files, place this string inmisc.ranks[key].
Optional parameters (defaults):
prefix_config, dependencies(reference)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 thenexttable 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.fixedis a numeric value andnextindexed at that value is a valid rank’s key, always convert into that rank.If
strength_effect.randomistrue, choose a random rank fromnext.If
strength_effect.ignoreistrueor none of the above apply, do nothing.
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’sxposition 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.
SMODS.Suit#
Required parameters:
keycard_key: Used to create keys for playing cards, formatted likeS_R, whereSis the suit’s andRis the rank’s card key. Your mod prefix gets prepended by default.pos: This is a partialpostable that only needs aycoordinate. As such, your atlas should organize suits in rows.ui_pos: Sprite position of the miniature suit symbol used in deck view.loc_txtor localization entry (reference)loc_txtshould contain asingularandpluralstring only. When using localization files, assign tomisc.suits_singular[key]andmisc.suits_plural[key]respectively.
Optional parameters (defaults):
prefix_config, dependencies(reference)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.
API methods#
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.
draw(self, card, layer)Draws additional sprites or shaders on cards.
Utility: pools and randomness#
Suits and Ranks have special support for
in_poolwith an extended argument signature:in_pool(self, args).args.initial_deckindicates 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.SuitsandSMODS.Ranksare unordered tables, it is possible to feed them directly intopseudorandom_elementto get a random suit or rank while respectingin_pool. Example:local rank = pseudorandom_element(SMODS.Ranks, pseudoseed('myrank')).