Center Hook Documentation - nicholassam6425/balatro-mods GitHub Wiki
List of methods, their parameters, and what they return
-
centerHook.addJoker adds a joker card to the game
- parameters:
- id (string): the internal name of the joker card (i.e "j_jokers_arachnei")
- I'd suggest adding a unique modifier to your id, like how I add my name to the end of the id to avoid easily avoidable mod conflicts.
- name (string): the actual name of the joker card (i.e "Jokers")
- This is used both for the display name of the card, as well as for how the game knows which 'card' is currently being calculated. I may separate these two values in the future to avoid mod conflicts
- use_effect (function): a function that describes how the joker works
- You must pass THE FUNCTION, not the result. The function MUST take
(card, context)
as input. Higher up in this readme is documentation on contexts, I'll be writing one for card functions soon. I'll also be writing a different section on what a joker card should return fromCard:calculate_joker
- You must pass THE FUNCTION, not the result. The function MUST take
- order (int): a number that describes which order to show jokers in the collection
- This one you can leave as
nil
if you're unsure. By doing so, it'll load jokers in by mod loading order.
- This one you can leave as
- unlocked (bool): a boolean that describes if a joker is unlocked or not (true = unlocked)
- I haven't tested anything with this yet. I think it currently works in the back end, but it'll display the card sprite in the collection if you set it to locked
- discovered (bool): a boolean that describes if a joker is discovered or not (true = discovered)
- I also haven't tested anything with this. Same hypothesis as unlocked
- cost (int): a number that describes the cost of the joker
- pos (table: {x=int, y=int}): a table that describes the sprite position in the sprite sheet
- If you don't have a sprite, use
nil
, it'll use a placeholder sprite. x and y start at 0 in the top left. If you use individual sprites like I do, your pos will always be{x=0,y=0}
- If you don't have a sprite, use
- effect (string): an internal description of the card effect
- I don't think this actually does anything for jokers. I usually leave this as
nil
, which sets it to an empty string. If you find anything, lmk
- I don't think this actually does anything for jokers. I usually leave this as
- config (table): a table that contains values that get loaded into
card.ability
- See Joker.config.
- desc (table of strings): a table of strings that contains the actual description of the card
- I'll write a separate section of description formatting soon. For now:
{C:attention}text{}
for cards,{C:red}text{}
for mult, and{C:chips}text{}
for chips. You can find all the game's descriptions in the localization folder of the decompiled game
- I'll write a separate section of description formatting soon. For now:
- rarity (int): a number that describes the joker's rarity
- 1 for Common, 2 for Uncommon, 3 for Rare, 4 for Legendary. Does not support any other rarities as of right now.
- blueprint_compat (bool): for if blueprint/brainstorm will show as incompatible or not
- This only visually makes blueprint/brainstorm show as incompatible. You have to include
not context.blueprint
in your joker's conditions if you want it to actually not be copied
- This only visually makes blueprint/brainstorm show as incompatible. You have to include
- eternal_compat (bool): for if this joker can be eternal or not
- I haven't tested this at all. If your joker has a sell/destroy related ability consider this paramater
- no_pool_flag (string): if this flag exists, the joker will not show up in game
- This is used for Gros Michel. I also haven't tested this either. Try looking at Gros Michel's portion in
Card:calculate_joker
for some guidance
- This is used for Gros Michel. I also haven't tested this either. Try looking at Gros Michel's portion in
- yes_pool_flag (string): if this flag doesn't exist, this joker will not show up in game
- Used for Cavendish. Also haven't tested this. Try looking at Gros Michel's portion in
Card:calculate_joker
for guidance
- Used for Cavendish. Also haven't tested this. Try looking at Gros Michel's portion in
- unlock_condition (table): A table defining unlock conditions for the joker
- alerted (bool): Defines if the joker will have an alert or not in the collection
- Thank you HeyImKyu for finding this.
- sprite_path (string)
- sprite_name (string)
- sprite_size (table {px=int, py=int})
[!WARNING] You MUST have 1x and 2x folders in your
sprite_path
folder.- If your sprites are located in
Roaming/Balatro/assets/1x
orRoaming/Balatro/assets/2x
, then yoursprite_path
will simply be"assets"
. I'll look at making this more flexible in the future.
- If your sprites are located in
- id (string): the internal name of the joker card (i.e "j_jokers_arachnei")
- returns:
- newJoker (table): the table that defines that card that gets loaded into the game
- newJokerText (table): the table that holds all the card text data
- parameters:
-
centerHook.removeJoker remove a modded joker from the game
- parameters:
- id (string): the id you used to add the joker to the game
- returns:
- nothing
- parameters:
-
centerHook.addTarot & centerHook.addSpectral & centerHook.addPlanet adds a tarot/spectral/planet card to the game
(yeah they're pretty much the same)
- parameters:
- id (string): the internal name of the consumeable card (i.e "c_humanity_arachnei")
- I'd suggest adding a unique modifier to your id, like how I add my name to the end of the id to avoid easily avoidable mod conflicts.
- name (string): the actual name of the consumeable card (i.e "Jokers")
- This is used both for the display name of the card, as well as for how the game knows which 'card' is currently being used. I may separate these two values in the future to avoid mod conflicts
- use_effect (function): the function that describes what happens when the card is used
- This function does not need a
return
inside of it. All operations done in this should be using the game's event manager to time the animations of the effect. For guidance, look at either mymods/c_humanity.lua
or the vanilla cards in the decompiled source code.
- This function does not need a
- use_condition (function): the function that defines the use conditions of the card
- This function must return
true
when the card is available to be used. For guidance, look at either mymods/c_humanity.lua
or the vanilla cards in the decompiled source code.
- This function must return
- order (int): a number that the game uses to order the cards in the collection tab
- If you're unsure what to put here, leave it as
nil
. It will add it to the end of the collection.
- If you're unsure what to put here, leave it as
- discovered (bool): defines whether or not the card is discovered in the collection or not
- I haven't tested this. I think it functionally works, but visually will not use the undiscovered card sprite in the collection.
- cost (int): the cost of the card
- pos (table: {x=int, y=int}): defines the position of the card's sprite in the spritesheet
- If left as
nil
, it will use a blank sprite. x and y start from 0, in the top left of the sprite sheet.
- If left as
- config (table): a table of numerical values used in the card
- Usually stored in
card.ability.consumeable
- Usually stored in
- desc (table of strings): the displayed description text of the card
- I'll write a separate section of description formatting soon. For now:
{C:attention}text{}
for cards,{C:red}text{}
for mult, and{C:chips}text{}
for chips. You can find all the game's descriptions in the localization folder of the decompiled game
- I'll write a separate section of description formatting soon. For now:
- alerted (bool): Defines if the joker will have an alert or not in the collection
- Thank you HeyImKyu for finding this.
- sprite_path (string)
- sprite_name (string)
- sprite_size (table {px=int, py=int})
[!WARNING] You MUST have 1x and 2x folders in your
sprite_path
folder.- If your sprites are located in
Roaming/Balatro/assets/1x
orRoaming/Balatro/assets/2x
, then yoursprite_path
will simply be"assets"
. I'll look at making this more flexible in the future.
- If your sprites are located in
- id (string): the internal name of the consumeable card (i.e "c_humanity_arachnei")
- returns:
- newTarot/newSpectral/newPlanet (table): the table that defines that card that gets loaded into the game
- newTarotText/newSpectralText/newPlanetText (table): the table that holds all the card text data
- parameters:
-
centerHook.removeTarot & centerHook.removeSpectral & centerHook.removePlanet remove a modded tarot/spectral/planet from the game
- parameters:
- id (string): the id you used to add the card to the game
- returns:
- nothing
- parameters:
-
centerHook.addVoucher add a voucher to the game
- parameters:
- id (string): the internal name of the consumeable card (i.e "c_humanity_arachnei")
- I'd suggest adding a unique modifier to your id, like how I add my name to the end of the id to avoid easily avoidable mod conflicts.
- name (string): the actual name of the consumeable card (i.e "Jokers")
- This is used both for the display name of the card, as well as for how the game knows which 'card' is currently being used. I may separate these two values in the future to avoid mod conflicts
- voucher_effect (function): the effect ON REDEEM
- This function does not require a
return
statement. This effect only happens once, when the voucher is redeemed. Hobby Shop does not have an on-redeem effect, and rather changes how the shop reroll functions.
- This function does not require a
- order (int): a number that the game uses to order the cards in the collection tab
- If you're unsure what to put here, leave it as
nil
. It will add it to the end of the collection.
- If you're unsure what to put here, leave it as
- discovered (bool): defines whether or not the card is discovered in the collection or not
- I haven't tested this. I think it functionally works, but visually will not use the undiscovered card sprite in the collection.
- cost (int): the cost of the card
- pos (table: {x=int, y=int}): defines the position of the card's sprite in the spritesheet
- If left as
nil
, it will use a blank sprite. x and y start from 0, in the top left of the sprite sheet.
- If left as
- config (table): a table of numerical values used in the card
- Not really needed for a voucher, I don't think
- requires (table of string): a table of voucher ids required before this voucher will appear in shops
- I'm actually not sure if this allows more than 1 string. There's no example of it in the base game, and I don't actually know where the code for the require is. Use more than 2 requires with caution.
- desc (table of strings): the displayed description text of the card
- I'll write a separate section of description formatting soon. For now:
{C:attention}text{}
for cards,{C:red}text{}
for mult, and{C:chips}text{}
for chips. You can find all the game's descriptions in the localization folder of the decompiled game
- I'll write a separate section of description formatting soon. For now:
- alerted (bool): Defines if the joker will have an alert or not in the collection
- Thank you HeyImKyu for finding this.
- sprite_path (string)
- sprite_name (string)
- sprite_size (table {px=int, py=int})
[!WARNING] You MUST have 1x and 2x folders in your
sprite_path
folder.- If your sprites are located in
Roaming/Balatro/assets/1x
orRoaming/Balatro/assets/2x
, then yoursprite_path
will simply be"assets"
. I'll look at making this more flexible in the future.
- If your sprites are located in
- id (string): the internal name of the consumeable card (i.e "c_humanity_arachnei")
- returns:
- newVoucher (table): the table that defines that card that gets loaded into the game
- newVoucherText (table): the table that holds all the card text data
- parameters:
-
centerHook.removeVoucher remove a MODDED voucher from the game
- parameters:
- id (string): the id you used to add the card to the game
- returns:
- nothing
- parameters:
-
centerHook.addBooster add a booster pack to the game
- parameters:
- id (string): the internal name of the consumeable card (i.e "c_humanity_arachnei")
- I'd suggest adding a unique modifier to your id, like how I add my name to the end of the id to avoid easily avoidable mod conflicts.
- name (string): the actual name of the consumeable card (i.e "Jokers")
- This is used both for the display name of the card, as well as for how the game knows which 'card' is currently being used. I may separate these two values in the future to avoid mod conflicts
- pack_contents (function): function that returns the pack contents
- This is called
config.extra
times. It should return 1card
object. Vanilla examples are found inCard:open
incard.lua
- order (int): a number that the game uses to order the cards in the collection tab
- If you're unsure what to put here, leave it as
nil
. It will add it to the end of the collection.
- This is called
- discovered (bool): defines whether or not the card is discovered in the collection or not
- I haven't tested this. I think it functionally works, but visually will not use the undiscovered card sprite in the collection.
- weight (float): the likelihood the booster pack will appear in the shop
- lower number = lower rate. Vanilla weights are 0.15-1.0. IMO avoid using weights over 1.5, except for testing reasons, as it would make your booster appear much too frequently
- kind (string): what 'kind' of booster pack it is
- i'm pretty sure this actually isnt even used in game logic. would be nice if it did, but the game checks what booster pack is being opened by name rather than 'kind' so... yeah.
- cost (int): the cost of the card
- pos (table: {x=int, y=int}): defines the position of the card's sprite in the spritesheet
- If left as
nil
, it will use a blank sprite. x and y start from 0, in the top left of the sprite sheet.
- If left as
- config (table): a table of numerical values used in the card
- REQUIRES {extra: int, choose: int}
extra
represents how many cards you can choose out of,choose
represents how many cards you can choose. I.E Mega Buffoon Pack would be{extra=4, choose=2}
- requires (table of string): a table of voucher ids required before this voucher will appear in shops
- I'm actually not sure if this allows more than 1 string. There's no example of it in the base game, and I don't actually know where the code for the require is. Use more than 2 requires with caution.
- desc (table of strings): the displayed description text of the card
- I'll write a separate section of description formatting soon. For now:
{C:attention}text{}
for cards,{C:red}text{}
for mult, and{C:chips}text{}
for chips. You can find all the game's descriptions in the localization folder of the decompiled game
- I'll write a separate section of description formatting soon. For now:
- alerted (bool): Defines if the joker will have an alert or not in the collection
- Thank you HeyImKyu for finding this.
- sprite_path (string)
- sprite_name (string)
- sprite_size (table {px=int, py=int})
[!WARNING] You MUST have 1x and 2x folders in your
sprite_path
folder.- If your sprites are located in
Roaming/Balatro/assets/1x
orRoaming/Balatro/assets/2x
, then yoursprite_path
will simply be"assets"
. I'll look at making this more flexible in the future.
- If your sprites are located in
- id (string): the internal name of the consumeable card (i.e "c_humanity_arachnei")
- returns:
- newBooster (table): the table that defines that card that gets loaded into the game
- newBoosterText (table): the table that holds all the card text data
- parameters:
-
centerHook.removeBooster remove a MODDED booster from the game
- parameters:
- id (string): the id you used to add the card to the game
- returns:
- nothing
- parameters: