diff --git a/config.lua b/config.lua index 0e70b7d..3515e1f 100644 --- a/config.lua +++ b/config.lua @@ -4,6 +4,7 @@ return { pulse = true, -- recommended shop jokers pulse periodically owned_tooltip = true, -- show "Active combos" tooltip on owned jokers partner_highlight = true, -- hovering a joker pulses its owned partners + sell_advisor = true, -- on a full board, flag the weakest combo piece threshold = 4, -- total synergy score needed to recommend a card learning_mode = false, -- hide verdicts (pulse, "Strong pick!"), keep reasons touch_mode = true, -- enlarge advice text/buttons for phone screens diff --git a/main.lua b/main.lua index 58cd907..e8a72b2 100644 --- a/main.lua +++ b/main.lua @@ -152,6 +152,28 @@ function JCA.is_recommended(card) return total >= JCA.config.threshold end +-- Sell advisor: on a full board, the owned joker contributing the least +-- total synergy to the rest is the natural cut when something better shows +-- up. Returns nil when slots are free, the board is tiny, or every joker +-- scores the same (nothing stands out to cut). +function JCA.weakest_link() + if not (G.jokers and G.jokers.cards) then return nil end + local cards = G.jokers.cards + local limit = G.jokers.config and G.jokers.config.card_limit or #cards + if #cards < 3 or #cards < limit then return nil end + local worst, worst_total, best_total + for _, c in ipairs(cards) do + if c.config and c.config.center and c.config.center.set == 'Joker' then + local _, total = JCA.partners_for(c) + if not worst_total or total < worst_total then + worst, worst_total = c, total + end + if not best_total or total > best_total then best_total = total end + end + end + if worst and worst_total < best_total then return worst end +end + local function in_buy_area(card) return card.area and (card.area == G.shop_jokers or card.area == G.pack_cards) end @@ -290,6 +312,12 @@ local function tooltip_rows(card) end local caution = in_buy_area(card) and JCA.cautions[key] if caution then text_row('Caution: ' .. caution, G.C.RED) end + -- Sell advisor verdict (owned jokers only; suppressed in learning mode + -- like the other verdicts). + if JCA.config.sell_advisor and not JCA.config.learning_mode + and card.area == G.jokers and JCA.weakest_link() == card then + text_row('Weakest combo piece - a sell candidate', G.C.RED) + end rows.name = 'Combo Advisor' return rows end @@ -978,6 +1006,12 @@ if SMODS.current_mod then ref_table = JCA.config, ref_value = 'partner_highlight', }, }}, + {n = G.UIT.R, config = {align = 'cm', padding = 0.05}, nodes = { + create_toggle{ + label = 'Flag weakest joker when board is full', + ref_table = JCA.config, ref_value = 'sell_advisor', + }, + }}, {n = G.UIT.R, config = {align = 'cm', padding = 0.05}, nodes = { create_toggle{ label = 'Learning mode (no verdicts, just reasons)',