SMODS.PokerHand - Breezebuilder/Steamodded-Wiki GitHub Wiki
API Documentation: SMODS.PokerHand
- Required parameters:
keymult,chips: Base Mult and Chipsl_mult,l_chips: Amount of Mult/Chips scaling per hand levelexample: Hand example to show in the Run Info tab, format:
{ { 'S_K', false }, -- King of Spades, does not score { 'S_9', true }, -- 9 of Spades, scores { 'D_9', true }, -- 9 of Diamonds, scores { 'H_6', false }, -- 6 of Hearts, does not score { 'D_3', false } -- 3 of Diamonds, does not score }evaluateloc_txtor localization entry (reference)- Rather than a
texttable,loc_txtshould contain adescriptiontable. The description is displayed when viewing the hand in the Run Info menu. When using localization files, the name should be placed inmisc.poker_hands[key], the description should be placed inmisc.poker_hand_descriptions[key].
- Rather than a
- Optional parameters (defaults):
prefix_config, dependencies(reference)visible = true: Is this hand visible in the poker hands menu from the start, or is it hidden until played for the first time?above_hand: Sets the position in the hands menu above the specified hands. By default, hands are ordered by the product of their chips and mult.order_offset: If this numeric parameter is specified, add its value to the product of chips and mult for the purpose of ordering.
API methods
evaluate(parts, hand) -> table- This function is used to determine if the played cards contain this hand, and which cards it's made up of.
- See the next section for an explanation of parts.
- The returned table should be an array that contains a table of all scoring cards, e.g.,
{ hand }if all cards score,{ SMODS.merge_lists(parts._flush, parts._straight) }for all scoring cards that are part of a straight or flush, or{}if the cards don't contain this hand.
modify_display_text(self, cards, scoring_hand) -> string?- Changes the displayed name of the poker hand.
- Returns the key to the new display name that gets localized (placed inside of
misc.poker_hands[key]).
Utility functions
SMODS.merge_lists(...) -> table- Takes any amount of parts and flattens them into an array containing all scoring cards present in any of the parts. This is particularly useful for composite hands.
API Documentation: SMODS.PokerHandPart
This utility class allows easily re-using the same poker hand constructs to build composite hands without much boilerplate code. Before all hand types get evaluated, each part gets executed and added to parts for access in the evaluate functions.
- Required parameters:
key: Keep in mind that your mod prefix is prepended to this!func(hand) -> table: This expects the same return value format asevaluateon poker hands.
- Pre-existing parts:
parts._2, parts._3, parts._4, parts._5contain all groups of at least 2/3/4/5 cards that share the same rank.parts._all_pairsprovides a list of all cards that are part of at least one pair in the hand. (This is equivalent toSMODS.merge_lists(parts._2).)parts._flushcorresponds to a Flush being present in the hand.parts._straightcorresponds to a Straight being present in the hand.parts._highestholds the card with the highest nominal value.