Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lovely/better_calc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'''
Expand Down Expand Up @@ -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
'''
Expand Down Expand Up @@ -2000,4 +2005,4 @@ if ret then
ret.colour = G.C.RED
return ret
end
'''
'''
11 changes: 10 additions & 1 deletion src/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -3428,4 +3437,4 @@ function SMODS.get_clean_pool(_type, _rarity, _legendary, _append)
end
end
return clean_pool
end
end