balatro-mods/Cryptid/lovely/Probability.toml

52 lines
1.6 KiB
TOML

[manifest]
version = "1.0.0"
dump_lua = true
priority = 5
# there's gonna be a lot of this
# init all cards with ability.cry_prob
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = "self.base_cost = center.cost or 1"
position = "before"
payload = '''
self.ability.cry_prob = 1
'''
match_indent = true
# define function in lovely
[[patches]]
[patches.pattern]
target = "functions/misc_functions.lua"
pattern = "function save_run()"
position = "before"
payload = '''
function cry_prob(owned, den, rigged)
prob = G.GAME and G.GAME.probabilities.normal or 1
if rigged then
return to_number(math.min(den, 1e300))
else
if owned then return to_number(math.min(prob*owned, 1e300)) else return to_number(math.min(prob, 1e300)) end
end
end
'''
match_indent = true
# wow this is a fat line
# Yellow Stake - Glass can't destroy Eternals
# Glass Stake - Any card can shatter
[[patches]]
[patches.pattern]
target = "functions/state_events.lua"
pattern = '''if SMODS.has_enhancement(scoring_hand[i], 'm_glass') and scoring_hand[i]:can_calculate() and pseudorandom('glass') < G.GAME.probabilities.normal/(scoring_hand[i].ability.name == 'Glass Card' and scoring_hand[i].ability.extra or G.P_CENTERS.m_glass.config.extra) then'''
position = "at"
payload = '''
if (SMODS.has_enhancement(scoring_hand[i], 'm_glass')
and not scoring_hand[i].debuff
and SMODS.pseudorandom_probability(scoring_hand[i], 'glass', 1, scoring_hand[i].ability.extra or G.P_CENTERS.m_glass.config.extra)
or (G.GAME.modifiers.cry_shatter_rate
and pseudorandom('cry_shatter') < 1 / G.GAME.modifiers.cry_shatter_rate))
and not SMODS.is_eternal(scoring_hand[i]) then'''
match_indent = true