Skip to content

Functions

Jogla edited this page Nov 19, 2025 · 6 revisions

For all intends and purposes, if you are interacting with any of Fool's Gambit's functions, you'll want to prefix it with FG.FUNCS. This is mainly done to prevent clashing with other mods.

Important

All these functions are subject to change in the future, as Fool's Gambit is still in early development.**

Main functions

  • FG.FUNCS.alternate_card(card)

    • Allows to switch any given card to its alternate version. Does not include enhancements, editions and seals.
    • card - Table. The card instance that should be alternated.
    • Returns a table with the original and alternate card.
  • FG.FUNCS.is_alternate(card) -> Bool

    • Allows to check if a card is alternate or not. Very importantly, it retrieves information from the card's center, not the object itself.
    • card - Table. The card instance to check.
  • FG.FUNCS.get_alternate(card) -> String|Nil

    • Returns the key of the alternate center of the specified card. Very importantly, it retrieves information from the card's center, not the object itself.
    • card - Table. The card instance to get the alternate key from.
  • FG.FUNCS.update_edition(source, target?)

    • Intended to be used to alternate cards and keep their editions. Changes the edition of a card based on the edition of another card.
    • source - Table|card. The card the function is taking the edition from.
    • target = source - Table|card. The card the function is applying the edition to.
  • FG.FUNCS.alternate_edition(source, target?)

    • Changes and alternates the edition of a card based on the edition of another card.
    • source - Table|card. The card the function is taking the edition from.
    • target = source - Table|card. The card the function is applying the edition to.
  • FG.FUNCS.update_enhancement(source, target?)

    • Intended to be used to alternate cards and keep their enhancements. Changes the enhancement of a card based on the edition of another card.
    • source - Table|card. The card the function is taking the enhancement from.
    • target = source - Table|card. The card the function is applying the enhancement to.
  • FG.FUNCS.alternate_enhancement(source, target?)

    • Changes and alternates the enhancement of a card based on the enhancement of another card.
    • source - Table|card. The card the function is taking the enhancement from.
    • target = source - Table|card. The card the function is applying the enhancement to.
  • `FG.FUNCS.alternate_seal(source,target?)

    • Changes and alternates the seal of a card based on the seal of another card.
    • source - Table|card. The card the function is taking the seal from.
    • target = source - Table|card. The card the function is applying the seal to.
  • FG.FUNCS.update_alternate_values(old_card, new_card)

    • Intended to be used by modders to add retain scaling values when alternating jokers.
    • old_card - Table. The card that values are taken from.
    • new_card - Table. The card that values are being put into.

Other functions

  • FG.FUNCS.check_exists(key) -> Bool

    • Checks if a given key is in G.P_CENTERS and returns true if it does.
    • key - String. The key to look for. Must specify class and mod prefix.
  • FG.FUNCS.random_chance(max) -> Bool

    • Returns true when a G.GAME.probabilities.normal in max chance is met.
    • This function will be modified or removed at a later date due to SMODS natively supporting random chance.
    • max - Int. The denominator of the fraction.
  • FG.FUNCS.recalculate_alt_rates(rate)

    • Modifies by a percentage the chance of original and alternate cards.
    • rate = 0 <= n <= 1 - Float between 0 and 1 (inclusive). The rate at which alternate cards will spawn. Original cards will be calculated with 1-rate.
  • FG.FUNCS.recalculate_pool(pool)

    • Empties and re-fills the given pool in FG.POOLS according to its _calculate function.
    • pool - String. The pool to recalculate.
  • FG.FUNCS.recalculate_pools()

    • Empties and re-fills all pools in FG.POOLS according to the individual _calculate functions.
  • FG.FUNCS.UIBox_text(args) -> Table

    • Function to construct multi-line text nodes.
    • text = {"No text"} is a table (array), each string represents an entire line.
    • colour = "white is the colour of the text.
    • scale = 0.3 is the size of the text.
    • padding = 0.05 is the distance between lines.
    • tooltip is a tooltip that will appear when hovering over the text.
    • align = "cm" sets the alignment of the text. l,m,r for horizontal, t,m,b for vertical alignment.
    • mode = "R" sets the container alignment for rows or colums.
  • FG.FUNCS.localize(args) -> String|Table

    • Returns the raw path of G.localization.
    • args - String[]. The path in G.localization to get the entry from.

Clone this wiki locally