mirror of
https://github.com/ershisan99/Fantoms-Preview.git
synced 2025-12-16 12:32:48 +00:00
Folder unification, added description and image
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
--- Divvy's Preview for Balatro - Core.lua
|
||||
--
|
||||
--- Original: Divvy's Preview for Balatro - Core.lua
|
||||
|
||||
if SMODS and SMODS.current_mod then
|
||||
SMODS.Atlas({
|
||||
key = "modicon",
|
||||
path = "icon.png",
|
||||
px = 32,
|
||||
py = 32,
|
||||
})
|
||||
end
|
||||
|
||||
-- The functions responsible for running the simulation at appropriate times;
|
||||
-- ie. whenever the player modifies card selection or card order.
|
||||
|
||||
function DV.PRE.simulate()
|
||||
function FN.PRE.simulate()
|
||||
-- Guard against simulating in redundant places:
|
||||
if not (G.STATE == G.STATES.SELECTING_HAND or
|
||||
G.STATE == G.STATES.DRAW_TO_HAND or
|
||||
@@ -11,7 +20,7 @@ function DV.PRE.simulate()
|
||||
then return {score = {min = 0, exact = 0, max = 0}, dollars = {min = 0, exact = 0, max = 0}}
|
||||
end
|
||||
|
||||
if G.SETTINGS.DV.hide_face_down then
|
||||
if G.SETTINGS.FN.hide_face_down then
|
||||
for _, card in ipairs(G.hand.highlighted) do
|
||||
if card.facing == "back" then return nil end
|
||||
end
|
||||
@@ -22,19 +31,19 @@ function DV.PRE.simulate()
|
||||
end
|
||||
end
|
||||
|
||||
return DV.SIM.run()
|
||||
return FN.SIM.run()
|
||||
end
|
||||
|
||||
--
|
||||
-- SIMULATION UPDATE ADVICE:
|
||||
--
|
||||
|
||||
function DV.PRE.add_update_event(trigger)
|
||||
function FN.PRE.add_update_event(trigger)
|
||||
function sim_func()
|
||||
DV.PRE.data = DV.PRE.simulate()
|
||||
FN.PRE.data = FN.PRE.simulate()
|
||||
return true
|
||||
end
|
||||
if DV.PRE.enabled() then
|
||||
if FN.PRE.enabled() then
|
||||
G.E_MANAGER:add_event(Event({trigger = trigger, func = sim_func}))
|
||||
end
|
||||
end
|
||||
@@ -43,14 +52,14 @@ end
|
||||
local orig_use = Card.use_consumeable
|
||||
function Card:use_consumeable(area, copier)
|
||||
orig_use(self, area, copier)
|
||||
DV.PRE.add_update_event("immediate")
|
||||
FN.PRE.add_update_event("immediate")
|
||||
end
|
||||
|
||||
-- Update simulation after card selection changed:
|
||||
local orig_hl = CardArea.parse_highlighted
|
||||
function CardArea:parse_highlighted()
|
||||
orig_hl(self)
|
||||
DV.PRE.add_update_event("immediate")
|
||||
FN.PRE.add_update_event("immediate")
|
||||
end
|
||||
|
||||
-- Update simulation after joker sold:
|
||||
@@ -58,7 +67,7 @@ local orig_card_remove = Card.remove_from_area
|
||||
function Card:remove_from_area()
|
||||
orig_card_remove(self)
|
||||
if self.config.type == 'joker' then
|
||||
DV.PRE.add_update_event("immediate")
|
||||
FN.PRE.add_update_event("immediate")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -66,10 +75,10 @@ end
|
||||
local orig_update = CardArea.update
|
||||
function CardArea:update(dt)
|
||||
orig_update(self, dt)
|
||||
DV.PRE.update_on_card_order_change(self)
|
||||
FN.PRE.update_on_card_order_change(self)
|
||||
end
|
||||
|
||||
function DV.PRE.update_on_card_order_change(cardarea)
|
||||
function FN.PRE.update_on_card_order_change(cardarea)
|
||||
if #cardarea.cards == 0 or
|
||||
not (G.STATE == G.STATES.SELECTING_HAND or
|
||||
G.STATE == G.STATES.DRAW_TO_HAND or
|
||||
@@ -83,9 +92,9 @@ function DV.PRE.update_on_card_order_change(cardarea)
|
||||
return
|
||||
end
|
||||
-- Note that the consumables cardarea also has type 'joker' so must verify by checking first card.
|
||||
prev_order = DV.PRE.joker_order
|
||||
prev_order = FN.PRE.joker_order
|
||||
elseif cardarea.config.type == 'hand' then
|
||||
prev_order = DV.PRE.hand_order
|
||||
prev_order = FN.PRE.hand_order
|
||||
else
|
||||
return
|
||||
end
|
||||
@@ -105,12 +114,12 @@ function DV.PRE.update_on_card_order_change(cardarea)
|
||||
|
||||
if should_update then
|
||||
if cardarea.config.type == 'joker' or cardarea.cards[1].ability.set == 'Joker' then
|
||||
DV.PRE.joker_order = prev_order
|
||||
FN.PRE.joker_order = prev_order
|
||||
elseif cardarea.config.type == 'hand' then
|
||||
DV.PRE.hand_order = prev_order
|
||||
FN.PRE.hand_order = prev_order
|
||||
end
|
||||
|
||||
DV.PRE.add_update_event("immediate")
|
||||
FN.PRE.add_update_event("immediate")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -118,12 +127,12 @@ end
|
||||
-- SIMULATION RESET ADVICE:
|
||||
--
|
||||
|
||||
function DV.PRE.add_reset_event(trigger)
|
||||
function FN.PRE.add_reset_event(trigger)
|
||||
function reset_func()
|
||||
DV.PRE.data = {score = {min = 0, exact = 0, max = 0}, dollars = {min = 0, exact = 0, max = 0}}
|
||||
FN.PRE.data = {score = {min = 0, exact = 0, max = 0}, dollars = {min = 0, exact = 0, max = 0}}
|
||||
return true
|
||||
end
|
||||
if DV.PRE.enabled() then
|
||||
if FN.PRE.enabled() then
|
||||
G.E_MANAGER:add_event(Event({trigger = trigger, func = reset_func}))
|
||||
end
|
||||
end
|
||||
@@ -131,14 +140,14 @@ end
|
||||
local orig_eval = G.FUNCS.evaluate_play
|
||||
function G.FUNCS.evaluate_play(e)
|
||||
orig_eval(e)
|
||||
DV.PRE.add_reset_event("after")
|
||||
FN.PRE.add_reset_event("after")
|
||||
end
|
||||
|
||||
local orig_discard = G.FUNCS.discard_cards_from_highlighted
|
||||
function G.FUNCS.discard_cards_from_highlighted(e, is_hook_blind)
|
||||
orig_discard(e, is_hook_blind)
|
||||
if not is_hook_blind then
|
||||
DV.PRE.add_reset_event("immediate")
|
||||
FN.PRE.add_reset_event("immediate")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -147,30 +156,30 @@ end
|
||||
--
|
||||
|
||||
-- Add animation to preview text:
|
||||
function G.FUNCS.dv_pre_score_UI_set(e)
|
||||
function G.FUNCS.fn_pre_score_UI_set(e)
|
||||
local new_preview_text = ""
|
||||
local should_juice = false
|
||||
if DV.PRE.data then
|
||||
if true and (DV.PRE.data.score.min ~= DV.PRE.data.score.max) then
|
||||
if FN.PRE.data then
|
||||
if true and (FN.PRE.data.score.min ~= FN.PRE.data.score.max) then
|
||||
-- Format as 'X - Y' :
|
||||
if e.config.id == "dv_pre_l" then
|
||||
new_preview_text = DV.PRE.format_number(DV.PRE.data.score.min) .. " - "
|
||||
if DV.PRE.is_enough_to_win(DV.PRE.data.score.min) then should_juice = true end
|
||||
elseif e.config.id == "dv_pre_r" then
|
||||
new_preview_text = DV.PRE.format_number(DV.PRE.data.score.max)
|
||||
if DV.PRE.is_enough_to_win(DV.PRE.data.score.max) then should_juice = true end
|
||||
if e.config.id == "fn_pre_l" then
|
||||
new_preview_text = FN.PRE.format_number(FN.PRE.data.score.min) .. " - "
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.min) then should_juice = true end
|
||||
elseif e.config.id == "fn_pre_r" then
|
||||
new_preview_text = FN.PRE.format_number(FN.PRE.data.score.max)
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.max) then should_juice = true end
|
||||
end
|
||||
else
|
||||
-- Format as single number:
|
||||
if e.config.id == "dv_pre_l" then
|
||||
if e.config.id == "fn_pre_l" then
|
||||
if true then
|
||||
-- Spaces around number necessary to distinguish Min/Max text from Exact text,
|
||||
-- which is itself necessary to force a HUD update when switching between Min/Max and Exact.
|
||||
new_preview_text = " " .. DV.PRE.format_number(DV.PRE.data.score.min) .. " "
|
||||
if DV.PRE.is_enough_to_win(DV.PRE.data.score.min) then should_juice = true end
|
||||
new_preview_text = " " .. FN.PRE.format_number(FN.PRE.data.score.min) .. " "
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.min) then should_juice = true end
|
||||
else
|
||||
new_preview_text = number_format(DV.PRE.data.score.exact)
|
||||
if DV.PRE.is_enough_to_win(DV.PRE.data.score.exact) then should_juice = true end
|
||||
new_preview_text = number_format(FN.PRE.data.score.exact)
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.exact) then should_juice = true end
|
||||
end
|
||||
else
|
||||
new_preview_text = ""
|
||||
@@ -178,7 +187,7 @@ function G.FUNCS.dv_pre_score_UI_set(e)
|
||||
end
|
||||
else
|
||||
-- Spaces around number necessary to distinguish Min/Max text from Exact text, same as above ^
|
||||
if e.config.id == "dv_pre_l" then
|
||||
if e.config.id == "fn_pre_l" then
|
||||
if true then new_preview_text = " ?????? "
|
||||
else new_preview_text = "??????"
|
||||
end
|
||||
@@ -187,8 +196,8 @@ function G.FUNCS.dv_pre_score_UI_set(e)
|
||||
end
|
||||
end
|
||||
|
||||
if (not DV.PRE.text.score[e.config.id:sub(-1)]) or new_preview_text ~= DV.PRE.text.score[e.config.id:sub(-1)] then
|
||||
DV.PRE.text.score[e.config.id:sub(-1)] = new_preview_text
|
||||
if (not FN.PRE.text.score[e.config.id:sub(-1)]) or new_preview_text ~= FN.PRE.text.score[e.config.id:sub(-1)] then
|
||||
FN.PRE.text.score[e.config.id:sub(-1)] = new_preview_text
|
||||
e.config.object:update_text()
|
||||
-- Wobble:
|
||||
if not G.TAROT_INTERRUPT_PULSE then
|
||||
@@ -204,36 +213,36 @@ function G.FUNCS.dv_pre_score_UI_set(e)
|
||||
end
|
||||
end
|
||||
|
||||
function G.FUNCS.dv_pre_dollars_UI_set(e)
|
||||
function G.FUNCS.fn_pre_dollars_UI_set(e)
|
||||
local new_preview_text = ""
|
||||
local new_colour = nil
|
||||
if DV.PRE.data then
|
||||
if true and (DV.PRE.data.dollars.min ~= DV.PRE.data.dollars.max) then
|
||||
if e.config.id == "dv_pre_dollars_top" then
|
||||
new_preview_text = " " .. DV.PRE.get_sign_str(DV.PRE.data.dollars.max) .. DV.PRE.data.dollars.max
|
||||
new_colour = DV.PRE.get_dollar_colour(DV.PRE.data.dollars.max)
|
||||
elseif e.config.id == "dv_pre_dollars_bot" then
|
||||
new_preview_text = " " .. DV.PRE.get_sign_str(DV.PRE.data.dollars.min) .. DV.PRE.data.dollars.min
|
||||
new_colour = DV.PRE.get_dollar_colour(DV.PRE.data.dollars.min)
|
||||
if FN.PRE.data then
|
||||
if true and (FN.PRE.data.dollars.min ~= FN.PRE.data.dollars.max) then
|
||||
if e.config.id == "fn_pre_dollars_top" then
|
||||
new_preview_text = " " .. FN.PRE.get_sign_str(FN.PRE.data.dollars.max) .. FN.PRE.data.dollars.max
|
||||
new_colour = FN.PRE.get_dollar_colour(FN.PRE.data.dollars.max)
|
||||
elseif e.config.id == "fn_pre_dollars_bot" then
|
||||
new_preview_text = " " .. FN.PRE.get_sign_str(FN.PRE.data.dollars.min) .. FN.PRE.data.dollars.min
|
||||
new_colour = FN.PRE.get_dollar_colour(FN.PRE.data.dollars.min)
|
||||
end
|
||||
else
|
||||
if e.config.id == "dv_pre_dollars_top" then
|
||||
local _data = (G.SETTINGS.DV.show_min_max) and DV.PRE.data.dollars.min or DV.PRE.data.dollars.exact
|
||||
if e.config.id == "fn_pre_dollars_top" then
|
||||
local _data = (G.SETTINGS.FN.show_min_max) and FN.PRE.data.dollars.min or FN.PRE.data.dollars.exact
|
||||
|
||||
new_preview_text = " " .. DV.PRE.get_sign_str(_data) .. _data
|
||||
new_colour = DV.PRE.get_dollar_colour(_data)
|
||||
new_preview_text = " " .. FN.PRE.get_sign_str(_data) .. _data
|
||||
new_colour = FN.PRE.get_dollar_colour(_data)
|
||||
else
|
||||
new_preview_text = ""
|
||||
new_colour = DV.PRE.get_dollar_colour(0)
|
||||
new_colour = FN.PRE.get_dollar_colour(0)
|
||||
end
|
||||
end
|
||||
else
|
||||
new_preview_text = " +??"
|
||||
new_colour = DV.PRE.get_dollar_colour(0)
|
||||
new_colour = FN.PRE.get_dollar_colour(0)
|
||||
end
|
||||
|
||||
if (not DV.PRE.text.dollars[e.config.id:sub(-3)]) or new_preview_text ~= DV.PRE.text.dollars[e.config.id:sub(-3)] then
|
||||
DV.PRE.text.dollars[e.config.id:sub(-3)] = new_preview_text
|
||||
if (not FN.PRE.text.dollars[e.config.id:sub(-3)]) or new_preview_text ~= FN.PRE.text.dollars[e.config.id:sub(-3)] then
|
||||
FN.PRE.text.dollars[e.config.id:sub(-3)] = new_preview_text
|
||||
e.config.object.colours = {new_colour}
|
||||
e.config.object:update_text()
|
||||
if not G.TAROT_INTERRUPT_PULSE then e.config.object:pulse(0.25) end
|
||||
@@ -1,37 +1,37 @@
|
||||
--- Divvy's Simulation for Balatro - Engine.lua
|
||||
--- Original: Divvy's Simulation for Balatro - Engine.lua
|
||||
--
|
||||
-- The heart of this library: it replicates the game's score evaluation.
|
||||
|
||||
function DV.SIM.run()
|
||||
function FN.SIM.run()
|
||||
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
|
||||
|
||||
DV.SIM.init()
|
||||
FN.SIM.init()
|
||||
|
||||
DV.SIM.manage_state("SAVE")
|
||||
DV.SIM.update_state_variables()
|
||||
FN.SIM.manage_state("SAVE")
|
||||
FN.SIM.update_state_variables()
|
||||
|
||||
if not DV.SIM.simulate_blind_debuffs() then
|
||||
DV.SIM.simulate_joker_before_effects()
|
||||
DV.SIM.add_base_chips_and_mult()
|
||||
DV.SIM.simulate_blind_effects()
|
||||
DV.SIM.simulate_scoring_cards()
|
||||
DV.SIM.simulate_held_cards()
|
||||
DV.SIM.simulate_joker_global_effects()
|
||||
DV.SIM.simulate_consumable_effects()
|
||||
DV.SIM.simulate_deck_effects()
|
||||
if not FN.SIM.simulate_blind_debuffs() then
|
||||
FN.SIM.simulate_joker_before_effects()
|
||||
FN.SIM.add_base_chips_and_mult()
|
||||
FN.SIM.simulate_blind_effects()
|
||||
FN.SIM.simulate_scoring_cards()
|
||||
FN.SIM.simulate_held_cards()
|
||||
FN.SIM.simulate_joker_global_effects()
|
||||
FN.SIM.simulate_consumable_effects()
|
||||
FN.SIM.simulate_deck_effects()
|
||||
else -- Only Matador at this point:
|
||||
DV.SIM.simulate_all_jokers(G.jokers, {debuffed_hand = true})
|
||||
FN.SIM.simulate_all_jokers(G.jokers, {debuffed_hand = true})
|
||||
end
|
||||
|
||||
DV.SIM.manage_state("RESTORE")
|
||||
FN.SIM.manage_state("RESTORE")
|
||||
|
||||
return DV.SIM.get_results()
|
||||
return FN.SIM.get_results()
|
||||
end
|
||||
|
||||
function DV.SIM.init()
|
||||
function FN.SIM.init()
|
||||
-- Reset:
|
||||
DV.SIM.running = {
|
||||
FN.SIM.running = {
|
||||
min = {chips = 0, mult = 0, dollars = 0},
|
||||
exact = {chips = 0, mult = 0, dollars = 0},
|
||||
max = {chips = 0, mult = 0, dollars = 0},
|
||||
@@ -40,11 +40,11 @@ function DV.SIM.init()
|
||||
|
||||
-- Fetch metadata about simulated play:
|
||||
local hand_name, _, poker_hands, scoring_hand, _ = G.FUNCS.get_poker_hand_info(G.hand.highlighted)
|
||||
DV.SIM.env.scoring_name = hand_name
|
||||
FN.SIM.env.scoring_name = hand_name
|
||||
|
||||
-- Identify played cards and extract necessary data:
|
||||
DV.SIM.env.played_cards = {}
|
||||
DV.SIM.env.scoring_cards = {}
|
||||
FN.SIM.env.played_cards = {}
|
||||
FN.SIM.env.scoring_cards = {}
|
||||
local is_splash_joker = next(find_joker("Splash"))
|
||||
table.sort(G.hand.highlighted, function(a, b) return a.T.x < b.T.x end) -- Sorts by positional x-value to mirror card order!
|
||||
for _, card in ipairs(G.hand.highlighted) do
|
||||
@@ -61,23 +61,23 @@ function DV.SIM.init()
|
||||
end
|
||||
end
|
||||
|
||||
local card_data = DV.SIM.get_card_data(card)
|
||||
table.insert(DV.SIM.env.played_cards, card_data)
|
||||
if is_scoring then table.insert(DV.SIM.env.scoring_cards, card_data) end
|
||||
local card_data = FN.SIM.get_card_data(card)
|
||||
table.insert(FN.SIM.env.played_cards, card_data)
|
||||
if is_scoring then table.insert(FN.SIM.env.scoring_cards, card_data) end
|
||||
end
|
||||
|
||||
-- Identify held cards and extract necessary data:
|
||||
DV.SIM.env.held_cards = {}
|
||||
FN.SIM.env.held_cards = {}
|
||||
for _, card in ipairs(G.hand.cards) do
|
||||
-- Highlighted cards are simulated as played cards:
|
||||
if not card.highlighted then
|
||||
local card_data = DV.SIM.get_card_data(card)
|
||||
table.insert(DV.SIM.env.held_cards, card_data)
|
||||
local card_data = FN.SIM.get_card_data(card)
|
||||
table.insert(FN.SIM.env.held_cards, card_data)
|
||||
end
|
||||
end
|
||||
|
||||
-- Extract necessary joker data:
|
||||
DV.SIM.env.jokers = {}
|
||||
FN.SIM.env.jokers = {}
|
||||
for _, joker in ipairs(G.jokers.cards) do
|
||||
local joker_data = {
|
||||
-- P_CENTER keys for jokers have the form j_NAME, get rid of j_
|
||||
@@ -87,27 +87,27 @@ function DV.SIM.init()
|
||||
rarity = joker.config.center.rarity,
|
||||
debuff = joker.debuff
|
||||
}
|
||||
table.insert(DV.SIM.env.jokers, joker_data)
|
||||
table.insert(FN.SIM.env.jokers, joker_data)
|
||||
end
|
||||
|
||||
-- Extract necessary consumable data:
|
||||
DV.SIM.env.consumables = {}
|
||||
FN.SIM.env.consumables = {}
|
||||
for _, consumable in ipairs(G.consumeables.cards) do
|
||||
local consumable_data = {
|
||||
-- P_CENTER keys have the form x_NAME, get rid of x_
|
||||
id = consumable.config.center.key:sub(3, #consumable.config.center.key),
|
||||
ability = copy_table(consumable.ability)
|
||||
}
|
||||
table.insert(DV.SIM.env.consumables, consumable_data)
|
||||
table.insert(FN.SIM.env.consumables, consumable_data)
|
||||
end
|
||||
|
||||
-- Set extensible context template:
|
||||
DV.SIM.get_context = function(cardarea, args)
|
||||
FN.SIM.get_context = function(cardarea, args)
|
||||
local context = {
|
||||
cardarea = cardarea,
|
||||
full_hand = DV.SIM.env.played_cards,
|
||||
full_hand = FN.SIM.env.played_cards,
|
||||
scoring_name = hand_name,
|
||||
scoring_hand = DV.SIM.env.scoring_cards,
|
||||
scoring_hand = FN.SIM.env.scoring_cards,
|
||||
poker_hands = poker_hands
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ function DV.SIM.init()
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.get_card_data(card_obj)
|
||||
function FN.SIM.get_card_data(card_obj)
|
||||
return {
|
||||
rank = card_obj.base.id,
|
||||
suit = card_obj.base.suit,
|
||||
@@ -132,16 +132,16 @@ function DV.SIM.get_card_data(card_obj)
|
||||
}
|
||||
end
|
||||
|
||||
function DV.SIM.get_results()
|
||||
local DVSR = DV.SIM.running
|
||||
function FN.SIM.get_results()
|
||||
local FNSR = FN.SIM.running
|
||||
|
||||
local min_score = math.floor(DVSR.min.chips * DVSR.min.mult)
|
||||
local exact_score = math.floor(DVSR.exact.chips * DVSR.exact.mult)
|
||||
local max_score = math.floor(DVSR.max.chips * DVSR.max.mult)
|
||||
local min_score = math.floor(FNSR.min.chips * FNSR.min.mult)
|
||||
local exact_score = math.floor(FNSR.exact.chips * FNSR.exact.mult)
|
||||
local max_score = math.floor(FNSR.max.chips * FNSR.max.mult)
|
||||
|
||||
return {
|
||||
score = {min = min_score, exact = exact_score, max = max_score},
|
||||
dollars = {min = DVSR.min.dollars, exact = DVSR.exact.dollars, max = DVSR.max.dollars}
|
||||
dollars = {min = FNSR.min.dollars, exact = FNSR.exact.dollars, max = FNSR.max.dollars}
|
||||
}
|
||||
end
|
||||
|
||||
@@ -149,25 +149,25 @@ end
|
||||
-- GAME STATE MANAGEMENT:
|
||||
--
|
||||
|
||||
function DV.SIM.manage_state(save_or_restore)
|
||||
local DVSO = DV.SIM.orig
|
||||
function FN.SIM.manage_state(save_or_restore)
|
||||
local FNSO = FN.SIM.orig
|
||||
|
||||
if save_or_restore == "SAVE" then
|
||||
DVSO.random_data = copy_table(G.GAME.pseudorandom)
|
||||
DVSO.hand_data = copy_table(G.GAME.hands)
|
||||
FNSO.random_data = copy_table(G.GAME.pseudorandom)
|
||||
FNSO.hand_data = copy_table(G.GAME.hands)
|
||||
return
|
||||
end
|
||||
|
||||
if save_or_restore == "RESTORE" then
|
||||
G.GAME.pseudorandom = DVSO.random_data
|
||||
G.GAME.hands = DVSO.hand_data
|
||||
G.GAME.pseudorandom = FNSO.random_data
|
||||
G.GAME.hands = FNSO.hand_data
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.update_state_variables()
|
||||
function FN.SIM.update_state_variables()
|
||||
-- Increment poker hand played this run/round:
|
||||
local hand_info = G.GAME.hands[DV.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_this_round = hand_info.played_this_round + 1
|
||||
end
|
||||
@@ -176,59 +176,59 @@ end
|
||||
-- MACRO LEVEL:
|
||||
--
|
||||
|
||||
function DV.SIM.simulate_scoring_cards()
|
||||
for _, scoring_card in ipairs(DV.SIM.env.scoring_cards) do
|
||||
DV.SIM.simulate_card_in_context(scoring_card, G.play)
|
||||
function FN.SIM.simulate_scoring_cards()
|
||||
for _, scoring_card in ipairs(FN.SIM.env.scoring_cards) do
|
||||
FN.SIM.simulate_card_in_context(scoring_card, G.play)
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.simulate_held_cards()
|
||||
for _, held_card in ipairs(DV.SIM.env.held_cards) do
|
||||
DV.SIM.simulate_card_in_context(held_card, G.hand)
|
||||
function FN.SIM.simulate_held_cards()
|
||||
for _, held_card in ipairs(FN.SIM.env.held_cards) do
|
||||
FN.SIM.simulate_card_in_context(held_card, G.hand)
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.simulate_joker_global_effects()
|
||||
for _, joker in ipairs(DV.SIM.env.jokers) do
|
||||
function FN.SIM.simulate_joker_global_effects()
|
||||
for _, joker in ipairs(FN.SIM.env.jokers) do
|
||||
if joker.edition then -- Foil and Holo:
|
||||
if joker.edition.chips then DV.SIM.add_chips(joker.edition.chips) end
|
||||
if joker.edition.mult then DV.SIM.add_mult(joker.edition.mult) end
|
||||
if joker.edition.chips then FN.SIM.add_chips(joker.edition.chips) end
|
||||
if joker.edition.mult then FN.SIM.add_mult(joker.edition.mult) end
|
||||
end
|
||||
|
||||
DV.SIM.simulate_joker(joker, DV.SIM.get_context(G.jokers, {global = true}))
|
||||
FN.SIM.simulate_joker(joker, FN.SIM.get_context(G.jokers, {global = true}))
|
||||
|
||||
-- Joker-on-joker effects (eg. Blueprint):
|
||||
DV.SIM.simulate_all_jokers(G.jokers, {other_joker = joker})
|
||||
FN.SIM.simulate_all_jokers(G.jokers, {other_joker = joker})
|
||||
|
||||
if joker.edition then -- Poly:
|
||||
if joker.edition.x_mult then DV.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
|
||||
|
||||
function DV.SIM.simulate_consumable_effects()
|
||||
for _, consumable in ipairs(DV.SIM.env.consumables) do
|
||||
function FN.SIM.simulate_consumable_effects()
|
||||
for _, consumable in ipairs(FN.SIM.env.consumables) do
|
||||
if consumable.ability.set == "Planet" and not consumable.debuff then
|
||||
if G.GAME.used_vouchers.v_observatory and consumable.ability.consumeable.hand_type == DV.SIM.env.scoring_name then
|
||||
DV.SIM.x_mult(G.P_CENTERS.v_observatory.config.extra)
|
||||
if G.GAME.used_vouchers.v_observatory and consumable.ability.consumeable.hand_type == FN.SIM.env.scoring_name then
|
||||
FN.SIM.x_mult(G.P_CENTERS.v_observatory.config.extra)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.add_base_chips_and_mult()
|
||||
local played_hand_data = G.GAME.hands[DV.SIM.env.scoring_name]
|
||||
DV.SIM.add_chips(played_hand_data.chips)
|
||||
DV.SIM.add_mult(played_hand_data.mult)
|
||||
function FN.SIM.add_base_chips_and_mult()
|
||||
local played_hand_data = G.GAME.hands[FN.SIM.env.scoring_name]
|
||||
FN.SIM.add_chips(played_hand_data.chips)
|
||||
FN.SIM.add_mult(played_hand_data.mult)
|
||||
end
|
||||
|
||||
function DV.SIM.simulate_joker_before_effects()
|
||||
for _, joker in ipairs(DV.SIM.env.jokers) do
|
||||
DV.SIM.simulate_joker(joker, DV.SIM.get_context(G.jokers, {before = true}))
|
||||
function FN.SIM.simulate_joker_before_effects()
|
||||
for _, joker in ipairs(FN.SIM.env.jokers) do
|
||||
FN.SIM.simulate_joker(joker, FN.SIM.get_context(G.jokers, {before = true}))
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.simulate_blind_effects()
|
||||
function FN.SIM.simulate_blind_effects()
|
||||
if G.GAME.blind.disabled then return end
|
||||
|
||||
if G.GAME.blind.name == "The Flint" then
|
||||
@@ -239,15 +239,15 @@ function DV.SIM.simulate_blind_effects()
|
||||
data.mult = mod_mult(math.max(half_mult, 1))
|
||||
end
|
||||
|
||||
flint(DV.SIM.running.min)
|
||||
flint(DV.SIM.running.exact)
|
||||
flint(DV.SIM.running.max)
|
||||
flint(FN.SIM.running.min)
|
||||
flint(FN.SIM.running.exact)
|
||||
flint(FN.SIM.running.max)
|
||||
else
|
||||
-- Other blinds do not impact scoring; refer to Blind:modify_hand(..)
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.simulate_deck_effects()
|
||||
function FN.SIM.simulate_deck_effects()
|
||||
if G.GAME.selected_back.name == 'Plasma Deck' then
|
||||
local function plasma(data)
|
||||
local sum = data.chips + data.mult
|
||||
@@ -256,15 +256,15 @@ function DV.SIM.simulate_deck_effects()
|
||||
data.mult = mod_mult(half_sum)
|
||||
end
|
||||
|
||||
plasma(DV.SIM.running.min)
|
||||
plasma(DV.SIM.running.exact)
|
||||
plasma(DV.SIM.running.max)
|
||||
plasma(FN.SIM.running.min)
|
||||
plasma(FN.SIM.running.exact)
|
||||
plasma(FN.SIM.running.max)
|
||||
else
|
||||
-- Other decks do not impact scoring; refer to Back:trigger_effect(..)
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.simulate_blind_debuffs()
|
||||
function FN.SIM.simulate_blind_debuffs()
|
||||
local blind_obj = G.GAME.blind
|
||||
if blind_obj.disabled then return false end
|
||||
|
||||
@@ -272,21 +272,21 @@ function DV.SIM.simulate_blind_debuffs()
|
||||
|
||||
if blind_obj.name == "The Hook" then
|
||||
blind_obj.triggered = true
|
||||
for _ = 1, math.min(2, #DV.SIM.env.held_cards) do
|
||||
for _ = 1, math.min(2, #FN.SIM.env.held_cards) do
|
||||
-- TODO: Identify cards-in-hand that can affect score, simulate with/without them for min/max
|
||||
local selected_card, card_key = pseudorandom_element(DV.SIM.env.held_cards, pseudoseed('hook'))
|
||||
table.remove(DV.SIM.env.held_cards, card_key)
|
||||
for _, joker in ipairs(DV.SIM.env.jokers) do
|
||||
-- Note that the cardarea argument is largely arbitrary (used for DV.SIM.JOKERS),
|
||||
local selected_card, card_key = pseudorandom_element(FN.SIM.env.held_cards, pseudoseed('hook'))
|
||||
table.remove(FN.SIM.env.held_cards, card_key)
|
||||
for _, joker in ipairs(FN.SIM.env.jokers) do
|
||||
-- Note that the cardarea argument is largely arbitrary (used for FN.SIM.JOKERS),
|
||||
-- I use G.hand because The Hook discards from the hand
|
||||
DV.SIM.simulate_joker(joker, DV.SIM.get_context(G.hand, {discard = true, other_card = selected_card}))
|
||||
FN.SIM.simulate_joker(joker, FN.SIM.get_context(G.hand, {discard = true, other_card = selected_card}))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if blind_obj.name == "The Tooth" then
|
||||
blind_obj.triggered = true
|
||||
DV.SIM.add_dollars((-1) * #DV.SIM.env.played_cards)
|
||||
FN.SIM.add_dollars((-1) * #FN.SIM.env.played_cards)
|
||||
end
|
||||
|
||||
-- The following are part of Blind:debuff_hand(..)
|
||||
@@ -294,7 +294,7 @@ function DV.SIM.simulate_blind_debuffs()
|
||||
if blind_obj.name == "The Arm" then
|
||||
blind_obj.triggered = false
|
||||
|
||||
local played_hand_name = DV.SIM.env.scoring_name
|
||||
local played_hand_name = FN.SIM.env.scoring_name
|
||||
if G.GAME.hands[played_hand_name].level > 1 then
|
||||
blind_obj.triggered = true
|
||||
-- NOTE: Important to save/restore G.GAME.hands here
|
||||
@@ -310,93 +310,93 @@ function DV.SIM.simulate_blind_debuffs()
|
||||
if blind_obj.name == "The Ox" then
|
||||
blind_obj.triggered = false
|
||||
|
||||
if DV.SIM.env.scoring_name == G.GAME.current_round.most_played_poker_hand then
|
||||
if FN.SIM.env.scoring_name == G.GAME.current_round.most_played_poker_hand then
|
||||
blind_obj.triggered = true
|
||||
DV.SIM.add_dollars(-G.GAME.dollars)
|
||||
FN.SIM.add_dollars(-G.GAME.dollars)
|
||||
end
|
||||
return false -- IMPORTANT: Avoid duplicate effects from Blind:debuff_hand() below
|
||||
end
|
||||
|
||||
return blind_obj:debuff_hand(DV.SIM.env.played_cards, DV.SIM.env.poker_hands, DV.SIM.env.scoring_name, true)
|
||||
return blind_obj:debuff_hand(FN.SIM.env.played_cards, FN.SIM.env.poker_hands, FN.SIM.env.scoring_name, true)
|
||||
end
|
||||
|
||||
--
|
||||
-- MICRO LEVEL (CARDS):
|
||||
--
|
||||
|
||||
function DV.SIM.simulate_card_in_context(card, cardarea)
|
||||
function FN.SIM.simulate_card_in_context(card, cardarea)
|
||||
-- Reset and collect repetitions:
|
||||
DV.SIM.running.reps = 1
|
||||
if card.seal == "Red" then DV.SIM.add_reps(1) end
|
||||
DV.SIM.simulate_all_jokers(cardarea, {other_card = card, repetition = true})
|
||||
FN.SIM.running.reps = 1
|
||||
if card.seal == "Red" then FN.SIM.add_reps(1) end
|
||||
FN.SIM.simulate_all_jokers(cardarea, {other_card = card, repetition = true})
|
||||
|
||||
-- Apply effects:
|
||||
for _ = 1, DV.SIM.running.reps do
|
||||
DV.SIM.simulate_card(card, DV.SIM.get_context(cardarea, {}))
|
||||
DV.SIM.simulate_all_jokers(cardarea, {other_card = card, individual = true})
|
||||
for _ = 1, FN.SIM.running.reps do
|
||||
FN.SIM.simulate_card(card, FN.SIM.get_context(cardarea, {}))
|
||||
FN.SIM.simulate_all_jokers(cardarea, {other_card = card, individual = true})
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.simulate_card(card_data, context)
|
||||
function FN.SIM.simulate_card(card_data, context)
|
||||
-- Do nothing if debuffed:
|
||||
if card_data.debuff then return end
|
||||
|
||||
if context.cardarea == G.play then
|
||||
-- Chips:
|
||||
if card_data.ability.effect == "Stone Card" then
|
||||
DV.SIM.add_chips(card_data.ability.bonus + (card_data.ability.perma_bonus or 0))
|
||||
FN.SIM.add_chips(card_data.ability.bonus + (card_data.ability.perma_bonus or 0))
|
||||
else
|
||||
DV.SIM.add_chips(card_data.base_chips + card_data.ability.bonus + (card_data.ability.perma_bonus or 0))
|
||||
FN.SIM.add_chips(card_data.base_chips + card_data.ability.bonus + (card_data.ability.perma_bonus or 0))
|
||||
end
|
||||
|
||||
-- Mult:
|
||||
if card_data.ability.effect == "Lucky Card" then
|
||||
local exact_mult, min_mult, max_mult = DV.SIM.get_probabilistic_extremes(pseudorandom("nope"), 5, card_data.ability.mult, 0)
|
||||
DV.SIM.add_mult(exact_mult, min_mult, max_mult)
|
||||
local exact_mult, min_mult, max_mult = FN.SIM.get_probabilistic_extremes(pseudorandom("nope"), 5, card_data.ability.mult, 0)
|
||||
FN.SIM.add_mult(exact_mult, min_mult, max_mult)
|
||||
-- Careful not to overwrite `card_data.lucky_trigger` outright:
|
||||
if exact_mult > 0 then card_data.lucky_trigger.exact = true end
|
||||
if min_mult > 0 then card_data.lucky_trigger.min = true end
|
||||
if max_mult > 0 then card_data.lucky_trigger.max = true end
|
||||
else
|
||||
DV.SIM.add_mult(card_data.ability.mult)
|
||||
FN.SIM.add_mult(card_data.ability.mult)
|
||||
end
|
||||
|
||||
-- XMult:
|
||||
if card_data.ability.x_mult > 1 then
|
||||
DV.SIM.x_mult(card_data.ability.x_mult)
|
||||
FN.SIM.x_mult(card_data.ability.x_mult)
|
||||
end
|
||||
|
||||
-- Dollars:
|
||||
if card_data.seal == "Gold" then
|
||||
DV.SIM.add_dollars(3)
|
||||
FN.SIM.add_dollars(3)
|
||||
end
|
||||
if card_data.ability.p_dollars > 0 then
|
||||
if card_data.ability.effect == "Lucky Card" then
|
||||
local exact_dollars, min_dollars, max_dollars = DV.SIM.get_probabilistic_extremes(pseudorandom("notthistime"), 15, card_data.ability.p_dollars, 0)
|
||||
DV.SIM.add_dollars(exact_dollars, min_dollars, max_dollars)
|
||||
local exact_dollars, min_dollars, max_dollars = FN.SIM.get_probabilistic_extremes(pseudorandom("notthistime"), 15, card_data.ability.p_dollars, 0)
|
||||
FN.SIM.add_dollars(exact_dollars, min_dollars, max_dollars)
|
||||
-- Careful not to overwrite `card_data.lucky_trigger` outright:
|
||||
if exact_dollars > 0 then card_data.lucky_trigger.exact = true end
|
||||
if min_dollars > 0 then card_data.lucky_trigger.min = true end
|
||||
if max_dollars > 0 then card_data.lucky_trigger.max = true end
|
||||
else
|
||||
DV.SIM.add_dollars(card_data.ability.p_dollars)
|
||||
FN.SIM.add_dollars(card_data.ability.p_dollars)
|
||||
end
|
||||
end
|
||||
|
||||
-- Edition:
|
||||
if card_data.edition then
|
||||
if card_data.edition.chips then DV.SIM.add_chips(card_data.edition.chips) end
|
||||
if card_data.edition.mult then DV.SIM.add_mult(card_data.edition.mult) end
|
||||
if card_data.edition.x_mult then DV.SIM.x_mult(card_data.edition.x_mult) end
|
||||
if card_data.edition.chips then FN.SIM.add_chips(card_data.edition.chips) end
|
||||
if card_data.edition.mult then FN.SIM.add_mult(card_data.edition.mult) end
|
||||
if card_data.edition.x_mult then FN.SIM.x_mult(card_data.edition.x_mult) end
|
||||
end
|
||||
|
||||
elseif context.cardarea == G.hand then
|
||||
if card_data.ability.h_mult > 0 then
|
||||
DV.SIM.add_mult(card_data.ability.h_mult)
|
||||
FN.SIM.add_mult(card_data.ability.h_mult)
|
||||
end
|
||||
|
||||
if card_data.ability.h_x_mult > 0 then
|
||||
DV.SIM.x_mult(card_data.ability.h_x_mult)
|
||||
FN.SIM.x_mult(card_data.ability.h_x_mult)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -405,16 +405,16 @@ end
|
||||
-- MICRO LEVEL (JOKERS):
|
||||
--
|
||||
|
||||
function DV.SIM.simulate_all_jokers(cardarea, context_args)
|
||||
for _, joker in ipairs(DV.SIM.env.jokers) do
|
||||
DV.SIM.simulate_joker(joker, DV.SIM.get_context(cardarea, context_args))
|
||||
function FN.SIM.simulate_all_jokers(cardarea, context_args)
|
||||
for _, joker in ipairs(FN.SIM.env.jokers) do
|
||||
FN.SIM.simulate_joker(joker, FN.SIM.get_context(cardarea, context_args))
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.simulate_joker(joker_obj, context)
|
||||
function FN.SIM.simulate_joker(joker_obj, context)
|
||||
-- Do nothing if debuffed:
|
||||
if joker_obj.debuff then return end
|
||||
|
||||
local joker_simulation_function = DV.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
|
||||
end
|
||||
13
FNPreview.json
Normal file
13
FNPreview.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"id": "FNPreview",
|
||||
"name": "Fantoms Preview",
|
||||
"display_name": "Fantoms Preview",
|
||||
"author": ["Fantoms"],
|
||||
"description": "A QoL mod for balatro allowing for a preview of score/money before submitting the hand.",
|
||||
"prefix": "fn",
|
||||
"main_file": "CorePreview.lua",
|
||||
"priority": 0,
|
||||
"version": "1.1",
|
||||
"dependencies": [],
|
||||
"conflicts": []
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
--- Divvy's Preview for Balatro - Init.lua
|
||||
--
|
||||
-- Global values that must be present for the rest of this mod to work.
|
||||
|
||||
if not DV then DV = {} end
|
||||
|
||||
DV.PRE = {
|
||||
data = {
|
||||
score = {min = 0, exact = 0, max = 0},
|
||||
dollars = {min = 0, exact = 0, max = 0}
|
||||
},
|
||||
text = {
|
||||
score = {l = "", r = ""},
|
||||
dollars = {top = "", bot = ""}
|
||||
},
|
||||
joker_order = {},
|
||||
hand_order = {}
|
||||
}
|
||||
|
||||
DV.PRE._start_up = Game.start_up
|
||||
function Game:start_up()
|
||||
DV.PRE._start_up(self)
|
||||
|
||||
if not G.SETTINGS.DV then G.SETTINGS.DV = {} end
|
||||
if not G.SETTINGS.DV.PRE then
|
||||
G.SETTINGS.DV.PRE = true
|
||||
|
||||
G.SETTINGS.DV.preview_score = true
|
||||
G.SETTINGS.DV.preview_dollars = true
|
||||
G.SETTINGS.DV.hide_face_down = true
|
||||
G.SETTINGS.DV.show_min_max = true
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,46 +0,0 @@
|
||||
DVSJ.simulate_mp_defensive_joker= function(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global then
|
||||
DV.SIM.add_chips(joker_obj.ability.t_chips)
|
||||
end
|
||||
end
|
||||
|
||||
DVSJ.simulate_mp_taxes = function(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global then
|
||||
DV.SIM.add_mult(joker_obj.ability.extra.mult)
|
||||
end
|
||||
end
|
||||
|
||||
DVSJ.simulate_mp_pacifist = function(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global and not MP.is_pvp_boss() then
|
||||
DV.SIM.x_mult(joker_obj.ability.extra.x_mult)
|
||||
end
|
||||
end
|
||||
|
||||
DVSJ.simulate_mp_conjoined_joker = function(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global and MP.is_pvp_boss() then
|
||||
DV.SIM.x_mult(joker_obj.ability.extra.x_mult)
|
||||
end
|
||||
end
|
||||
|
||||
DVSJ.simulate_mp_hanging_chad = function(joker_obj, context)
|
||||
if context.cardarea == G.play and context.repetition then
|
||||
if context.other_card == context.scoring_hand[1] and not context.other_card.debuff then
|
||||
DV.SIM.add_reps(joker_obj.ability.extra)
|
||||
end
|
||||
if context.other_card == context.scoring_hand[2] and not context.other_card.debuff then
|
||||
DV.SIM.add_reps(joker_obj.ability.extra)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
DVSJ.simulate_mp_lets_go_gambling = function(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global then
|
||||
|
||||
local rand = pseudorandom("gambling") -- Must reuse same pseudorandom value:
|
||||
local exact_xmult, min_xmult, max_xmult = DV.SIM.get_probabilistic_extremes(rand, joker_obj.ability.extra.odds, joker_obj.ability.extra.xmult, 1)
|
||||
local exact_money, min_money, max_money = DV.SIM.get_probabilistic_extremes(rand, joker_obj.ability.extra.odds, joker_obj.ability.extra.dollars, 0)
|
||||
|
||||
DV.SIM.add_dollars(exact_money, min_money, max_money)
|
||||
DV.SIM.x_mult(exact_xmult, min_xmult, max_xmult)
|
||||
end
|
||||
end
|
||||
34
InitPreview.lua
Normal file
34
InitPreview.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
--- Original: Divvy's Preview for Balatro - Init.lua
|
||||
--
|
||||
-- Global values that must be present for the rest of this mod to work.
|
||||
|
||||
if not FN then FN = {} end
|
||||
|
||||
FN.PRE = {
|
||||
data = {
|
||||
score = {min = 0, exact = 0, max = 0},
|
||||
dollars = {min = 0, exact = 0, max = 0}
|
||||
},
|
||||
text = {
|
||||
score = {l = "", r = ""},
|
||||
dollars = {top = "", bot = ""}
|
||||
},
|
||||
joker_order = {},
|
||||
hand_order = {}
|
||||
}
|
||||
|
||||
FN.PRE._start_up = Game.start_up
|
||||
function Game:start_up()
|
||||
FN.PRE._start_up(self)
|
||||
|
||||
if not G.SETTINGS.FN then G.SETTINGS.FN = {} end
|
||||
if not G.SETTINGS.FN.PRE then
|
||||
G.SETTINGS.FN.PRE = true
|
||||
|
||||
G.SETTINGS.FN.preview_score = true
|
||||
G.SETTINGS.FN.preview_dollars = true
|
||||
G.SETTINGS.FN.hide_face_down = true
|
||||
G.SETTINGS.FN.show_min_max = true
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,10 +1,10 @@
|
||||
--- Divvy's Simulation for Balatro - Init.lua
|
||||
--- Original: Divvy's Simulation for Balatro - Init.lua
|
||||
--
|
||||
-- Global values that must be present for the rest of this mod to work.
|
||||
|
||||
if not DV then DV = {} end
|
||||
if not FN then FN = {} end
|
||||
|
||||
DV.SIM = {
|
||||
FN.SIM = {
|
||||
JOKERS = {},
|
||||
|
||||
running = {
|
||||
@@ -1,4 +1,4 @@
|
||||
--- Divvy's Preview for Balatro - Interface.lua
|
||||
--- Original: Divvy's Preview for Balatro - Interface.lua
|
||||
--
|
||||
-- The user interface components that display simulation results.
|
||||
|
||||
@@ -7,43 +7,43 @@ local orig_hud = create_UIBox_HUD
|
||||
function create_UIBox_HUD()
|
||||
local contents = orig_hud()
|
||||
|
||||
local score_node_wrap = {n=G.UIT.R, config={id = "dv_pre_score_wrap", align = "cm", padding = 0.1}, nodes={}}
|
||||
if G.SETTINGS.DV.preview_score then table.insert(score_node_wrap.nodes, DV.PRE.get_score_node()) end
|
||||
local score_node_wrap = {n=G.UIT.R, config={id = "fn_pre_score_wrap", align = "cm", padding = 0.1}, nodes={}}
|
||||
if G.SETTINGS.FN.preview_score then table.insert(score_node_wrap.nodes, FN.PRE.get_score_node()) end
|
||||
table.insert(contents.nodes[1].nodes[1].nodes[4].nodes[1].nodes, score_node_wrap)
|
||||
|
||||
local dollars_node_wrap = {n=G.UIT.C, config={id = "dv_pre_dollars_wrap", align = "cm"}, nodes={}}
|
||||
if G.SETTINGS.DV.preview_dollars then table.insert(dollars_node_wrap.nodes, DV.PRE.get_dollars_node()) end
|
||||
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
|
||||
table.insert(contents.nodes[1].nodes[1].nodes[5].nodes[2].nodes[3].nodes[1].nodes[1].nodes[1].nodes, dollars_node_wrap)
|
||||
|
||||
return contents
|
||||
end
|
||||
|
||||
function DV.PRE.get_score_node()
|
||||
function FN.PRE.get_score_node()
|
||||
local text_scale = nil
|
||||
if true then text_scale = 0.5
|
||||
else text_scale = 0.75 end
|
||||
|
||||
return {n = G.UIT.C, config = {id = "dv_pre_score", align = "cm"}, nodes={
|
||||
{n=G.UIT.O, config={id = "dv_pre_l", func = "dv_pre_score_UI_set", object = DynaText({string = {{ref_table = DV.PRE.text.score, ref_value = "l"}}, colours = {G.C.UI.TEXT_LIGHT}, shadow = true, float = true, scale = text_scale})}},
|
||||
{n=G.UIT.O, config={id = "dv_pre_r", func = "dv_pre_score_UI_set", object = DynaText({string = {{ref_table = DV.PRE.text.score, ref_value = "r"}}, colours = {G.C.UI.TEXT_LIGHT}, shadow = true, float = true, scale = text_scale})}},
|
||||
return {n = G.UIT.C, config = {id = "fn_pre_score", align = "cm"}, nodes={
|
||||
{n=G.UIT.O, config={id = "fn_pre_l", func = "fn_pre_score_UI_set", object = DynaText({string = {{ref_table = FN.PRE.text.score, ref_value = "l"}}, colours = {G.C.UI.TEXT_LIGHT}, shadow = true, float = true, scale = text_scale})}},
|
||||
{n=G.UIT.O, config={id = "fn_pre_r", func = "fn_pre_score_UI_set", object = DynaText({string = {{ref_table = FN.PRE.text.score, ref_value = "r"}}, colours = {G.C.UI.TEXT_LIGHT}, shadow = true, float = true, scale = text_scale})}},
|
||||
}}
|
||||
end
|
||||
|
||||
function DV.PRE.get_dollars_node()
|
||||
local top_color = DV.PRE.get_dollar_colour(0)
|
||||
function FN.PRE.get_dollars_node()
|
||||
local top_color = FN.PRE.get_dollar_colour(0)
|
||||
local bot_color = top_color
|
||||
if DV.PRE.data ~= nil then
|
||||
top_color = DV.PRE.get_dollar_colour(DV.PRE.data.dollars.max)
|
||||
bot_color = DV.PRE.get_dollar_colour(DV.PRE.data.dollars.min)
|
||||
if FN.PRE.data ~= nil then
|
||||
top_color = FN.PRE.get_dollar_colour(FN.PRE.data.dollars.max)
|
||||
bot_color = FN.PRE.get_dollar_colour(FN.PRE.data.dollars.min)
|
||||
else
|
||||
end
|
||||
return {n=G.UIT.C, config={id = "dv_pre_dollars", align = "cm"}, nodes={
|
||||
return {n=G.UIT.C, config={id = "fn_pre_dollars", align = "cm"}, nodes={
|
||||
{n=G.UIT.R, config={align = "cm"}, nodes={
|
||||
{n=G.UIT.O, config={id = "dv_pre_dollars_top", func = "dv_pre_dollars_UI_set", object = DynaText({string = {{ref_table = DV.PRE.text.dollars, ref_value = "top"}}, colours = {top_color}, shadow = true, spacing = 2, bump = true, scale = 0.5})}}
|
||||
{n=G.UIT.O, config={id = "fn_pre_dollars_top", func = "fn_pre_dollars_UI_set", object = DynaText({string = {{ref_table = FN.PRE.text.dollars, ref_value = "top"}}, colours = {top_color}, shadow = true, spacing = 2, bump = true, scale = 0.5})}}
|
||||
}},
|
||||
{n=G.UIT.R, config={minh = 0.05}, nodes={}},
|
||||
{n=G.UIT.R, config={align = "cm"}, nodes={
|
||||
{n=G.UIT.O, config={id = "dv_pre_dollars_bot", func = "dv_pre_dollars_UI_set", object = DynaText({string = {{ref_table = DV.PRE.text.dollars, ref_value = "bot"}}, colours = {bot_color}, shadow = true, spacing = 2, bump = true, scale = 0.5})}},
|
||||
{n=G.UIT.O, config={id = "fn_pre_dollars_bot", func = "fn_pre_dollars_UI_set", object = DynaText({string = {{ref_table = FN.PRE.text.dollars, ref_value = "bot"}}, colours = {bot_color}, shadow = true, spacing = 2, bump = true, scale = 0.5})}},
|
||||
}}
|
||||
}}
|
||||
end
|
||||
@@ -52,17 +52,17 @@ end
|
||||
-- SETTINGS:
|
||||
--
|
||||
|
||||
function DV.get_preview_settings_page()
|
||||
function FN.get_preview_settings_page()
|
||||
local function preview_score_toggle_callback(e)
|
||||
if not G.HUD then return end
|
||||
|
||||
if G.SETTINGS.DV.preview_score then
|
||||
if G.SETTINGS.FN.preview_score then
|
||||
-- Preview was just enabled, so add preview node:
|
||||
G.HUD:add_child(DV.PRE.get_score_node(), G.HUD:get_UIE_by_ID("dv_pre_score_wrap"))
|
||||
DV.PRE.data = DV.PRE.simulate()
|
||||
G.HUD:add_child(FN.PRE.get_score_node(), G.HUD:get_UIE_by_ID("fn_pre_score_wrap"))
|
||||
FN.PRE.data = FN.PRE.simulate()
|
||||
else
|
||||
-- Preview was just disabled, so remove preview node:
|
||||
G.HUD:get_UIE_by_ID("dv_pre_score").parent:remove()
|
||||
G.HUD:get_UIE_by_ID("fn_pre_score").parent:remove()
|
||||
end
|
||||
G.HUD:recalculate()
|
||||
end
|
||||
@@ -70,13 +70,13 @@ function DV.get_preview_settings_page()
|
||||
local function preview_dollars_toggle_callback(_)
|
||||
if not G.HUD then return end
|
||||
|
||||
if G.SETTINGS.DV.preview_dollars then
|
||||
if G.SETTINGS.FN.preview_dollars then
|
||||
-- Preview was just enabled, so add preview node:
|
||||
G.HUD:add_child(DV.PRE.get_dollars_node(), G.HUD:get_UIE_by_ID("dv_pre_dollars_wrap"))
|
||||
DV.PRE.data = DV.PRE.simulate()
|
||||
G.HUD:add_child(FN.PRE.get_dollars_node(), G.HUD:get_UIE_by_ID("fn_pre_dollars_wrap"))
|
||||
FN.PRE.data = FN.PRE.simulate()
|
||||
else
|
||||
-- Preview was just disabled, so remove preview node:
|
||||
G.HUD:get_UIE_by_ID("dv_pre_dollars").parent:remove()
|
||||
G.HUD:get_UIE_by_ID("fn_pre_dollars").parent:remove()
|
||||
end
|
||||
G.HUD:recalculate()
|
||||
end
|
||||
@@ -84,7 +84,7 @@ function DV.get_preview_settings_page()
|
||||
local function face_down_toggle_callback(_)
|
||||
if not G.HUD then return end
|
||||
|
||||
DV.PRE.data = DV.PRE.simulate()
|
||||
FN.PRE.data = FN.PRE.simulate()
|
||||
G.HUD:recalculate()
|
||||
end
|
||||
|
||||
@@ -92,16 +92,16 @@ function DV.get_preview_settings_page()
|
||||
{n=G.UIT.ROOT, config={align = "cm", padding = 0.05, colour = G.C.CLEAR}, nodes={
|
||||
create_toggle({id = "score_toggle",
|
||||
label = "Enable Score Preview",
|
||||
ref_table = G.SETTINGS.DV,
|
||||
ref_table = G.SETTINGS.FN,
|
||||
ref_value = "preview_score",
|
||||
callback = preview_score_toggle_callback}),
|
||||
create_toggle({id = "dollars_toggle",
|
||||
label = "Enable Money Preview",
|
||||
ref_table = G.SETTINGS.DV,
|
||||
ref_table = G.SETTINGS.FN,
|
||||
ref_value = "preview_dollars",
|
||||
callback = preview_dollars_toggle_callback}),
|
||||
create_toggle({label = "Hide Preview if Any Card is Face-Down",
|
||||
ref_table = G.SETTINGS.DV,
|
||||
ref_table = G.SETTINGS.FN,
|
||||
ref_value = "hide_face_down",
|
||||
callback = face_down_toggle_callback})
|
||||
}}
|
||||
46
Jokers/Multiplayer.lua
Normal file
46
Jokers/Multiplayer.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
FNSJ.simulate_mp_defensive_joker= function(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global then
|
||||
FN.SIM.add_chips(joker_obj.ability.t_chips)
|
||||
end
|
||||
end
|
||||
|
||||
FNSJ.simulate_mp_taxes = function(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global then
|
||||
FN.SIM.add_mult(joker_obj.ability.extra.mult)
|
||||
end
|
||||
end
|
||||
|
||||
FNSJ.simulate_mp_pacifist = function(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global and not MP.is_pvp_boss() then
|
||||
FN.SIM.x_mult(joker_obj.ability.extra.x_mult)
|
||||
end
|
||||
end
|
||||
|
||||
FNSJ.simulate_mp_conjoined_joker = function(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global and MP.is_pvp_boss() then
|
||||
FN.SIM.x_mult(joker_obj.ability.extra.x_mult)
|
||||
end
|
||||
end
|
||||
|
||||
FNSJ.simulate_mp_hanging_chad = function(joker_obj, context)
|
||||
if context.cardarea == G.play and context.repetition then
|
||||
if context.other_card == context.scoring_hand[1] and not context.other_card.debuff then
|
||||
FN.SIM.add_reps(joker_obj.ability.extra)
|
||||
end
|
||||
if context.other_card == context.scoring_hand[2] and not context.other_card.debuff then
|
||||
FN.SIM.add_reps(joker_obj.ability.extra)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
FNSJ.simulate_mp_lets_go_gambling = function(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global then
|
||||
|
||||
local rand = pseudorandom("gambling") -- Must reuse same pseudorandom value:
|
||||
local exact_xmult, min_xmult, max_xmult = FN.SIM.get_probabilistic_extremes(rand, joker_obj.ability.extra.odds, joker_obj.ability.extra.xmult, 1)
|
||||
local exact_money, min_money, max_money = FN.SIM.get_probabilistic_extremes(rand, joker_obj.ability.extra.odds, joker_obj.ability.extra.dollars, 0)
|
||||
|
||||
FN.SIM.add_dollars(exact_money, min_money, max_money)
|
||||
FN.SIM.x_mult(exact_xmult, min_xmult, max_xmult)
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
674
LICENSE
674
LICENSE
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
19
README.md
19
README.md
@@ -1,19 +0,0 @@
|
||||
# Fantoms-Preview
|
||||
A QoL mod for balatro allowing for a preview of score/money before submitting the hand.
|
||||
|
||||
## Installation
|
||||
1. Install Lovely
|
||||
2. Download this mod by clicking code-> download zip
|
||||
3. Unzip this folder into %appdata%/Balatro/Mods
|
||||
|
||||
## Features
|
||||
Dynamically updates score/money preview based on usee input such as selecting cards or reordering jokers
|
||||
|
||||
Displays a range of scores/money if luck based elements are present
|
||||
|
||||
Compatibility with jokers specific to the popular multiplayer mod by Virtualized
|
||||
|
||||
## Notice
|
||||
|
||||
Does not work with modded jokers unless specifically implemented
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- Divvy's Preview for Balatro - Utils.lua
|
||||
--- Original: Divvy's Preview for Balatro - Utils.lua
|
||||
--
|
||||
-- Utilities for checking states and formatting display.
|
||||
|
||||
function DV.PRE.is_enough_to_win(chips)
|
||||
function FN.PRE.is_enough_to_win(chips)
|
||||
if G.GAME.blind and
|
||||
(G.STATE == G.STATES.SELECTING_HAND or
|
||||
G.STATE == G.STATES.DRAW_TO_HAND or
|
||||
@@ -12,7 +12,7 @@ function DV.PRE.is_enough_to_win(chips)
|
||||
end
|
||||
end
|
||||
|
||||
function DV.PRE.format_number(num)
|
||||
function FN.PRE.format_number(num)
|
||||
if not num or type(num) ~= 'number' then return num or '' end
|
||||
-- Start using e-notation earlier to reduce number length, if showing min and max for preview:
|
||||
if true and num >= 1e7 then
|
||||
@@ -23,19 +23,19 @@ function DV.PRE.format_number(num)
|
||||
return number_format(num) -- Default Balatro function.
|
||||
end
|
||||
|
||||
function DV.PRE.get_dollar_colour(n)
|
||||
function FN.PRE.get_dollar_colour(n)
|
||||
if n == 0 then return HEX("7e7667")
|
||||
elseif n > 0 then return G.C.MONEY
|
||||
elseif n < 0 then return G.C.RED
|
||||
end
|
||||
end
|
||||
|
||||
function DV.PRE.get_sign_str(n)
|
||||
function FN.PRE.get_sign_str(n)
|
||||
if n >= 0 then return "+"
|
||||
else return "" -- Negative numbers already have a sign
|
||||
end
|
||||
end
|
||||
|
||||
function DV.PRE.enabled()
|
||||
return G.SETTINGS.DV.preview_score or G.SETTINGS.DV.preview_dollars
|
||||
function FN.PRE.enabled()
|
||||
return G.SETTINGS.FN.preview_score or G.SETTINGS.FN.preview_dollars
|
||||
end
|
||||
@@ -1,50 +1,50 @@
|
||||
--- Divvy's Simulation for Balatro - Utils.lua
|
||||
--- Original: Divvy's Simulation for Balatro - Utils.lua
|
||||
--
|
||||
-- Utilities for writing simulation functions for jokers.
|
||||
--
|
||||
-- In general, these functions replicate the game's internal calculations and
|
||||
-- variables in order to avoid affecting the game's state during simulation.
|
||||
-- These functions ensure that the score calculation remains identical to the
|
||||
-- game; DO NOT directly modify the `DV.SIM.running` score variables.
|
||||
-- game; DO NOT directly modify the `FN.SIM.running` score variables.
|
||||
|
||||
--
|
||||
-- HIGH-LEVEL:
|
||||
--
|
||||
|
||||
function DV.SIM.JOKERS.add_suit_mult(joker_obj, context)
|
||||
function FN.SIM.JOKERS.add_suit_mult(joker_obj, context)
|
||||
if context.cardarea == G.play and context.individual then
|
||||
if DV.SIM.is_suit(context.other_card, joker_obj.ability.extra.suit) and not context.other_card.debuff then
|
||||
DV.SIM.add_mult(joker_obj.ability.extra.s_mult)
|
||||
if FN.SIM.is_suit(context.other_card, joker_obj.ability.extra.suit) and not context.other_card.debuff then
|
||||
FN.SIM.add_mult(joker_obj.ability.extra.s_mult)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.JOKERS.add_type_mult(joker_obj, context)
|
||||
function FN.SIM.JOKERS.add_type_mult(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global
|
||||
and next(context.poker_hands[joker_obj.ability.type])
|
||||
then
|
||||
DV.SIM.add_mult(joker_obj.ability.t_mult)
|
||||
FN.SIM.add_mult(joker_obj.ability.t_mult)
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.JOKERS.add_type_chips(joker_obj, context)
|
||||
function FN.SIM.JOKERS.add_type_chips(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global
|
||||
and next(context.poker_hands[joker_obj.ability.type])
|
||||
then
|
||||
DV.SIM.add_chips(joker_obj.ability.t_chips)
|
||||
FN.SIM.add_chips(joker_obj.ability.t_chips)
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.JOKERS.x_mult_if_global(joker_obj, context)
|
||||
function FN.SIM.JOKERS.x_mult_if_global(joker_obj, context)
|
||||
if context.cardarea == G.jokers and context.global then
|
||||
if joker_obj.ability.x_mult > 1 and
|
||||
(joker_obj.ability.type == "" or next(context.poker_hands[joker_obj.ability.type])) then
|
||||
DV.SIM.x_mult(joker_obj.ability.x_mult)
|
||||
FN.SIM.x_mult(joker_obj.ability.x_mult)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.get_probabilistic_extremes(random_value, odds, reward, default)
|
||||
function FN.SIM.get_probabilistic_extremes(random_value, odds, reward, default)
|
||||
-- Exact mirrors the game's probability calculation
|
||||
local exact = default
|
||||
if random_value < G.GAME.probabilities.normal/odds then
|
||||
@@ -63,7 +63,7 @@ function DV.SIM.get_probabilistic_extremes(random_value, odds, reward, default)
|
||||
return exact, min, max
|
||||
end
|
||||
|
||||
function DV.SIM.adjust_field_with_range(adj_func, field, mod_func, exact_value, min_value, max_value)
|
||||
function FN.SIM.adjust_field_with_range(adj_func, field, mod_func, exact_value, min_value, max_value)
|
||||
if not exact_value then error("Cannot adjust field, exact_value is missing.") end
|
||||
|
||||
if not min_value or not max_value then
|
||||
@@ -71,37 +71,37 @@ function DV.SIM.adjust_field_with_range(adj_func, field, mod_func, exact_value,
|
||||
max_value = exact_value
|
||||
end
|
||||
|
||||
DV.SIM.running.min[field] = mod_func(adj_func(DV.SIM.running.min[field], min_value))
|
||||
DV.SIM.running.exact[field] = mod_func(adj_func(DV.SIM.running.exact[field], exact_value))
|
||||
DV.SIM.running.max[field] = mod_func(adj_func(DV.SIM.running.max[field], max_value))
|
||||
FN.SIM.running.min[field] = mod_func(adj_func(FN.SIM.running.min[field], min_value))
|
||||
FN.SIM.running.exact[field] = mod_func(adj_func(FN.SIM.running.exact[field], exact_value))
|
||||
FN.SIM.running.max[field] = mod_func(adj_func(FN.SIM.running.max[field], max_value))
|
||||
end
|
||||
|
||||
function DV.SIM.add_chips(exact, min, max)
|
||||
DV.SIM.adjust_field_with_range(function(x, y) return x + y end, "chips", mod_chips, exact, min, max)
|
||||
function FN.SIM.add_chips(exact, min, max)
|
||||
FN.SIM.adjust_field_with_range(function(x, y) return x + y end, "chips", mod_chips, exact, min, max)
|
||||
end
|
||||
|
||||
function DV.SIM.add_mult(exact, min, max)
|
||||
DV.SIM.adjust_field_with_range(function(x, y) return x + y end, "mult", mod_mult, exact, min, max)
|
||||
function FN.SIM.add_mult(exact, min, max)
|
||||
FN.SIM.adjust_field_with_range(function(x, y) return x + y end, "mult", mod_mult, exact, min, max)
|
||||
end
|
||||
|
||||
function DV.SIM.x_mult(exact, min, max)
|
||||
DV.SIM.adjust_field_with_range(function(x, y) return x * y end, "mult", mod_mult, exact, min, max)
|
||||
function FN.SIM.x_mult(exact, min, max)
|
||||
FN.SIM.adjust_field_with_range(function(x, y) return x * y end, "mult", mod_mult, exact, min, max)
|
||||
end
|
||||
|
||||
function DV.SIM.add_dollars(exact, min, max)
|
||||
function FN.SIM.add_dollars(exact, min, max)
|
||||
-- NOTE: no mod_func for dollars, so have to declare an identity function
|
||||
DV.SIM.adjust_field_with_range(function(x, y) return x + y end, "dollars", function(x) return x end, exact, min, max)
|
||||
FN.SIM.adjust_field_with_range(function(x, y) return x + y end, "dollars", function(x) return x end, exact, min, max)
|
||||
end
|
||||
|
||||
function DV.SIM.add_reps(n)
|
||||
DV.SIM.running.reps = DV.SIM.running.reps + n
|
||||
function FN.SIM.add_reps(n)
|
||||
FN.SIM.running.reps = FN.SIM.running.reps + n
|
||||
end
|
||||
|
||||
--
|
||||
-- LOW-LEVEL:
|
||||
--
|
||||
|
||||
function DV.SIM.is_suit(card_data, suit, ignore_scorability)
|
||||
function FN.SIM.is_suit(card_data, suit, ignore_scorability)
|
||||
if card_data.debuff and not ignore_scorability then return end
|
||||
if card_data.ability.effect == "Stone Card" then
|
||||
return false
|
||||
@@ -117,15 +117,15 @@ function DV.SIM.is_suit(card_data, suit, ignore_scorability)
|
||||
return card_data.suit == suit
|
||||
end
|
||||
|
||||
function DV.SIM.get_rank(card_data)
|
||||
function FN.SIM.get_rank(card_data)
|
||||
if card_data.ability.effect == "Stone Card" and not card_data.vampired then
|
||||
DV.SIM.misc.next_stone_id = DV.SIM.misc.next_stone_id - 1
|
||||
return DV.SIM.misc.next_stone_id
|
||||
FN.SIM.misc.next_stone_id = FN.SIM.misc.next_stone_id - 1
|
||||
return FN.SIM.misc.next_stone_id
|
||||
end
|
||||
return card_data.rank
|
||||
end
|
||||
|
||||
function DV.SIM.is_rank(card_data, ranks)
|
||||
function FN.SIM.is_rank(card_data, ranks)
|
||||
if card_data.ability.effect == "Stone Card" then return false end
|
||||
|
||||
if type(ranks) == "number" then ranks = {ranks} end
|
||||
@@ -135,7 +135,7 @@ function DV.SIM.is_rank(card_data, ranks)
|
||||
return false
|
||||
end
|
||||
|
||||
function DV.SIM.check_rank_parity(card_data, check_even)
|
||||
function FN.SIM.check_rank_parity(card_data, check_even)
|
||||
if check_even then
|
||||
local is_even_numbered = (card_data.rank <= 10 and card_data.rank >= 0 and card_data.rank % 2 == 0)
|
||||
return is_even_numbered
|
||||
@@ -146,11 +146,11 @@ function DV.SIM.check_rank_parity(card_data, check_even)
|
||||
end
|
||||
end
|
||||
|
||||
function DV.SIM.is_face(card_data)
|
||||
return (DV.SIM.is_rank(card_data, {11, 12, 13}) or next(find_joker("Pareidolia")))
|
||||
function FN.SIM.is_face(card_data)
|
||||
return (FN.SIM.is_rank(card_data, {11, 12, 13}) or next(find_joker("Pareidolia")))
|
||||
end
|
||||
|
||||
function DV.SIM.set_ability(card_data, center)
|
||||
function FN.SIM.set_ability(card_data, center)
|
||||
-- See Card:set_ability()
|
||||
card_data.ability = {
|
||||
name = center.name,
|
||||
@@ -176,7 +176,7 @@ function DV.SIM.set_ability(card_data, center)
|
||||
}
|
||||
end
|
||||
|
||||
function DV.SIM.set_edition(card_data, edition)
|
||||
function FN.SIM.set_edition(card_data, edition)
|
||||
card_data.edition = nil
|
||||
if not edition then return end
|
||||
|
||||
BIN
assets/1x/icon.png
Normal file
BIN
assets/1x/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
assets/2x/icon.png
Normal file
BIN
assets/2x/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
22
lovely.toml
22
lovely.toml
@@ -5,17 +5,15 @@ priority = 0
|
||||
|
||||
# This manifest assumes the following release structure:
|
||||
#
|
||||
# Fantoms-Preview/
|
||||
# ├─ FNPreview
|
||||
# ├─ FNSimulate
|
||||
# Fantoms-Preview
|
||||
|
||||
[[patches]]
|
||||
[patches.copy]
|
||||
target = "globals.lua"
|
||||
position = "append"
|
||||
sources = [
|
||||
"FNSimulate/Init.lua",
|
||||
"FNPreview/Init.lua"
|
||||
"InitSimulate.lua",
|
||||
"InitPreview.lua"
|
||||
]
|
||||
|
||||
[[patches]]
|
||||
@@ -23,8 +21,8 @@ sources = [
|
||||
target = "main.lua"
|
||||
position = "append"
|
||||
sources = [
|
||||
"FNPreview/Core.lua",
|
||||
"FNPreview/Utils.lua"
|
||||
"CorePreview.lua",
|
||||
"UtilsPreview.lua"
|
||||
]
|
||||
|
||||
[[patches]]
|
||||
@@ -32,8 +30,8 @@ sources = [
|
||||
target = "functions/common_events.lua"
|
||||
position = "append"
|
||||
sources = [
|
||||
"FNSimulate/Engine.lua",
|
||||
"FNSimulate/Utils.lua"
|
||||
"EngineSimulate.lua",
|
||||
"UtilsSimulate.lua"
|
||||
]
|
||||
|
||||
[[patches]]
|
||||
@@ -41,15 +39,15 @@ sources = [
|
||||
target = "card.lua"
|
||||
position = "append"
|
||||
sources = [
|
||||
"FNSimulate/Jokers/_Vanilla.lua",
|
||||
"FNSimulate/Jokers/Multiplayer.lua"
|
||||
"Jokers/_Vanilla.lua",
|
||||
"Jokers/Multiplayer.lua"
|
||||
]
|
||||
|
||||
[[patches]]
|
||||
[patches.copy]
|
||||
target = "functions/UI_definitions.lua"
|
||||
position = "append"
|
||||
sources = [ "FNPreview/Interface.lua" ]
|
||||
sources = [ "InterfacePreview.lua" ]
|
||||
|
||||
[[patches]]
|
||||
[patches.pattern]
|
||||
|
||||
Reference in New Issue
Block a user