Skip to content

Commit e628a17

Browse files
authored
context.main_scoring for 'individual' areas (#1245)
* `context.main_scoring` for 'individual' areas * this shouldnt be here
1 parent efba244 commit e628a17

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lovely/better_calc.toml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,14 +602,29 @@ SMODS.calculate_context({full_hand = G.play.cards, scoring_hand = scoring_hand,
602602
603603
SMODS.displayed_hand = nil'''
604604

605-
# context.final_scoring_step
605+
# context.main_scoring for individual areas and context.final_scoring_step
606606
[[patches]]
607607
[patches.pattern]
608608
target = "functions/state_events.lua"
609609
pattern = '''local nu_chip, nu_mult = G.GAME.selected_back:trigger_effect{context = 'final_scoring_step', chips = hand_chips, mult = mult}'''
610610
match_indent = true
611611
position = "before"
612612
payload = '''
613+
--- context.main_scoring for individual area calculations
614+
for _, _area in ipairs(SMODS.get_card_areas('individual')) do
615+
local effects = {}
616+
-- Calculate context.main_scoring for individual areas
617+
local _eval, post = SMODS.eval_individual(_area, { full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, main_scoring = true })
618+
if next(_eval) then
619+
table.insert(effects, _eval)
620+
_eval.individual.juice_card = _area.scored_card
621+
for _, v in ipairs(post) do effects[#effects + 1] = v end
622+
end
623+
624+
SMODS.trigger_effects(effects, _area.scored_card)
625+
end
626+
627+
613628
-- context.final_scoring_step calculations
614629
SMODS.calculate_context({full_hand = G.play.cards, scoring_hand = scoring_hand, scoring_name = text, poker_hands = poker_hands, final_scoring_step = true})
615630

0 commit comments

Comments
 (0)