From df5b657919fe9d6ff152276846b62865f8d15894 Mon Sep 17 00:00:00 2001 From: Ruby <138878489+lord-ruby@users.noreply.github.com> Date: Tue, 27 Jan 2026 15:03:49 +0000 Subject: [PATCH 1/7] pass winning hand info into context.end_of_round --- lovely/better_calc.toml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lovely/better_calc.toml b/lovely/better_calc.toml index f2357b8e1..bb0344859 100644 --- a/lovely/better_calc.toml +++ b/lovely/better_calc.toml @@ -738,6 +738,9 @@ match_indent = true position = "at" payload = ''' -- context.after calculations +local cards = {} +for i, v in pairs(G.play.cards) do cards[#cards+1] = v end +SMODS.last_hand = {scoring_hand = scoring_hand, scoring_name = text, full_hand = cards} SMODS.calculate_context({full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, after = true}) -- TARGET: effects after hand evaluation''' @@ -828,7 +831,8 @@ payload = ''' -- context.end_of_round calculations SMODS.saved = false G.GAME.saved_text = nil -SMODS.calculate_context({end_of_round = true, game_over = game_over, beat_boss = G.GAME.blind.boss }) +SMODS.calculate_context({end_of_round = true, game_over = game_over, beat_boss = G.GAME.blind.boss, scoring_hand = SMODS.last_hand.scoring_hand, scoring_name = SMODS.last_hand.scoring_name, full_hand = SMODS.scoring_hand.full_hand }) +SMODS.last_hand = nil if SMODS.saved then game_over = false end -- TARGET: main end_of_round evaluation ''' @@ -2000,4 +2004,4 @@ if ret then ret.colour = G.C.RED return ret end -''' \ No newline at end of file +''' From 20585a66fe2e02fb61ca4504ad3f759aaef256c8 Mon Sep 17 00:00:00 2001 From: Ruby <138878489+lord-ruby@users.noreply.github.com> Date: Tue, 27 Jan 2026 15:36:10 +0000 Subject: [PATCH 2/7] Update better_calc.toml --- lovely/better_calc.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lovely/better_calc.toml b/lovely/better_calc.toml index bb0344859..39e36f7e9 100644 --- a/lovely/better_calc.toml +++ b/lovely/better_calc.toml @@ -831,7 +831,7 @@ payload = ''' -- context.end_of_round calculations SMODS.saved = false G.GAME.saved_text = nil -SMODS.calculate_context({end_of_round = true, game_over = game_over, beat_boss = G.GAME.blind.boss, scoring_hand = SMODS.last_hand.scoring_hand, scoring_name = SMODS.last_hand.scoring_name, full_hand = SMODS.scoring_hand.full_hand }) +SMODS.calculate_context({end_of_round = true, game_over = game_over, beat_boss = G.GAME.blind.boss, scoring_hand = SMODS.last_hand.scoring_hand, scoring_name = SMODS.last_hand.scoring_name, full_hand = SMODS.last_hand.full_hand }) SMODS.last_hand = nil if SMODS.saved then game_over = false end -- TARGET: main end_of_round evaluation From aa5c028b157ea068f097f7cddd42f3df88d8fa43 Mon Sep 17 00:00:00 2001 From: Ruby <138878489+lord-ruby@users.noreply.github.com> Date: Tue, 27 Jan 2026 16:13:16 +0000 Subject: [PATCH 3/7] fix crash when winning without playing a hand --- lovely/better_calc.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/lovely/better_calc.toml b/lovely/better_calc.toml index 39e36f7e9..42894f9e2 100644 --- a/lovely/better_calc.toml +++ b/lovely/better_calc.toml @@ -831,6 +831,7 @@ payload = ''' -- context.end_of_round calculations SMODS.saved = false G.GAME.saved_text = nil +SMODS.last_hand = SMODS.last_hand or {scoring_hand = {}, full_hand = {}} SMODS.calculate_context({end_of_round = true, game_over = game_over, beat_boss = G.GAME.blind.boss, scoring_hand = SMODS.last_hand.scoring_hand, scoring_name = SMODS.last_hand.scoring_name, full_hand = SMODS.last_hand.full_hand }) SMODS.last_hand = nil if SMODS.saved then game_over = false end From ce00c197f49f37d8b5909ab20f49f73dd60e2395 Mon Sep 17 00:00:00 2001 From: Ruby <138878489+lord-ruby@users.noreply.github.com> Date: Tue, 27 Jan 2026 16:15:25 +0000 Subject: [PATCH 4/7] cull destroyed cards from last_hand --- src/utils.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils.lua b/src/utils.lua index c67e7374b..127ca1320 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -2088,6 +2088,15 @@ function SMODS.calculate_destroying_cards(context, cards_destroyed, scoring_hand end cards_destroyed[#cards_destroyed+1] = card end + --cull destroyed cards from last_hand + if SMODS.last_hand then + local scoring = {} + local full = {} + for i, v in pairs(SMODS.last_hand.scoring_hand) do if not v.getting_sliced then scoring[#scoring+1] = v end end + for i, v in pairs(SMODS.last_hand.full_hand) do if not v.getting_sliced then full[#full+1] = v end end + SMODS.last_hand.scoring_hand = scoring + SMODS.last_hand.full_hand = full + end end end @@ -3428,4 +3437,4 @@ function SMODS.get_clean_pool(_type, _rarity, _legendary, _append) end end return clean_pool -end \ No newline at end of file +end From 1dce1679447371ed3a2a31ad7622a8ec28902405 Mon Sep 17 00:00:00 2001 From: Ruby <138878489+lord-ruby@users.noreply.github.com> Date: Tue, 27 Jan 2026 16:16:10 +0000 Subject: [PATCH 5/7] move setting last_hand earlier --- lovely/better_calc.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lovely/better_calc.toml b/lovely/better_calc.toml index 42894f9e2..69ccee18c 100644 --- a/lovely/better_calc.toml +++ b/lovely/better_calc.toml @@ -586,6 +586,7 @@ match_indent = true position = "at" payload = ''' -- context.before calculations +SMODS.last_hand = {scoring_hand = scoring_hand, scoring_name = text, full_hand = cards} SMODS.calculate_context({full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, before = true}) -- TARGET: effects before scoring starts @@ -740,7 +741,6 @@ payload = ''' -- context.after calculations local cards = {} for i, v in pairs(G.play.cards) do cards[#cards+1] = v end -SMODS.last_hand = {scoring_hand = scoring_hand, scoring_name = text, full_hand = cards} SMODS.calculate_context({full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, after = true}) -- TARGET: effects after hand evaluation''' From 18a6981bf6a79b2190ef4fe0d8c046d387228278 Mon Sep 17 00:00:00 2001 From: Ruby <138878489+lord-ruby@users.noreply.github.com> Date: Tue, 27 Jan 2026 16:21:52 +0000 Subject: [PATCH 6/7] Update utils.lua --- src/utils.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/utils.lua b/src/utils.lua index 127ca1320..5276e2dbc 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -2088,16 +2088,16 @@ function SMODS.calculate_destroying_cards(context, cards_destroyed, scoring_hand end cards_destroyed[#cards_destroyed+1] = card end - --cull destroyed cards from last_hand - if SMODS.last_hand then - local scoring = {} - local full = {} - for i, v in pairs(SMODS.last_hand.scoring_hand) do if not v.getting_sliced then scoring[#scoring+1] = v end end - for i, v in pairs(SMODS.last_hand.full_hand) do if not v.getting_sliced then full[#full+1] = v end end - SMODS.last_hand.scoring_hand = scoring - SMODS.last_hand.full_hand = full - end end + --cull destroyed cards from last_hand + if SMODS.last_hand then + local scoring = {} + local full = {} + for i, v in pairs(SMODS.last_hand.scoring_hand) do if not v.getting_sliced then scoring[#scoring+1] = v end end + for i, v in pairs(SMODS.last_hand.full_hand) do if not v.getting_sliced then full[#full+1] = v end end + SMODS.last_hand.scoring_hand = scoring + SMODS.last_hand.full_hand = full + end end function SMODS.blueprint_effect(copier, copied_card, context) From dfc88c067791650a913ec6854256b89394a8b293 Mon Sep 17 00:00:00 2001 From: Ruby <138878489+lord-ruby@users.noreply.github.com> Date: Wed, 28 Jan 2026 14:10:02 +0000 Subject: [PATCH 7/7] Update utils.lua --- src/utils.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.lua b/src/utils.lua index 5276e2dbc..ca67d2300 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -2093,8 +2093,8 @@ function SMODS.calculate_destroying_cards(context, cards_destroyed, scoring_hand if SMODS.last_hand then local scoring = {} local full = {} - for i, v in pairs(SMODS.last_hand.scoring_hand) do if not v.getting_sliced then scoring[#scoring+1] = v end end - for i, v in pairs(SMODS.last_hand.full_hand) do if not v.getting_sliced then full[#full+1] = v end end + for i, v in pairs(SMODS.last_hand.scoring_hand or {}) do if not v.getting_sliced then scoring[#scoring+1] = v end end + for i, v in pairs(SMODS.last_hand.full_hand or {}) do if not v.getting_sliced then full[#full+1] = v end end SMODS.last_hand.scoring_hand = scoring SMODS.last_hand.full_hand = full end