changed size of button

This commit is contained in:
davidmolgard
2025-04-25 15:30:27 -06:00
parent df147be3d8
commit 750116e46c
4 changed files with 390 additions and 391 deletions

View File

@@ -2,7 +2,8 @@
-- --
-- The heart of this library: it replicates the game's score evaluation. -- The heart of this library: it replicates the game's score evaluation.
function FN.SIM.run() if not FN.SIM.run then
function FN.SIM.run()
local null_ret = {score = {min=0, exact=0, max=0}, dollars = {min=0, exact=0, max=0}} local null_ret = {score = {min=0, exact=0, max=0}, dollars = {min=0, exact=0, max=0}}
if #G.hand.highlighted < 1 then return null_ret end if #G.hand.highlighted < 1 then return null_ret end
@@ -27,9 +28,9 @@ function FN.SIM.run()
FN.SIM.manage_state("RESTORE") FN.SIM.manage_state("RESTORE")
return FN.SIM.get_results() return FN.SIM.get_results()
end end
function FN.SIM.init() function FN.SIM.init()
-- Reset: -- Reset:
FN.SIM.running = { FN.SIM.running = {
min = {chips = 0, mult = 0, dollars = 0}, min = {chips = 0, mult = 0, dollars = 0},
@@ -117,9 +118,9 @@ function FN.SIM.init()
return context return context
end end
end end
function FN.SIM.get_card_data(card_obj) function FN.SIM.get_card_data(card_obj)
return { return {
rank = card_obj.base.id, rank = card_obj.base.id,
suit = card_obj.base.suit, suit = card_obj.base.suit,
@@ -130,9 +131,9 @@ function FN.SIM.get_card_data(card_obj)
debuff = card_obj.debuff, debuff = card_obj.debuff,
lucky_trigger = {} lucky_trigger = {}
} }
end end
function FN.SIM.get_results() function FN.SIM.get_results()
local FNSR = FN.SIM.running local FNSR = FN.SIM.running
local min_score = math.floor(FNSR.min.chips * FNSR.min.mult) local min_score = math.floor(FNSR.min.chips * FNSR.min.mult)
@@ -143,13 +144,13 @@ function FN.SIM.get_results()
score = {min = min_score, exact = exact_score, max = max_score}, score = {min = min_score, exact = exact_score, max = max_score},
dollars = {min = FNSR.min.dollars, exact = FNSR.exact.dollars, max = FNSR.max.dollars} dollars = {min = FNSR.min.dollars, exact = FNSR.exact.dollars, max = FNSR.max.dollars}
} }
end end
-- --
-- GAME STATE MANAGEMENT: -- GAME STATE MANAGEMENT:
-- --
function FN.SIM.manage_state(save_or_restore) function FN.SIM.manage_state(save_or_restore)
local FNSO = FN.SIM.orig local FNSO = FN.SIM.orig
if save_or_restore == "SAVE" then if save_or_restore == "SAVE" then
@@ -163,32 +164,32 @@ function FN.SIM.manage_state(save_or_restore)
G.GAME.hands = FNSO.hand_data G.GAME.hands = FNSO.hand_data
return return
end end
end end
function FN.SIM.update_state_variables() function FN.SIM.update_state_variables()
-- Increment poker hand played this run/round: -- Increment poker hand played this run/round:
local hand_info = G.GAME.hands[FN.SIM.env.scoring_name] local hand_info = G.GAME.hands[FN.SIM.env.scoring_name]
hand_info.played = hand_info.played + 1 hand_info.played = hand_info.played + 1
hand_info.played_this_round = hand_info.played_this_round + 1 hand_info.played_this_round = hand_info.played_this_round + 1
end end
-- --
-- MACRO LEVEL: -- MACRO LEVEL:
-- --
function FN.SIM.simulate_scoring_cards() function FN.SIM.simulate_scoring_cards()
for _, scoring_card in ipairs(FN.SIM.env.scoring_cards) do for _, scoring_card in ipairs(FN.SIM.env.scoring_cards) do
FN.SIM.simulate_card_in_context(scoring_card, G.play) FN.SIM.simulate_card_in_context(scoring_card, G.play)
end end
end end
function FN.SIM.simulate_held_cards() function FN.SIM.simulate_held_cards()
for _, held_card in ipairs(FN.SIM.env.held_cards) do for _, held_card in ipairs(FN.SIM.env.held_cards) do
FN.SIM.simulate_card_in_context(held_card, G.hand) FN.SIM.simulate_card_in_context(held_card, G.hand)
end end
end end
function FN.SIM.simulate_joker_global_effects() function FN.SIM.simulate_joker_global_effects()
for _, joker in ipairs(FN.SIM.env.jokers) do for _, joker in ipairs(FN.SIM.env.jokers) do
if joker.edition then -- Foil and Holo: if joker.edition then -- Foil and Holo:
if joker.edition.chips then FN.SIM.add_chips(joker.edition.chips) end if joker.edition.chips then FN.SIM.add_chips(joker.edition.chips) end
@@ -204,9 +205,9 @@ function FN.SIM.simulate_joker_global_effects()
if joker.edition.x_mult then FN.SIM.x_mult(joker.edition.x_mult) end if joker.edition.x_mult then FN.SIM.x_mult(joker.edition.x_mult) end
end end
end end
end end
function FN.SIM.simulate_consumable_effects() function FN.SIM.simulate_consumable_effects()
for _, consumable in ipairs(FN.SIM.env.consumables) do for _, consumable in ipairs(FN.SIM.env.consumables) do
if consumable.ability.set == "Planet" and not consumable.debuff then if consumable.ability.set == "Planet" and not consumable.debuff then
if G.GAME.used_vouchers.v_observatory and consumable.ability.consumeable.hand_type == FN.SIM.env.scoring_name then if G.GAME.used_vouchers.v_observatory and consumable.ability.consumeable.hand_type == FN.SIM.env.scoring_name then
@@ -214,21 +215,21 @@ function FN.SIM.simulate_consumable_effects()
end end
end end
end end
end end
function FN.SIM.add_base_chips_and_mult() function FN.SIM.add_base_chips_and_mult()
local played_hand_data = G.GAME.hands[FN.SIM.env.scoring_name] local played_hand_data = G.GAME.hands[FN.SIM.env.scoring_name]
FN.SIM.add_chips(played_hand_data.chips) FN.SIM.add_chips(played_hand_data.chips)
FN.SIM.add_mult(played_hand_data.mult) FN.SIM.add_mult(played_hand_data.mult)
end end
function FN.SIM.simulate_joker_before_effects() function FN.SIM.simulate_joker_before_effects()
for _, joker in ipairs(FN.SIM.env.jokers) do for _, joker in ipairs(FN.SIM.env.jokers) do
FN.SIM.simulate_joker(joker, FN.SIM.get_context(G.jokers, {before = true})) FN.SIM.simulate_joker(joker, FN.SIM.get_context(G.jokers, {before = true}))
end end
end end
function FN.SIM.simulate_blind_effects() function FN.SIM.simulate_blind_effects()
if G.GAME.blind.disabled then return end if G.GAME.blind.disabled then return end
if G.GAME.blind.name == "The Flint" then if G.GAME.blind.name == "The Flint" then
@@ -245,9 +246,9 @@ function FN.SIM.simulate_blind_effects()
else else
-- Other blinds do not impact scoring; refer to Blind:modify_hand(..) -- Other blinds do not impact scoring; refer to Blind:modify_hand(..)
end end
end end
function FN.SIM.simulate_deck_effects() function FN.SIM.simulate_deck_effects()
if G.GAME.selected_back.name == 'Plasma Deck' then if G.GAME.selected_back.name == 'Plasma Deck' then
local function plasma(data) local function plasma(data)
local sum = data.chips + data.mult local sum = data.chips + data.mult
@@ -262,9 +263,9 @@ function FN.SIM.simulate_deck_effects()
else else
-- Other decks do not impact scoring; refer to Back:trigger_effect(..) -- Other decks do not impact scoring; refer to Back:trigger_effect(..)
end end
end end
function FN.SIM.simulate_blind_debuffs() function FN.SIM.simulate_blind_debuffs()
local blind_obj = G.GAME.blind local blind_obj = G.GAME.blind
if blind_obj.disabled then return false end if blind_obj.disabled then return false end
@@ -318,13 +319,13 @@ function FN.SIM.simulate_blind_debuffs()
end end
return blind_obj:debuff_hand(G.hand.highlighted, FN.SIM.env.poker_hands, FN.SIM.env.scoring_name, true) return blind_obj:debuff_hand(G.hand.highlighted, FN.SIM.env.poker_hands, FN.SIM.env.scoring_name, true)
end end
-- --
-- MICRO LEVEL (CARDS): -- MICRO LEVEL (CARDS):
-- --
function FN.SIM.simulate_card_in_context(card, cardarea) function FN.SIM.simulate_card_in_context(card, cardarea)
-- Reset and collect repetitions: -- Reset and collect repetitions:
FN.SIM.running.reps = 1 FN.SIM.running.reps = 1
if card.seal == "Red" then FN.SIM.add_reps(1) end if card.seal == "Red" then FN.SIM.add_reps(1) end
@@ -335,9 +336,9 @@ function FN.SIM.simulate_card_in_context(card, cardarea)
FN.SIM.simulate_card(card, FN.SIM.get_context(cardarea, {})) FN.SIM.simulate_card(card, FN.SIM.get_context(cardarea, {}))
FN.SIM.simulate_all_jokers(cardarea, {other_card = card, individual = true}) FN.SIM.simulate_all_jokers(cardarea, {other_card = card, individual = true})
end end
end end
function FN.SIM.simulate_card(card_data, context) function FN.SIM.simulate_card(card_data, context)
-- Do nothing if debuffed: -- Do nothing if debuffed:
if card_data.debuff then return end if card_data.debuff then return end
@@ -399,22 +400,24 @@ function FN.SIM.simulate_card(card_data, context)
FN.SIM.x_mult(card_data.ability.h_x_mult) FN.SIM.x_mult(card_data.ability.h_x_mult)
end end
end end
end end
-- --
-- MICRO LEVEL (JOKERS): -- MICRO LEVEL (JOKERS):
-- --
function FN.SIM.simulate_all_jokers(cardarea, context_args) function FN.SIM.simulate_all_jokers(cardarea, context_args)
for _, joker in ipairs(FN.SIM.env.jokers) do for _, joker in ipairs(FN.SIM.env.jokers) do
FN.SIM.simulate_joker(joker, FN.SIM.get_context(cardarea, context_args)) FN.SIM.simulate_joker(joker, FN.SIM.get_context(cardarea, context_args))
end end
end end
function FN.SIM.simulate_joker(joker_obj, context) function FN.SIM.simulate_joker(joker_obj, context)
-- Do nothing if debuffed: -- Do nothing if debuffed:
if joker_obj.debuff then return end if joker_obj.debuff then return end
local joker_simulation_function = FN.SIM.JOKERS["simulate_" .. joker_obj.id] local joker_simulation_function = FN.SIM.JOKERS["simulate_" .. joker_obj.id]
if joker_simulation_function then joker_simulation_function(joker_obj, context) end if joker_simulation_function then joker_simulation_function(joker_obj, context) end
end
end end

View File

@@ -7,7 +7,7 @@
"prefix": "fn", "prefix": "fn",
"main_file": "CorePreview.lua", "main_file": "CorePreview.lua",
"priority": 0, "priority": 0,
"version": "2.1.0", "version": "2.2.0",
"dependencies": [], "dependencies": [],
"conflicts": [] "conflicts": []
} }

View File

@@ -8,28 +8,13 @@ function create_UIBox_HUD()
local contents = orig_hud() local contents = orig_hud()
local score_node_wrap = {n=G.UIT.R, config={id = "fn_pre_score_wrap", align = "cm", padding = 0.05}, nodes={}} local score_node_wrap = {n=G.UIT.R, config={id = "fn_pre_score_wrap", align = "cm", padding = 0.1}, nodes={}}
table.insert(score_node_wrap.nodes, FN.PRE.get_score_node()) table.insert(score_node_wrap.nodes, FN.PRE.get_score_node())
local calculate_score_button = {n = G.UIT.R, local calculate_score_button_wrap = {n=G.UIT.R, config={id = "fn_calculate_score_button_wrap", align = "cm", padding = 0.1}, nodes={}}
config = { table.insert(calculate_score_button_wrap.nodes, FN.PRE.get_calculate_score_button())
align = "cm",
padding = 0.01,
},
nodes = {
UIBox_button({
id = "calculate_score_button",
label = {
"Calculate Score"
},
colour = G.C.RED,
button = "calculate_score_button",
scale = 0.5,
}),
},
}
table.insert(contents.nodes[1].nodes[1].nodes[4].nodes[1].nodes, score_node_wrap) table.insert(contents.nodes[1].nodes[1].nodes[4].nodes[1].nodes, score_node_wrap)
table.insert(contents.nodes[1].nodes[1].nodes[4].nodes[1].nodes, calculate_score_button) table.insert(contents.nodes[1].nodes[1].nodes[4].nodes[1].nodes, calculate_score_button_wrap)
--[[local dollars_node_wrap = {n=G.UIT.C, config={id = "fn_pre_dollars_wrap", align = "cm"}, nodes={}} --[[local dollars_node_wrap = {n=G.UIT.C, config={id = "fn_pre_dollars_wrap", align = "cm"}, nodes={}}
if G.SETTINGS.FN.preview_dollars then table.insert(dollars_node_wrap.nodes, FN.PRE.get_dollars_node()) end if G.SETTINGS.FN.preview_dollars then table.insert(dollars_node_wrap.nodes, FN.PRE.get_dollars_node()) end
@@ -42,6 +27,16 @@ function G.FUNCS.calculate_score_button()
FN.PRE.start_new_coroutine() FN.PRE.start_new_coroutine()
end end
function FN.PRE.get_calculate_score_button()
return {n=G.UIT.C, config={id = "calculate_score_button", button = "calculate_score_button", align = "cm", minh = 0.42, padding = 0.05, r = 0.02, colour = G.C.RED, hover = true, shadow = true}, nodes={
{n=G.UIT.R, config={align = "cm"}, nodes={
{n=G.UIT.T, config={text = " Calculate Score ", colour = G.C.UI.TEXT_LIGHT, shadow = true, scale = 0.36}}
}}
}}
end
function FN.PRE.get_score_node() function FN.PRE.get_score_node()
local text_scale = nil local text_scale = nil
if true then text_scale = 0.5 if true then text_scale = 0.5

View File

@@ -805,26 +805,27 @@ FNSJ.simulate_seeing_double = function(joker_obj, context)
-- Account for all 'real' suits: -- Account for all 'real' suits:
for _, card in ipairs(context.scoring_hand) do for _, card in ipairs(context.scoring_hand) do
if card.ability.effect ~= "Wild Card" then if card.ability.effect ~= "Wild Card" then
if FN.SIM.is_suit(card, "Hearts") then inc_suit("Hearts") end if DV.SIM.is_suit(card, "Hearts") then inc_suit("Hearts") end
if FN.SIM.is_suit(card, "Diamonds") then inc_suit("Diamonds") end if DV.SIM.is_suit(card, "Diamonds") then inc_suit("Diamonds") end
if FN.SIM.is_suit(card, "Spades") then inc_suit("Spades") end if DV.SIM.is_suit(card, "Spades") then inc_suit("Spades") end
if FN.SIM.is_suit(card, "Clubs") then inc_suit("Clubs") end if DV.SIM.is_suit(card, "Clubs") then inc_suit("Clubs") end
end end
end end
-- Let Wild Cards fill in the gaps: -- Let Wild Cards fill in the gaps:
for _, card in ipairs(context.scoring_hand) do for _, card in ipairs(context.scoring_hand) do
if card.ability.effect == "Wild Card" then if card.ability.effect == "Wild Card" then
if suit_count["Clubs"] == 0 then inc_suit("Clubs") -- IMPORTANT: Clubs must come first here, because Clubs are required for xmult. This is in line with game's implementation.
elseif FN.SIM.is_suit(card, "Diamonds") and suit_count["Diamonds"] == 0 then inc_suit("Diamonds") if DV.SIM.is_suit(card, "Clubs") and suit_count["Clubs"] == 0 then inc_suit("Clubs")
elseif FN.SIM.is_suit(card, "Spades") and suit_count["Spades"] == 0 then inc_suit("Spades") elseif DV.SIM.is_suit(card, "Hearts") and suit_count["Hearts"] == 0 then inc_suit("Hearts")
elseif FN.SIM.is_suit(card, "Hearts") and suit_count["Hearts"] == 0 then inc_suit("Hearts") elseif DV.SIM.is_suit(card, "Diamonds") and suit_count["Diamonds"] == 0 then inc_suit("Diamonds")
elseif DV.SIM.is_suit(card, "Spades") and suit_count["Spades"] == 0 then inc_suit("Spades")
end end
end end
end end
if suit_count["Clubs"] > 0 and (suit_count["Hearts"] > 0 or suit_count["Diamonds"] > 0 or suit_count["Spades"] > 0) then if suit_count["Clubs"] > 0 and (suit_count["Hearts"] > 0 or suit_count["Diamonds"] > 0 or suit_count["Spades"] > 0) then
FN.SIM.x_mult(joker_obj.ability.extra) DV.SIM.x_mult(joker_obj.ability.extra)
end end
end end
end end