-
Notifications
You must be signed in to change notification settings - Fork 81
SMODS.Edition
Class prefix: e
-
Required parameters:
key
-
shader
: the shader key for your shader.shader = false
is allowed. This will create edition with no shader. -
loc_txt
or localization entry (reference)-
loc_txt
should contain an additionallabel
string. It is used on badges, whilename
is displayed at the top of info boxes. For use with localization files, this label should be placed inmisc.labels
(without thee_
prefix).
-
-
Optional parameters (defaults):
-
atlas = 'Joker', pos = { x = 0, y = 0 }
(reference)- This defines the card to draw the edition on in the collection.
-
config = {}, unlocked = true, discovered = false, no_collection, prefix_config, dependencies
(reference)- The following base values for
config
are supported and will be applied/scored automatically:
{ chips = 10, mult = 10, x_mult = 2, p_dollars = 3, card_limit = 2, }
- The following base values for
-
in_shop = false
: Whether the edition can spawn naturally in the shop/booster packs. -
weight = 0
: The weighting of the edition, see below for more details. -
extra_cost
: The extra cost applied to cards in the shop with the edition. -
apply_to_float = false
: Whether the shader should be applied to floating sprites or not. -
badge_colour = G.C.DARK_EDITION
: Used to set a custom badge colour. -
sound = { sound = "foil1", per = 1.2, vol = 0.4 }
: Used to set a custom sound when the edition is applied. -
disable_shadow
: Disables shadow drawn under the card. -
disable_base_shader = false
: Whether the base shader should be applied (booster
for Booster packs and Spectral cards,voucher
for Vouchers and Invisible Joker,dissolve
otherwise). Enable this if your shader modifies card transparency or shape in any way. Example:
-
-
loc_vars
(reference)- Only
vars
,key
andset
return values are currently supported for editions.
- Only
-
get_weight(self) -> number
- Used to modify the weight of edition on certain conditions.
-
on_apply(card) -> void
- Used to modify Card when edition is applied
-
on_remove(card) -> void
- Used to modify Card when edition is removed
-
on_load(card) -> void
- Used to modify Card with edition when it is loaded from save file.
-
draw(self, card, layer)
- Draws the edition's shader.
self.shader
is drawn by default when this is absent.
- Draws the edition's shader.
A shader is required for a custom edition.
-
Required parameters:
key
-
path
: The file name of your shader. Shaders must be stored inassets/shaders/
and be a.fs
file.- The shader's
key
, file name (without extension) and the shader name used in the GLSL file must be identical.
- The shader's
-
send_vars(sprite, @nullable card) -> table
ionized.fs has shader code explanation with comments. For a general guide, look at LOVE2D introduction to shaders.
If you want to see vanilla Balatro shaders, unzip the Balatro.exe and go to resources/shaders
folder.
To see values for default externs, check out engine/sprite.lua
-> Sprite:draw_shader
.
- The book of shaders - beginner friendly introduction to shaders.
- GLSL Editor - preview your fragment shaders live.
- GLSL Image Processing System - preview your fragment shaders live. The program additionally provides some built-in shaders as examples.
- Inigo Quilez articles - in-depth articles on algorithms and techniques you could use in shaders. A lot of those are for 3D, but there's some 2D stuff as well.
- Shadertoy - tons of shaders from other people to learn from. A lot of them are pretty complex and 3D, but you can find simple 2D ones.
Note: in all resources the language is slightly different from LOVE2D shaders language, but the logic works the same way.
The default game editions have the following weights
negative = 3
polychrome = 3 (takes negative's weight in some circumstances)
holographic = 14
foil = 20
The base chance for an edition to appear in the shop is 4%, thus there is a 2% chance for a foil joker to appear. Adding custom editions to the shop maintains this 4% chance. Therefore, if you add an edition with a weight of 40, it will have a 2% chance to spawn, and foil will be reduced to 1% chance.
When the Hone and Glow Up vouchers are purchased, the weights of the base editions are adjusted. Custom editions do not have this bonus applied by default. This means that the vouchers do not increase the edition chances to 8%/16%, but rather increase the chances of the default editions by 2X and 4X respectively. To add your edition to the Hone and Glow Up functionality, add this to your edition definition.
get_weight = function(self)
return G.GAME.edition_rate * self.weight
end
-
Card:set_edition(edition, immediate, silent)
-
edition
,nil
removes edition,key
of edition as a string -
immediate
, boolean -
silent
, boolean Use this function to set the edition of a card
-
-
poll_edition(_key, _mod, _no_neg, _guaranteed, _options)
(defaults)-
_key = edition_generic
, string - key value for a random seed -
_mod = 1
, number - scale of chance against base card -
_no_neg = false
, boolean - disables negative edition chance (chance is added to polychrome) -
_guaranteed = false
, boolean - disables base card -
_options = all editions marked in_shop
, table - List of editions to poll. Two variations. Option 1 - list of keys for included editions. This method respects defined weights,
{"e_foil", "e_holo","e_negative"}
Option 2 - table of keys and weights. Used to override default weights,
{ e_foil = 1, e_holo = 1, e_negative = 1 }
-
Game Objects
- API Documentation
- SMODS.Achievement
- SMODS.Atlas
- SMODS.Blind
- SMODS.Center
- SMODS.Challenge
- SMODS.DeckSkin
- SMODS.Keybind
- SMODS.Language
- SMODS.ObjectType
- SMODS.PokerHand
- SMODS.Rarity
- SMODS.Seal
- SMODS.Sound
- SMODS.Stake
- SMODS.Sticker
- SMODS.Suit and SMODS.Rank
- SMODS.Tag
Guides
- Your First Mod
- Mod Metadata
- Joker Calculation
- Calculate Functions
- Logging
- Event Manager
- Localization
- Mod functions
- UI Structure
- Utility Functions
Found an issue, or want to add something? Submit a PR to the Wiki repo.