From b8b68761168f58c86e8decab83ee6acef1309b46 Mon Sep 17 00:00:00 2001 From: stupxd Date: Mon, 6 Apr 2026 17:18:57 +0300 Subject: [PATCH 1/5] early wip modify_hand_chips --- lovely/scoring_calculation.toml | 34 +++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/lovely/scoring_calculation.toml b/lovely/scoring_calculation.toml index 80ae47379..1d2231be1 100644 --- a/lovely/scoring_calculation.toml +++ b/lovely/scoring_calculation.toml @@ -3,12 +3,42 @@ version = "1.0.0" dump_lua = true priority = -10 +# +# context.modify_hand_chips START +# + +# Calculate hand score just once +# Allow game objects to modify final score given by played hand +[[patches]] +[patches.pattern] +target = "functions/state_events.lua" +pattern = ''' +G.E_MANAGER:add_event(Event({ + trigger = 'after',delay = 0.4,''' +position = "before" +payload = ''' +local final_hand_chips = SMODS.calculate_round_score() + +local hand_chips_context = {modify_hand_chips = true, hand_chips = hand_chips} +SMODS.calculate_context(hand_chips_context) + +-- TODO support effects (this is very early impl) + +final_hand_chips = hand_chips_context.hand_chips +''' +match_indent = true + +# Use final_hand_chips value everywhere [[patches]] [patches.regex] target = "functions/state_events.lua" pattern = "^(.*)hand_chips\\s*\\*\\s*mult(.*)$" position = "at" -payload = '''$1 SMODS.calculate_round_score() $2''' +payload = '''$1 final_hand_chips $2''' + +# +# context.modify_hand_chips END +# [[patches]] [patches.pattern] @@ -206,7 +236,7 @@ pattern = ''' delay(0.3) ''' payload = ''' - SMODS.last_hand_oneshot = SMODS.calculate_round_score() > G.GAME.blind.chips + SMODS.last_hand_oneshot = final_hand_chips > G.GAME.blind.chips G.E_MANAGER:add_event(Event({ trigger = 'immediate', func = (function() From f4ae9c3e6cf9f1a593dd195da0539c40ae64f468 Mon Sep 17 00:00:00 2001 From: stupxd Date: Wed, 8 Apr 2026 16:18:55 +0300 Subject: [PATCH 2/5] include blind size, fix chips scoring --- lovely/scoring_calculation.toml | 7 ++++++- lovely/scoring_calculation_later.toml | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 lovely/scoring_calculation_later.toml diff --git a/lovely/scoring_calculation.toml b/lovely/scoring_calculation.toml index 1d2231be1..d75925043 100644 --- a/lovely/scoring_calculation.toml +++ b/lovely/scoring_calculation.toml @@ -19,12 +19,17 @@ position = "before" payload = ''' local final_hand_chips = SMODS.calculate_round_score() -local hand_chips_context = {modify_hand_chips = true, hand_chips = hand_chips} +local hand_chips_context = { + modify_hand_chips = true, + blind_chips = G.GAME.blind.chips, + hand_chips = final_hand_chips +} SMODS.calculate_context(hand_chips_context) -- TODO support effects (this is very early impl) final_hand_chips = hand_chips_context.hand_chips + ''' match_indent = true diff --git a/lovely/scoring_calculation_later.toml b/lovely/scoring_calculation_later.toml new file mode 100644 index 000000000..6b78c59e1 --- /dev/null +++ b/lovely/scoring_calculation_later.toml @@ -0,0 +1,20 @@ +[manifest] +version = "1.0.0" +dump_lua = true +priority = -9 + +# +# context.modify_hand_chips START +# + +# Calculate hand score just once +# Allow game objects to modify final score given by played hand +[[patches]] +[patches.pattern] +target = "functions/state_events.lua" +pattern = ''' +SMODS.calculate_context({full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, after = true})''' +position = "at" +payload = ''' +SMODS.calculate_context({full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, after = true, hand_chips = final_hand_chips})''' +match_indent = true From f2a8452291f1228573063e5b2982b01bfd1dfe7d Mon Sep 17 00:00:00 2001 From: stupxd Date: Sat, 2 May 2026 14:31:21 +0300 Subject: [PATCH 3/5] fix oneshot check --- lovely/scoring_calculation.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lovely/scoring_calculation.toml b/lovely/scoring_calculation.toml index d75925043..bef111fcc 100644 --- a/lovely/scoring_calculation.toml +++ b/lovely/scoring_calculation.toml @@ -241,7 +241,7 @@ pattern = ''' delay(0.3) ''' payload = ''' - SMODS.last_hand_oneshot = final_hand_chips > G.GAME.blind.chips + SMODS.last_hand_oneshot = final_hand_chips >= G.GAME.blind.chips G.E_MANAGER:add_event(Event({ trigger = 'immediate', func = (function() From fe65bb2f068cceb45ed402f5914fa624678393d9 Mon Sep 17 00:00:00 2001 From: stupxd Date: Sat, 2 May 2026 15:56:25 +0300 Subject: [PATCH 4/5] remove unfinished changes --- lovely/scoring_calculation.toml | 37 ++------------------------- lovely/scoring_calculation_later.toml | 20 --------------- 2 files changed, 2 insertions(+), 55 deletions(-) delete mode 100644 lovely/scoring_calculation_later.toml diff --git a/lovely/scoring_calculation.toml b/lovely/scoring_calculation.toml index bef111fcc..1f7170be9 100644 --- a/lovely/scoring_calculation.toml +++ b/lovely/scoring_calculation.toml @@ -3,47 +3,14 @@ version = "1.0.0" dump_lua = true priority = -10 -# -# context.modify_hand_chips START -# - -# Calculate hand score just once -# Allow game objects to modify final score given by played hand -[[patches]] -[patches.pattern] -target = "functions/state_events.lua" -pattern = ''' -G.E_MANAGER:add_event(Event({ - trigger = 'after',delay = 0.4,''' -position = "before" -payload = ''' -local final_hand_chips = SMODS.calculate_round_score() - -local hand_chips_context = { - modify_hand_chips = true, - blind_chips = G.GAME.blind.chips, - hand_chips = final_hand_chips -} -SMODS.calculate_context(hand_chips_context) - --- TODO support effects (this is very early impl) - -final_hand_chips = hand_chips_context.hand_chips - -''' -match_indent = true - # Use final_hand_chips value everywhere [[patches]] [patches.regex] target = "functions/state_events.lua" pattern = "^(.*)hand_chips\\s*\\*\\s*mult(.*)$" position = "at" -payload = '''$1 final_hand_chips $2''' +payload = '''$1 SMODS.calculate_round_score() $2''' -# -# context.modify_hand_chips END -# [[patches]] [patches.pattern] @@ -241,7 +208,7 @@ pattern = ''' delay(0.3) ''' payload = ''' - SMODS.last_hand_oneshot = final_hand_chips >= G.GAME.blind.chips + SMODS.last_hand_oneshot = SMODS.calculate_round_score() > G.GAME.blind.chips G.E_MANAGER:add_event(Event({ trigger = 'immediate', func = (function() diff --git a/lovely/scoring_calculation_later.toml b/lovely/scoring_calculation_later.toml deleted file mode 100644 index 6b78c59e1..000000000 --- a/lovely/scoring_calculation_later.toml +++ /dev/null @@ -1,20 +0,0 @@ -[manifest] -version = "1.0.0" -dump_lua = true -priority = -9 - -# -# context.modify_hand_chips START -# - -# Calculate hand score just once -# Allow game objects to modify final score given by played hand -[[patches]] -[patches.pattern] -target = "functions/state_events.lua" -pattern = ''' -SMODS.calculate_context({full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, after = true})''' -position = "at" -payload = ''' -SMODS.calculate_context({full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, after = true, hand_chips = final_hand_chips})''' -match_indent = true From f7fc850a9047b5677d2e418631996d0cdc677a05 Mon Sep 17 00:00:00 2001 From: stupxd Date: Sat, 2 May 2026 16:26:36 +0300 Subject: [PATCH 5/5] forgor to remove --- lovely/scoring_calculation.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/lovely/scoring_calculation.toml b/lovely/scoring_calculation.toml index 1f7170be9..80ae47379 100644 --- a/lovely/scoring_calculation.toml +++ b/lovely/scoring_calculation.toml @@ -3,7 +3,6 @@ version = "1.0.0" dump_lua = true priority = -10 -# Use final_hand_chips value everywhere [[patches]] [patches.regex] target = "functions/state_events.lua" @@ -11,7 +10,6 @@ pattern = "^(.*)hand_chips\\s*\\*\\s*mult(.*)$" position = "at" payload = '''$1 SMODS.calculate_round_score() $2''' - [[patches]] [patches.pattern] target = "functions/misc_functions.lua"