Skip to content

05. Helper Functions

N edited this page Sep 11, 2025 · 1 revision

API Helper Functions

Use these functions while writing definitions.

JokerDisplay.evaluate_hand

Returns scoring information about a set of cards. You can get the full precalculated hand using JokerDisplay.current_hand.

  • Optional parameters:

    • cards: Cards to calculate. Defaults to current precalculated hand JokerDisplay.current_hand.
    • count_facedowns If true, counts cards facing back.
  • Returns:

    • text: Scoring poker hand's non-localized text. "Unknown" if there's a card facedown or if selected cards are not valid.
    • poker_hands: Poker hands contained in the scoring hand.
    • scoring_hand: Scoring cards in hand.

JokerDisplay.calculate_blueprint_copy

Returns what Joker the current Blueprint-like card is copying. See get_blueprint_joker.

  • Required parameters:

    • card: Blueprint-like card to calculate copy for.
  • Returns:

    • copied_joker: Copied Joker card.
    • is_debuffed: If the copied card (or any in the chain) is debuffed.

JokerDisplay.copy_display

Copies an in-play Joker's display. Use with JokerDisplay.calculate_blueprint_copy, see Blueprint's definition for more details.

  • Required parameters:

    • card: Card that is copying.
  • Optional parameters:

    • copied_joker: Joker being copied. Initializes default display if nil.
    • is_debuffed: If Joker is debuffed by other means.
    • bypass_debuff: Bypass debuff.
    • stop_func_copy: Don't copy other functions such as mod_function, retrigger_function, etc.

JokerDisplay.find_joker_or_copy

Returns all held instances of certain Joker, including Blueprint copies.

  • Required parameters:

    • key: Key of the Joker to find.
  • Optional parameters:

    • count_debuffed: If true also returns debuffed cards.
  • Returns:

    • All Jokers found, including Jokers with copy abilities.

JokerDisplay.sort_cards

Sort cards from left to right.

  • Required parameters:

    • cards: Cards to sort.
  • Returns:

    • Sorted cards.

JokerDisplay.calculate_leftmost_card

Returns the leftmost card in a set of cards.

  • Required parameters:

    • cards: Cards to calculate.
  • Returns:

    • Leftmost card in hand if any.

JokerDisplay.calculate_rightmost_card

Returns the rightmost card in a set of cards.

  • Required parameters:

    • cards: Cards to calculate.
  • Returns:

    • Rightmost card in hand if any.

JokerDisplay.calculate_card_triggers

Returns how many times the scoring card would be triggered for scoring if played.

  • Required parameters:

    • card: Card to calculate.
  • Optional parameters:

    • scoring_hand: Scoring hand.
    • held_in_hand: true if the card is held in hand and not a scoring card.
  • Returns:

    • Times the card would trigger. (0 if debuffed)

JokerDisplay.calculate_joker_modifiers

Returns what modifiers the other Jokers in play add to the this Joker card.

  • Required parameters:

    • card: Joker to calculate.
  • Returns:

    • Modifiers table.

JokerDisplay.triggers_blind

Returns if hand triggers (boss) blind. See blind definition docs.

  • Required parameters:

    • blind: Blind to calculate.
    • text Scoring poker hand's non-localized text. "Unknown" if there's a card facedown or if selected cards are not valid.
    • poker_hands Poker hands contained in the scoring hand.
    • scoring_hand Scoring cards in hand.
    • full_hand Full hand.
  • Returns:

    • true if it triggers the blind, false otherwise. nil if unknown (blind is not defined).

JokerDisplay.calculate_joker_triggers

Returns how many times the Joker would be triggered if activated. See "retrigger_type" field and retrigger_joker_function.

  • Required parameters:

    • card: Joker to calculate.
  • Returns:

    • Times the card would trigger. (0 if debuffed)

JokerDisplay.create_display_object

Creates an object with JokerDisplay configurations.

  • Required parameters:

  • Optional parameters:

    • defaults_config: Defaults for all text objects.
  • Returns:

    • Display object.

JokerDisplay.number_format

Formats number.

  • Required parameters:

    • num: Number to format. Accepts Talisman's bignum/omeganum.
  • Optional parameters:

    • e_switch_point: Number from where to switch to scientic notation. Defaults to 1000000.
    • places: Maximum decimal places. Defaults to 2.
  • Returns:

    • The formatted string or num if it's not a number.

JokerDisplay.strsplit

Splits text by a separator.

  • Required parameters:

    • str: String to split.
  • Optional parameters:

    • sep: Separator. Defaults to whitespace.
  • Returns:

    • split_text: Table with the split substrings.

JokerDisplay.deepcopy

Deep copies a table. (Not recursive).

  • Required parameters:

    • orig: Table to copy.
  • Returns:

    • copy: Copied table.