diff --git a/lovely/better_calc.toml b/lovely/better_calc.toml index f2357b8e1..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 @@ -738,6 +739,8 @@ 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.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,9 @@ 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.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 -- TARGET: main end_of_round evaluation ''' @@ -2000,4 +2005,4 @@ if ret then ret.colour = G.C.RED return ret end -''' \ No newline at end of file +''' diff --git a/src/utils.lua b/src/utils.lua index c67e7374b..ca67d2300 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -2089,6 +2089,15 @@ function SMODS.calculate_destroying_cards(context, cards_destroyed, scoring_hand cards_destroyed[#cards_destroyed+1] = card 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 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 end function SMODS.blueprint_effect(copier, copied_card, context) @@ -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