-
Notifications
You must be signed in to change notification settings - Fork 80
SMODS.PokerHand
Casimir Eisenach edited this page Jan 22, 2025
·
3 revisions
-
Required parameters:
key
-
mult
,chips
: Base Mult and Chips -
l_mult
,l_chips
: Amount of Mult/Chips scaling per hand level -
example
: 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 }
evaluate
-
loc_txt
or localization entry (reference)- Rather than a
text
table,loc_txt
should contain adescription
table. 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.
-
-
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.
-
-
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.
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 asevaluate
on poker hands.
-
-
Pre-existing parts:
-
parts._2, parts._3, parts._4, parts._5
contain all groups of at least 2/3/4/5 cards that share the same rank.-
parts._all_pairs
provides 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._flush
corresponds to a Flush being present in the hand. -
parts._straight
corresponds to a Straight being present in the hand. -
parts._highest
holds the card with the highest nominal value.
-
-
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.