SMODS.Enhancement - Breezebuilder/Steamodded-Wiki GitHub Wiki
Class prefix: m
-
Required parameters:
key
-
loc_txt
or localization entry (reference)
-
Optional parameters (defaults):
-
atlas = 'centers', pos = { x = 0, y = 0 }
(reference) -
config = {}, no_collection, prefix_config, dependencies, display_size, pixel_size
(reference)- The following base values for
config
are supported and will be scored automatically and unconditionally:
{ bonus, -- Extra chips x_chips, -- Chips multiplier, nil (not defined), 0 or 1 is treated as 1. mult, -- Extra additive mult x_mult, -- Mult multiplier, nil (not defined), 0 or 1 is treated as 1. h_chips, -- Chips when held in hand during scoring h_x_chips, -- Chips multiplier when held in hand during scoring, nil (not defined), 0 or 1 is treated as 1. h_mult, -- Additive mult when held in hand during scoring h_x_mult, -- Mult multiplier when held in hand during scoring, nil (not defined), 0 or 1 is treated as 1. p_dollars -- Dollars granted when scored h_dollars -- Dollars granted when held in hand at the end of the round }
- For conditionally granting any of these values, use a
calculate
function instead! - Note:
discovered
andunlocked
on enhancements are currently unsupported.
- The following base values for
-
pools
: List of keys to ObjectTypes this center should be injected into- Expects a list of keys like this:
{ ["Foo"] = true, ["Bar"] = true, }
-
replace_base_card
: Iftrue
, don't draw base card sprite or give base card chips. -
no_rank
: Iftrue
, enhanced card has no rank. -
no_suit
: Iftrue
, enhanced card has no suit. -
overrides_base_rank
: Iftrue
, enhancement cannot be generated by Grim, Familiar and Incantation (enhancements withno_rank
set to true are automatically assigned this property). -
any_suit
: Iftrue
, enhanced card counts as any suit. -
always_scores
: Iftrue
, enhanced card always counts in scoring. -
weight
: The weighting of the enhancement, follows same rules as other weighted objects (default weight is 5).
-
-
calculate(self, card, context)
(reference) -
loc_vars, locked_loc_vars, generate_ui
(reference) -
get_weight(self) -> number
- Used to modify the weight of enhancement on certain conditions.
-
set_ability(self, card, initial, delay_sprites)
- Set up initial ability values or manipulate sprites in an advanced way.
-
in_pool(self, args) -> bool, { allow_duplicates = bool }
- Define custom logic for when a card is allowed to spawn. A card can spawn if
in_pool
returns true and all other checks are met. - When called from
generate_card_ui
, the_append
key is passed asargs.source
.
- Define custom logic for when a card is allowed to spawn. A card can spawn if
-
update(self, card, dt)
- For actions that happen every frame.
-
set_sprites(self, card, front)
- For advanced sprite manipulation that happens when a card is created or loaded.
-
set_badges(self, card, badges)
- Add additional badges, leaving existing badges intact. This function doesn't return; add badges by appending to
badges
. - Avoid overwriting existing elements. It will cause text to appear on the top left corner of your screen instead.
- Function for creating badges:
create_badge(_string, _badge_col, _text_col, scaling)
-
_string
: Text displayed on the badge. -
_badge_col = G.C.GREEN
: Background colour. -
_text_col = G.C.WHITE
: Text colour. -
_scaling = 1
: Relative size of the badge.
-
- Example:
{ set_badges = function(self, card, badges) badges[#badges+1] = create_badge(localize('k_your_string'), G.C.RED, G.C.BLACK, 1.2 ) end, }
- Add additional badges, leaving existing badges intact. This function doesn't return; add badges by appending to
-
set_card_type_badge(self, card, badges)
- Same as
set_badges
, but bypasses creation of the card type / rarity badge, allowing you to replace it with a custom one.
- Same as
-
draw(self, card, layer)
- Draws the sprite and shader of the card.
-
SMODS.poll_enhancement(args)
(defaults)-
args.key
, the key used to generate the seed -
args.type_key
, an optional key used to generate the specific enhancement seed -
args.mod
, multiplying modifier to the base rate (40%) -
args.guaranteed
, iftrue
, enhancement is guaranteed -
args.options
, can be used to provide fixed options to the pool-
{ keys }
, a table of keys as strings, respects original weight values -
{ {key = string, weight = number} }
, a table of tables, with key and weight pairs
-
-
-
SMODS.get_enhancements(card, extra_only)
: Returns a table indexed by keys of enhancements that the given card has.-
Card:calculate_joker
is called for each joker withcontext = { check_enhancement = true, other_card = card }
, expecting return tables in the same format to add extra enhancements. No other ways to give a card multiple enhancements are currently supported. - If
extra_only == true
, the card's base enhancement is excluded.
-
-
SMODS.has_enhancement(card, key)
: Returnstrue
if the given card has the specified enhancement, either as its natural enhancement or an extra enhancement from jokers. -
SMODS.has_no_suit(card)
: Returns true if a card doesn't have any suit due to its enhancements (e.g., Stone Cards). -
SMODS.has_any_suit(card)
: Returns true if a card can be used as any suit due to its enhancements (e.g., Wild Cards).- Cards with enhancement effects both for having no suit and for having any suit can be used as any suit.
-
SMODS.has_no_rank(card)
: Returns true if a card doesn't have any rank due to its enhancements (e.g., Stone Cards). -
SMODS.always_scores(card)
: Returns true if a card always scores due to its enhancements (e.g., Stone Cards).