Skip to content

Commit 84895c0

Browse files
authored
fix Sapphire stake (#816)
* fix Sapphire stake * fix Glass stake
1 parent 4623f03 commit 84895c0

File tree

4 files changed

+32
-23
lines changed

4 files changed

+32
-23
lines changed

items/stake.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ local glass = {
179179
shiny = true,
180180
order = 21,
181181
colour = HEX("ffffff8f"),
182+
calculate = function(self, context)
183+
if context.destroy_card and context.cardarea == G.play and G.GAME.modifiers.cry_shatter_rate
184+
and SMODS.pseudorandom_probability(self, 'cry_shatter', 1, G.GAME.modifiers.cry_shatter_rate) and not SMODS.is_eternal(context.destroy_card) then
185+
context.destroy_card.cry_glass_trigger = true
186+
return { remove = true }
187+
end
188+
end,
182189
}
183190
local sapphire = {
184191
object_type = "Stake",

lib/overrides.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,3 +2310,8 @@ function UIElement:draw_self()
23102310
end
23112311
draw_self(self)
23122312
end
2313+
2314+
local smods_shatters_ref = SMODS.shatters
2315+
function SMODS.shatters(card)
2316+
return card.cry_glass_trigger or smods_shatters_ref(card)
2317+
end

lovely/Probability.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ match_indent = true
3737
# wow this is a fat line
3838
# Yellow Stake - Glass can't destroy Eternals
3939
# Glass Stake - Any card can shatter
40-
[[patches]]
41-
[patches.pattern]
42-
target = "functions/state_events.lua"
43-
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'''
44-
position = "at"
45-
payload = '''
46-
if (SMODS.has_enhancement(scoring_hand[i], 'm_glass')
47-
and not scoring_hand[i].debuff
48-
and SMODS.pseudorandom_probability(scoring_hand[i], 'glass', 1, scoring_hand[i].ability.extra or G.P_CENTERS.m_glass.config.extra)
49-
or (G.GAME.modifiers.cry_shatter_rate
50-
and pseudorandom('cry_shatter') < 1 / G.GAME.modifiers.cry_shatter_rate))
51-
and not SMODS.is_eternal(scoring_hand[i]) then'''
52-
match_indent = true
40+
# [[patches]]
41+
# [patches.pattern]
42+
# target = "functions/state_events.lua"
43+
# 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'''
44+
# position = "at"
45+
# payload = '''
46+
# if (SMODS.has_enhancement(scoring_hand[i], 'm_glass')
47+
# and not scoring_hand[i].debuff
48+
# and SMODS.pseudorandom_probability(scoring_hand[i], 'glass', 1, scoring_hand[i].ability.extra or G.P_CENTERS.m_glass.config.extra)
49+
# or (G.GAME.modifiers.cry_shatter_rate
50+
# and pseudorandom('cry_shatter') < 1 / G.GAME.modifiers.cry_shatter_rate))
51+
# and not SMODS.is_eternal(scoring_hand[i]) then'''
52+
# match_indent = true

lovely/stake.toml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,13 @@ match_indent = true
285285

286286

287287
# Sapphire Stake - ante tax
288-
# The Joke boss effect
289-
# Save game state for Revert
290-
# this needs to be redone at a later point
291-
# [[patches]]
292-
#[patches.pattern]
293-
#target = "functions/state_events.lua"
294-
#pattern = "delay(0.4); ease_ante(1); delay(0.4); check_for_unlock({type = 'ante_up', ante = G.GAME.round_resets.ante + 1})"
295-
#position = "at"
296-
#payload = "delay(0.4); ease_ante(G.GAME.blind and G.GAME.blind:cry_calc_ante_gain() or 1); Cryptid.apply_ante_tax(); delay(0.4); check_for_unlock({type = 'ante_up', ante = G.GAME.round_resets.ante + 1})"
297-
#match_indent = true
288+
[[patches]]
289+
[patches.pattern]
290+
target = "functions/state_events.lua"
291+
pattern = "delay(0.4); SMODS.ante_end = true; ease_ante(1); SMODS.ante_end = nil; delay(0.4); check_for_unlock({type = 'ante_up', ante = G.GAME.round_resets.ante + 1})"
292+
position = "at"
293+
payload = "delay(0.4); SMODS.ante_end = true; ease_ante(1); Cryptid.apply_ante_tax(); SMODS.ante_end = nil; delay(0.4); check_for_unlock({type = 'ante_up', ante = G.GAME.round_resets.ante + 1})"
294+
match_indent = true
298295

299296

300297
# Emerald Stake - Permanently flipped cards

0 commit comments

Comments
 (0)