SMODS.Enhancement [wip] - Pheubel/Steamodded GitHub Wiki

API Documentation: SMODS.Enhancement

  • Required parameters:
    • key
  • Optional parameters (defaults):
    • atlas = 'centers'

    • pos = {x = 0, y = 0}

    • discovered = false, UNSUPPORTED

    • unlocked = true, -- UNSUPPORTED

    • loc_txt: Uses the standard skeleton, omit if using localization files

    • replace_base_card: If true, don't draw base card sprite or give base card chips.

    • no_rank: If true, enhanced card has no rank.

    • no_suit: If true, enhanced card has no suit.

    • overrides_base_rank: If true, enhancement cannot be generated by Grim, Familiar and Incantation (enhancements with no_rank set to true are automatically assigned this property).

    • any_suit: If true, enhanced card counts as any suit.

    • always_scores: If true, enhanced card always counts in scoring.

    • weight: The weighting of the enhancement, follows same rules as other weighted objects (default weight is 5).

    • config, supported values that will be calculated and scored automatically:

     	{
     		bonus,
             bonus_chips,
     		mult,
     		x_mult,
     		p_dollars,
             h_mult,
             h_x_mult,
     	}
    

API methods

  • loc_vars(self, info_queue, card) -> { vars ?= table }
    • Used for passing variables to enhancement descriptions.
  • get_weight(self) -> number
    • Used to modify the weight of enhancement on certain conditions.
  • calculate(self, card, context, effect)
    • Calculation for enhancements works slightly differently to other center objects. There is no return location for the method, so the effect table needs to be modified directly. An example of this would be,
    calculate = function(self, card, context, effect)
        if context.cardarea == G.play and not context.repetition then
            effect.x_mult = card.ability.extra.x_mult
        end
    end
    
  • draw(self, card, layer)
    • Draws the sprite and shader of the card.

Util methods

  • 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, if true, 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 with context = { 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): Returns true 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).