SMODS.Challenge#
Required parameters:
keyloc_txtor localization entry (reference)The only supported field is
name. In localization files, it is set by referring tomisc.challenge_names[key].
Optional parameters (defaults):
prefix_config, dependencies(reference)rules: Custom rules and modifiers for the challenge.rules.custom: Expects a list of tables with anid, optionally avaluefield (defaults totrue) andno_ui(not set by default).Sets `G.GAME.modifiers[id] = value`. Text for each rule should be stored in `G.localization.misc.v_text['ch_c_'..id]` unless `no_ui` is set to `true`. The following custom rule keys are defined by the base game:
all_eternal,chips_dollar_cap,daily,debuff_played_cards,discard_cost,flipped_cards,inflation,minus_hand_size_per_X_dollar,no_extra_hand_money,no_interest,no_reward,no_reward_specific,no_shop_jokers,none,set_eternal_ante,set_joker_slots_ante,set_seed.
rules.modifiers: Expects a list of tables with anidand avaluefield.Sets `G.GAME.starting_params[id] = value`. Custom `starting_params` can be used (i.e. `erratic_suits_and_ranks`), as long as `no_ui` is set to `true`. The following modifiers are supported:
dollars,discards,hands,reroll_cost,joker_slots,consumable_slots,hand_size.
jokers: Expects a list of tables that represent jokers added at the start of the run. Each table can have the following fields:id(required): The key of the joker to create.edition: The edition of the joker, if any, given without thee_prefix.eternal: If the joker is eternal.pinned: If the joker is pinned.
consumeables: Behaves likejokers, but for consumables.Supports all fields of
jokersexceptpinned.
vouchers: Behaves likejokers, but for vouchers redeemed at the start of the run.Supports the same fields as
consumeables, buteditionandeternalhave no functional effect beyond displaying in the preview UI.
restrictions: Contains information about objects that are banned in this challenge. These parameters can also be functions that return the expected tables.restrictions.banned_cards: Expects a list of tables with keys to ban in theiridfields.This can be used to ban jokers, consumables, vouchers and booster packs.
If a table has an
idsfield containing a list of center keys, onlyidis shown as banned in the challenge UI, but all of theidsare banned.
restrictions.banned_tags: Expects a list of tables with valid tag keys in theiridfields.restrictions.banned_other: Expects a list of tables with valid keys in theiridfield and atypestring with the value'blind'.Despite the name, the UI for this only supports using this to ban blinds.
Functionally, all three options achieve the same task of adding specified keys to
G.GAME.banned_keys.
deck: Defines the challenge’s deck.deck.type = 'Challenge Deck': The deck type for this challenge. It is not recommended to change this value.deck.cards: Defines the cards present in the deck using a list of control tables. Control tables have the following structure:s: Suit of the card, given by itscard_key.r: Rank of the card, given by itscard_key.e: Enhancement of the card, given by its key.d: Edition of the card, given by its key without thee_prefix.g: Seal of the card, given by its key. (The key for this option is based on Gold Seals being the only available seals in the demo version.)
deck.yes_ranks,deck.yes_suits: Can be used only if nocardstable is specified. Expects a key-indexed table of ranks/suits by theircard_keyand acts as a whitelist, i.e., it includes only cards of those ranks/suits in the starting deck.deck.no_ranks,deck.no_suits: Same asyes_ranksandyes_suits, but acts as a blacklist, i.e., the specified ranks/suits are excluded.deck.enhancement: Can be used only if nocardstable is specified. Given an enhancement by its key, apply it to all cards in the starting deck.deck.edition: Can be used only if nocardstable is specified. Given an edition by its key without thee_prefix, apply it to all cards in the starting deck.deck.seal: Can be used only if nocardstable is specified. Given a seal by its key, apply it to all cards in the starting deck.
text_colour = G.C.WHITE: Used to set a custom text colour for the button in the challenge list.button_colour = G.C.RED: Used to set a custom button colour in the challenge list.
API methods#
calculate(self, context)(reference)apply(self)Apply modifiers at the start of a run.
calc_dollar_bonus(self) -> number, table(Added in 1531zeebee)
For awarding money at the end of the round (e.g. Delayed Gratification, Cloud Nine)
Optionally, you can return a table as the second value to modify the text in the round evaluation screen with any of the following arguments:
text: Replaces the default name text.key,set: Allows changing the key and/or set of the name in the localization (ignored iftextis set)vars: (Added in 1814a) Replaces the variables (e.g.#1#) in names sourced from the localization.text_colour,scale: Allows changing the colour and scale of the text respectively
unlocked(self) -> boolDefines when the challenge should be unlocked (or not).