Sell advisor: flag the weakest combo piece on a full board
JCA.weakest_link() scores each owned joker's total synergy against the rest of the board (same capped scoring the shop advice uses) and returns the lowest scorer — only when the board is full (that's when a cut decision exists), has 3+ jokers, and one joker actually stands out (uniform boards return nil). The owned-joker tooltip gains a red 'Weakest combo piece - a sell candidate' verdict line, suppressed in learning mode like the other verdicts. Config toggle: sell_advisor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -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)',
|
||||
|
||||
Reference in New Issue
Block a user