diff --git a/FNPreview/Core.lua b/CorePreview.lua similarity index 62% rename from FNPreview/Core.lua rename to CorePreview.lua index 8090360..f6d5355 100644 --- a/FNPreview/Core.lua +++ b/CorePreview.lua @@ -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 diff --git a/FNSimulate/Engine.lua b/EngineSimulate.lua similarity index 58% rename from FNSimulate/Engine.lua rename to EngineSimulate.lua index d09d6df..e82af51 100644 --- a/FNSimulate/Engine.lua +++ b/EngineSimulate.lua @@ -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 diff --git a/FNPreview.json b/FNPreview.json new file mode 100644 index 0000000..4cf25bf --- /dev/null +++ b/FNPreview.json @@ -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": [] +} \ No newline at end of file diff --git a/FNPreview/Init.lua b/FNPreview/Init.lua deleted file mode 100644 index 6673ab0..0000000 --- a/FNPreview/Init.lua +++ /dev/null @@ -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 diff --git a/FNSimulate/Jokers/Multiplayer.lua b/FNSimulate/Jokers/Multiplayer.lua deleted file mode 100644 index 02cf688..0000000 --- a/FNSimulate/Jokers/Multiplayer.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/InitPreview.lua b/InitPreview.lua new file mode 100644 index 0000000..a5332e8 --- /dev/null +++ b/InitPreview.lua @@ -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 diff --git a/FNSimulate/Init.lua b/InitSimulate.lua similarity index 91% rename from FNSimulate/Init.lua rename to InitSimulate.lua index 4caaac1..251186a 100644 --- a/FNSimulate/Init.lua +++ b/InitSimulate.lua @@ -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 = { diff --git a/FNPreview/Interface.lua b/InterfacePreview.lua similarity index 55% rename from FNPreview/Interface.lua rename to InterfacePreview.lua index a3d456b..3c4d9f7 100644 --- a/FNPreview/Interface.lua +++ b/InterfacePreview.lua @@ -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}) }} diff --git a/Jokers/Multiplayer.lua b/Jokers/Multiplayer.lua new file mode 100644 index 0000000..9b93b02 --- /dev/null +++ b/Jokers/Multiplayer.lua @@ -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 \ No newline at end of file diff --git a/FNSimulate/Jokers/_Vanilla.lua b/Jokers/_Vanilla.lua similarity index 52% rename from FNSimulate/Jokers/_Vanilla.lua rename to Jokers/_Vanilla.lua index 8566b33..62ddf7e 100644 --- a/FNSimulate/Jokers/_Vanilla.lua +++ b/Jokers/_Vanilla.lua @@ -2,138 +2,138 @@ -- -- The simulation functions for all of the vanilla Balatro jokers. -local DVSJ = DV.SIM.JOKERS +local FNSJ = FN.SIM.JOKERS -DVSJ.simulate_joker = function(joker_obj, context) +FNSJ.simulate_joker = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(joker_obj.ability.mult) + FN.SIM.add_mult(joker_obj.ability.mult) end end -DVSJ.simulate_greedy_joker = function(joker_obj, context) - DV.SIM.JOKERS.add_suit_mult(joker_obj, context) +FNSJ.simulate_greedy_joker = function(joker_obj, context) + FN.SIM.JOKERS.add_suit_mult(joker_obj, context) end -DVSJ.simulate_lusty_joker = function(joker_obj, context) - DV.SIM.JOKERS.add_suit_mult(joker_obj, context) +FNSJ.simulate_lusty_joker = function(joker_obj, context) + FN.SIM.JOKERS.add_suit_mult(joker_obj, context) end -DVSJ.simulate_wrathful_joker = function(joker_obj, context) - DV.SIM.JOKERS.add_suit_mult(joker_obj, context) +FNSJ.simulate_wrathful_joker = function(joker_obj, context) + FN.SIM.JOKERS.add_suit_mult(joker_obj, context) end -DVSJ.simulate_gluttenous_joker = function(joker_obj, context) - DV.SIM.JOKERS.add_suit_mult(joker_obj, context) +FNSJ.simulate_gluttenous_joker = function(joker_obj, context) + FN.SIM.JOKERS.add_suit_mult(joker_obj, context) end -DVSJ.simulate_jolly = function(joker_obj, context) - DV.SIM.JOKERS.add_type_mult(joker_obj, context) +FNSJ.simulate_jolly = function(joker_obj, context) + FN.SIM.JOKERS.add_type_mult(joker_obj, context) end -DVSJ.simulate_zany = function(joker_obj, context) - DV.SIM.JOKERS.add_type_mult(joker_obj, context) +FNSJ.simulate_zany = function(joker_obj, context) + FN.SIM.JOKERS.add_type_mult(joker_obj, context) end -DVSJ.simulate_mad = function(joker_obj, context) - DV.SIM.JOKERS.add_type_mult(joker_obj, context) +FNSJ.simulate_mad = function(joker_obj, context) + FN.SIM.JOKERS.add_type_mult(joker_obj, context) end -DVSJ.simulate_crazy = function(joker_obj, context) - DV.SIM.JOKERS.add_type_mult(joker_obj, context) +FNSJ.simulate_crazy = function(joker_obj, context) + FN.SIM.JOKERS.add_type_mult(joker_obj, context) end -DVSJ.simulate_droll = function(joker_obj, context) - DV.SIM.JOKERS.add_type_mult(joker_obj, context) +FNSJ.simulate_droll = function(joker_obj, context) + FN.SIM.JOKERS.add_type_mult(joker_obj, context) end -DVSJ.simulate_sly = function(joker_obj, context) - DV.SIM.JOKERS.add_type_chips(joker_obj, context) +FNSJ.simulate_sly = function(joker_obj, context) + FN.SIM.JOKERS.add_type_chips(joker_obj, context) end -DVSJ.simulate_wily = function(joker_obj, context) - DV.SIM.JOKERS.add_type_chips(joker_obj, context) +FNSJ.simulate_wily = function(joker_obj, context) + FN.SIM.JOKERS.add_type_chips(joker_obj, context) end -DVSJ.simulate_clever = function(joker_obj, context) - DV.SIM.JOKERS.add_type_chips(joker_obj, context) +FNSJ.simulate_clever = function(joker_obj, context) + FN.SIM.JOKERS.add_type_chips(joker_obj, context) end -DVSJ.simulate_devious = function(joker_obj, context) - DV.SIM.JOKERS.add_type_chips(joker_obj, context) +FNSJ.simulate_devious = function(joker_obj, context) + FN.SIM.JOKERS.add_type_chips(joker_obj, context) end -DVSJ.simulate_crafty = function(joker_obj, context) - DV.SIM.JOKERS.add_type_chips(joker_obj, context) +FNSJ.simulate_crafty = function(joker_obj, context) + FN.SIM.JOKERS.add_type_chips(joker_obj, context) end -DVSJ.simulate_half = function(joker_obj, context) +FNSJ.simulate_half = function(joker_obj, context) if context.cardarea == G.jokers and context.global then if #context.full_hand <= joker_obj.ability.extra.size then - DV.SIM.add_mult(joker_obj.ability.extra.mult) + FN.SIM.add_mult(joker_obj.ability.extra.mult) end end end -DVSJ.simulate_stencil = function(joker_obj, context) +FNSJ.simulate_stencil = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - local xmult = G.jokers.config.card_limit - #DV.SIM.env.jokers - for _, joker in ipairs(DV.SIM.env.jokers) do + local xmult = G.jokers.config.card_limit - #FN.SIM.env.jokers + for _, joker in ipairs(FN.SIM.env.jokers) do if joker.ability.name == "Joker Stencil" then xmult = xmult + 1 end end if joker_obj.ability.x_mult > 1 then - DV.SIM.x_mult(joker_obj.ability.x_mult) + FN.SIM.x_mult(joker_obj.ability.x_mult) end end end -DVSJ.simulate_four_fingers = function(joker_obj, context) +FNSJ.simulate_four_fingers = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_mime = function(joker_obj, context) +FNSJ.simulate_mime = function(joker_obj, context) if context.cardarea == G.hand and context.repetition then - DV.SIM.add_reps(joker_obj.ability.extra) + FN.SIM.add_reps(joker_obj.ability.extra) end end -DVSJ.simulate_credit_card = function(joker_obj, context) +FNSJ.simulate_credit_card = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_ceremonial = function(joker_obj, context) +FNSJ.simulate_ceremonial = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(joker_obj.ability.mult) + FN.SIM.add_mult(joker_obj.ability.mult) end end -DVSJ.simulate_banner = function(joker_obj, context) +FNSJ.simulate_banner = function(joker_obj, context) if context.cardarea == G.jokers and context.global then if G.GAME.current_round.discards_left > 0 then local chips = G.GAME.current_round.discards_left * joker_obj.ability.extra - DV.SIM.add_chips(chips) + FN.SIM.add_chips(chips) end end end -DVSJ.simulate_mystic_summit = function(joker_obj, context) +FNSJ.simulate_mystic_summit = function(joker_obj, context) if context.cardarea == G.jokers and context.global then if G.GAME.current_round.discards_left == joker_obj.ability.extra.d_remaining then - DV.SIM.add_mult(joker_obj.ability.extra.mult) + FN.SIM.add_mult(joker_obj.ability.extra.mult) end end end -DVSJ.simulate_marble = function(joker_obj, context) +FNSJ.simulate_marble = function(joker_obj, context) -- Effect not relevant (Blind) end -DVSJ.simulate_loyalty_card = function(joker_obj, context) +FNSJ.simulate_loyalty_card = function(joker_obj, context) if context.cardarea == G.jokers and context.global then local loyalty_diff = G.GAME.hands_played - joker_obj.ability.hands_played_at_create local loyalty_remaining = ((joker_obj.ability.extra.every-1) - loyalty_diff) % (joker_obj.ability.extra.every+1) if loyalty_remaining == joker_obj.ability.extra.every then - DV.SIM.x_mult(joker_obj.ability.extra.Xmult) + FN.SIM.x_mult(joker_obj.ability.extra.Xmult) end end end -DVSJ.simulate_8_ball = function(joker_obj, context) +FNSJ.simulate_8_ball = function(joker_obj, context) -- Effect might be relevant? end -DVSJ.simulate_misprint = function(joker_obj, context) +FNSJ.simulate_misprint = function(joker_obj, context) if context.cardarea == G.jokers and context.global then local exact_mult = pseudorandom("nope", joker_obj.ability.extra.min, joker_obj.ability.extra.max) - DV.SIM.add_mult(exact_mult, joker_obj.ability.extra.min, joker_obj.ability.extra.max) + FN.SIM.add_mult(exact_mult, joker_obj.ability.extra.min, joker_obj.ability.extra.max) end end -DVSJ.simulate_dusk = function(joker_obj, context) +FNSJ.simulate_dusk = function(joker_obj, context) if context.cardarea == G.play and context.repetition then -- Note: Checking against 1 is needed as hands_left is not decremented as part of simulation if G.GAME.current_round.hands_left == 1 then - DV.SIM.add_reps(joker_obj.ability.extra) + FN.SIM.add_reps(joker_obj.ability.extra) end end end -DVSJ.simulate_raised_fist = function(joker_obj, context) +FNSJ.simulate_raised_fist = function(joker_obj, context) if context.cardarea == G.hand and context.individual then local cur_mult, cur_rank = 15, 15 local raised_card = nil - for _, card in ipairs(DV.SIM.env.held_cards) do + for _, card in ipairs(FN.SIM.env.held_cards) do if cur_rank >= card.rank and card.ability.effect ~= 'Stone Card' then cur_mult = card.base_chips cur_rank = card.rank @@ -141,95 +141,95 @@ DVSJ.simulate_raised_fist = function(joker_obj, context) end end if raised_card == context.other_card and not context.other_card.debuff then - DV.SIM.add_mult(2 * cur_mult) + FN.SIM.add_mult(2 * cur_mult) end end end -DVSJ.simulate_chaos = function(joker_obj, context) +FNSJ.simulate_chaos = function(joker_obj, context) -- Effect not relevant (Free Reroll) end -DVSJ.simulate_fibonacci = function(joker_obj, context) +FNSJ.simulate_fibonacci = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_rank(context.other_card, {2, 3, 5, 8, 14}) and not context.other_card.debuff then - DV.SIM.add_mult(joker_obj.ability.extra) + if FN.SIM.is_rank(context.other_card, {2, 3, 5, 8, 14}) and not context.other_card.debuff then + FN.SIM.add_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_steel_joker = function(joker_obj, context) +FNSJ.simulate_steel_joker = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.x_mult(1 + joker_obj.ability.extra * joker_obj.ability.steel_tally) + FN.SIM.x_mult(1 + joker_obj.ability.extra * joker_obj.ability.steel_tally) end end -DVSJ.simulate_scary_face = function(joker_obj, context) +FNSJ.simulate_scary_face = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_face(context.other_card) and not context.other_card.debuff then - DV.SIM.add_chips(joker_obj.ability.extra) + if FN.SIM.is_face(context.other_card) and not context.other_card.debuff then + FN.SIM.add_chips(joker_obj.ability.extra) end end end -DVSJ.simulate_abstract = function(joker_obj, context) +FNSJ.simulate_abstract = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(#DV.SIM.env.jokers * joker_obj.ability.extra) + FN.SIM.add_mult(#FN.SIM.env.jokers * joker_obj.ability.extra) end end -DVSJ.simulate_delayed_grat = function(joker_obj, context) +FNSJ.simulate_delayed_grat = function(joker_obj, context) -- Effect not relevant (End of Round) end -DVSJ.simulate_hack = function(joker_obj, context) +FNSJ.simulate_hack = function(joker_obj, context) if context.cardarea == G.play and context.repetition then - if not context.other_card.debuff and DV.SIM.is_rank(context.other_card, {2, 3, 4, 5}) then - DV.SIM.add_reps(joker_obj.ability.extra) + if not context.other_card.debuff and FN.SIM.is_rank(context.other_card, {2, 3, 4, 5}) then + FN.SIM.add_reps(joker_obj.ability.extra) end end end -DVSJ.simulate_pareidolia = function(joker_obj, context) +FNSJ.simulate_pareidolia = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_gros_michel = function(joker_obj, context) +FNSJ.simulate_gros_michel = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(joker_obj.ability.extra.mult) + FN.SIM.add_mult(joker_obj.ability.extra.mult) end end -DVSJ.simulate_even_steven = function(joker_obj, context) +FNSJ.simulate_even_steven = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if not context.other_card.debuff and DV.SIM.check_rank_parity(context.other_card, true) then - DV.SIM.add_mult(joker_obj.ability.extra) + if not context.other_card.debuff and FN.SIM.check_rank_parity(context.other_card, true) then + FN.SIM.add_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_odd_todd = function(joker_obj, context) +FNSJ.simulate_odd_todd = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if not context.other_card.debuff and DV.SIM.check_rank_parity(context.other_card, false) then - DV.SIM.add_chips(joker_obj.ability.extra) + if not context.other_card.debuff and FN.SIM.check_rank_parity(context.other_card, false) then + FN.SIM.add_chips(joker_obj.ability.extra) end end end -DVSJ.simulate_scholar = function(joker_obj, context) +FNSJ.simulate_scholar = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_rank(context.other_card, 14) and not context.other_card.debuff then - DV.SIM.add_chips(joker_obj.ability.extra.chips) - DV.SIM.add_mult(joker_obj.ability.extra.mult) + if FN.SIM.is_rank(context.other_card, 14) and not context.other_card.debuff then + FN.SIM.add_chips(joker_obj.ability.extra.chips) + FN.SIM.add_mult(joker_obj.ability.extra.mult) end end end -DVSJ.simulate_business = function(joker_obj, context) +FNSJ.simulate_business = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_face(context.other_card) and not context.other_card.debuff then - local exact_dollars, min_dollars, max_dollars = DV.SIM.get_probabilistic_extremes(pseudorandom("false"), joker_obj.ability.extra, 2, 0) - DV.SIM.add_dollars(exact_dollars, min_dollars, max_dollars) + if FN.SIM.is_face(context.other_card) and not context.other_card.debuff then + local exact_dollars, min_dollars, max_dollars = FN.SIM.get_probabilistic_extremes(pseudorandom("false"), joker_obj.ability.extra, 2, 0) + FN.SIM.add_dollars(exact_dollars, min_dollars, max_dollars) end end end -DVSJ.simulate_supernova = function(joker_obj, context) +FNSJ.simulate_supernova = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(G.GAME.hands[context.scoring_name].played) + FN.SIM.add_mult(G.GAME.hands[context.scoring_name].played) end end -DVSJ.simulate_ride_the_bus = function(joker_obj, context) +FNSJ.simulate_ride_the_bus = function(joker_obj, context) if context.cardarea == G.jokers and context.before and not context.blueprint then local faces = false for _, scoring_card in ipairs(context.scoring_hand) do - if DV.SIM.is_face(scoring_card) then faces = true end + if FN.SIM.is_face(scoring_card) then faces = true end end if faces then joker_obj.ability.mult = 0 @@ -238,152 +238,152 @@ DVSJ.simulate_ride_the_bus = function(joker_obj, context) end end if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(joker_obj.ability.mult) + FN.SIM.add_mult(joker_obj.ability.mult) end end -DVSJ.simulate_space = function(joker_obj, context) +FNSJ.simulate_space = function(joker_obj, context) -- TODO: Verify if context.cardarea == G.jokers and context.before then - local hand_data = G.GAME.hands[DV.SIM.env.scoring_name] + local hand_data = G.GAME.hands[FN.SIM.env.scoring_name] local rand = pseudorandom("bad") -- Must reuse same pseudorandom value: - local exact_chips, min_chips, max_chips = DV.SIM.get_probabilistic_extremes(rand, joker_obj.ability.extra, hand_data.l_chips, 0) - local exact_mult, min_mult, max_mult = DV.SIM.get_probabilistic_extremes(rand, joker_obj.ability.extra, hand_data.l_mult, 0) + local exact_chips, min_chips, max_chips = FN.SIM.get_probabilistic_extremes(rand, joker_obj.ability.extra, hand_data.l_chips, 0) + local exact_mult, min_mult, max_mult = FN.SIM.get_probabilistic_extremes(rand, joker_obj.ability.extra, hand_data.l_mult, 0) - DV.SIM.add_chips(exact_chips, min_chips, max_chips) - DV.SIM.add_mult(exact_mult, min_mult, max_mult) + FN.SIM.add_chips(exact_chips, min_chips, max_chips) + FN.SIM.add_mult(exact_mult, min_mult, max_mult) end end -DVSJ.simulate_egg = function(joker_obj, context) +FNSJ.simulate_egg = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_burglar = function(joker_obj, context) +FNSJ.simulate_burglar = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_blackboard = function(joker_obj, context) +FNSJ.simulate_blackboard = function(joker_obj, context) if context.cardarea == G.jokers and context.global then local black_suits, all_cards = 0, 0 - for _, card in ipairs(DV.SIM.env.held_cards) do + for _, card in ipairs(FN.SIM.env.held_cards) do all_cards = all_cards + 1 - if DV.SIM.is_suit(card, "Clubs", true) or DV.SIM.is_suit(card, "Spades", true) then + if FN.SIM.is_suit(card, "Clubs", true) or FN.SIM.is_suit(card, "Spades", true) then black_suits = black_suits + 1 end end if black_suits == all_cards then - DV.SIM.x_mult(joker_obj.ability.extra) + FN.SIM.x_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_runner = function(joker_obj, context) +FNSJ.simulate_runner = function(joker_obj, context) if context.cardarea == G.jokers and context.before and not context.blueprint then if next(context.poker_hands["Straight"]) then joker_obj.ability.extra.chips = joker_obj.ability.extra.chips + joker_obj.ability.extra.chip_mod end end if context.cardarea == G.jokers and context.global then - DV.SIM.add_chips(joker_obj.ability.extra.chips) + FN.SIM.add_chips(joker_obj.ability.extra.chips) end end -DVSJ.simulate_ice_cream = function(joker_obj, context) +FNSJ.simulate_ice_cream = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_chips(joker_obj.ability.extra.chips) + FN.SIM.add_chips(joker_obj.ability.extra.chips) end end -DVSJ.simulate_dna = function(joker_obj, context) +FNSJ.simulate_dna = function(joker_obj, context) if context.cardarea == G.jokers and context.before then if G.GAME.current_round.hands_played == 0 and #context.full_hand == 1 then local new_card = copy_table(context.full_hand[1]) - table.insert(DV.SIM.env.held_cards, new_card) + table.insert(FN.SIM.env.held_cards, new_card) end end end -DVSJ.simulate_splash = function(joker_obj, context) +FNSJ.simulate_splash = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_blue_joker = function(joker_obj, context) +FNSJ.simulate_blue_joker = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_chips(joker_obj.ability.extra * #G.deck.cards) + FN.SIM.add_chips(joker_obj.ability.extra * #G.deck.cards) end end -DVSJ.simulate_sixth_sense = function(joker_obj, context) +FNSJ.simulate_sixth_sense = function(joker_obj, context) -- Effect might be relevant? end -DVSJ.simulate_constellation = function(joker_obj, context) - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) +FNSJ.simulate_constellation = function(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_hiker = function(joker_obj, context) +FNSJ.simulate_hiker = function(joker_obj, context) if context.cardarea == G.play and context.individual then if not context.other_card.debuff then context.other_card.ability.perma_bonus = (context.other_card.ability.perma_bonus or 0) + joker_obj.ability.extra end end end -DVSJ.simulate_faceless = function(joker_obj, context) +FNSJ.simulate_faceless = function(joker_obj, context) -- Effect not relevant (Discard) end -DVSJ.simulate_green_joker = function(joker_obj, context) +FNSJ.simulate_green_joker = function(joker_obj, context) if context.cardarea == G.jokers and context.before and not context.blueprint then joker_obj.ability.mult = joker_obj.ability.mult + joker_obj.ability.extra.hand_add end if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(joker_obj.ability.mult) + FN.SIM.add_mult(joker_obj.ability.mult) end end -DVSJ.simulate_superposition = function(joker_obj, context) +FNSJ.simulate_superposition = function(joker_obj, context) -- Effect might be relevant? end -DVSJ.simulate_todo_list = function(joker_obj, context) +FNSJ.simulate_todo_list = function(joker_obj, context) if context.cardarea == G.jokers and context.before then if context.scoring_name == joker_obj.ability.to_do_poker_hand then - DV.SIM.add_dollars(joker_obj.ability.extra.dollars) + FN.SIM.add_dollars(joker_obj.ability.extra.dollars) end end end -DVSJ.simulate_cavendish = function(joker_obj, context) +FNSJ.simulate_cavendish = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.x_mult(joker_obj.ability.extra.Xmult) + FN.SIM.x_mult(joker_obj.ability.extra.Xmult) end end -DVSJ.simulate_card_sharp = function(joker_obj, context) +FNSJ.simulate_card_sharp = function(joker_obj, context) if context.cardarea == G.jokers and context.global then if (G.GAME.hands[context.scoring_name] and G.GAME.hands[context.scoring_name].played_this_round > 1) then - DV.SIM.x_mult(joker_obj.ability.extra.Xmult) + FN.SIM.x_mult(joker_obj.ability.extra.Xmult) end end end -DVSJ.simulate_red_card = function(joker_obj, context) +FNSJ.simulate_red_card = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(joker_obj.ability.mult) + FN.SIM.add_mult(joker_obj.ability.mult) end end -DVSJ.simulate_madness = function(joker_obj, context) - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) +FNSJ.simulate_madness = function(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_square = function(joker_obj, context) +FNSJ.simulate_square = function(joker_obj, context) if context.cardarea == G.jokers and context.before and not context.blueprint then if #context.full_hand == 4 then joker_obj.ability.extra.chips = joker_obj.ability.extra.chips + joker_obj.ability.extra.chip_mod end end if context.cardarea == G.jokers and context.global then - DV.SIM.add_chips(joker_obj.ability.extra.chips) + FN.SIM.add_chips(joker_obj.ability.extra.chips) end end -DVSJ.simulate_seance = function(joker_obj, context) +FNSJ.simulate_seance = function(joker_obj, context) -- Effect might be relevant? (Consumable) end -DVSJ.simulate_riff_raff = function(joker_obj, context) +FNSJ.simulate_riff_raff = function(joker_obj, context) -- Effect not relevant (Blind) end -DVSJ.simulate_vampire = function(joker_obj, context) +FNSJ.simulate_vampire = function(joker_obj, context) if context.cardarea == G.jokers and context.before and not context.blueprint then local num_enhanced = 0 for _, card in ipairs(context.scoring_hand) do if card.ability.name ~= "Default Base" and not card.debuff then num_enhanced = num_enhanced + 1 - DV.SIM.set_ability(card, G.P_CENTERS.c_base) + FN.SIM.set_ability(card, G.P_CENTERS.c_base) end end if num_enhanced > 0 then @@ -391,31 +391,31 @@ DVSJ.simulate_vampire = function(joker_obj, context) end end - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_shortcut = function(joker_obj, context) +FNSJ.simulate_shortcut = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_hologram = function(joker_obj, context) - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) +FNSJ.simulate_hologram = function(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_vagabond = function(joker_obj, context) +FNSJ.simulate_vagabond = function(joker_obj, context) -- Effect might be relevant? (Consumable) end -DVSJ.simulate_baron = function(joker_obj, context) +FNSJ.simulate_baron = function(joker_obj, context) if context.cardarea == G.hand and context.individual then - if DV.SIM.is_rank(context.other_card, 13) and not context.other_card.debuff then - DV.SIM.x_mult(joker_obj.ability.extra) + if FN.SIM.is_rank(context.other_card, 13) and not context.other_card.debuff then + FN.SIM.x_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_cloud_9 = function(joker_obj, context) +FNSJ.simulate_cloud_9 = function(joker_obj, context) -- Effect not relevant (End of Round) end -DVSJ.simulate_rocket = function(joker_obj, context) +FNSJ.simulate_rocket = function(joker_obj, context) -- Effect not relevant (End of Round) end -DVSJ.simulate_obelisk = function(joker_obj, context) +FNSJ.simulate_obelisk = function(joker_obj, context) if context.cardarea == G.jokers and context.before and not context.blueprint then local reset = true local play_more_than = (G.GAME.hands[context.scoring_name].played or 0) @@ -430,88 +430,88 @@ DVSJ.simulate_obelisk = function(joker_obj, context) joker_obj.ability.x_mult = joker_obj.ability.x_mult + joker_obj.ability.extra end end - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_midas_mask = function(joker_obj, context) +FNSJ.simulate_midas_mask = function(joker_obj, context) if context.cardarea == G.jokers and context.before and not context.blueprint then for _, card in ipairs(context.scoring_hand) do - if DV.SIM.is_face(card) then - DV.SIM.set_ability(card, G.P_CENTERS.m_gold) + if FN.SIM.is_face(card) then + FN.SIM.set_ability(card, G.P_CENTERS.m_gold) end end end end -DVSJ.simulate_luchador = function(joker_obj, context) +FNSJ.simulate_luchador = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_photograph = function(joker_obj, context) +FNSJ.simulate_photograph = function(joker_obj, context) if context.cardarea == G.play and context.individual then local first_face = nil for i = 1, #context.scoring_hand do - if DV.SIM.is_face(context.scoring_hand[i]) then first_face = context.scoring_hand[i]; break end + if FN.SIM.is_face(context.scoring_hand[i]) then first_face = context.scoring_hand[i]; break end end if context.other_card == first_face and not context.other_card.debuff then - DV.SIM.x_mult(joker_obj.ability.extra) + FN.SIM.x_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_gift = function(joker_obj, context) +FNSJ.simulate_gift = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_turtle_bean = function(joker_obj, context) +FNSJ.simulate_turtle_bean = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_erosion = function(joker_obj, context) +FNSJ.simulate_erosion = function(joker_obj, context) if context.cardarea == G.jokers and context.global then local diff = G.GAME.starting_deck_size - #G.playing_cards if (diff) > 0 then - DV.SIM.add_mult(joker_obj.ability.extra * diff) + FN.SIM.add_mult(joker_obj.ability.extra * diff) end end end -DVSJ.simulate_reserved_parking = function(joker_obj, context) +FNSJ.simulate_reserved_parking = function(joker_obj, context) if context.cardarea == G.hand and context.individual then - if DV.SIM.is_face(context.other_card) and not context.other_card.debuff then - local exact_dollars, min_dollars, max_dollars = DV.SIM.get_probabilistic_extremes(pseudorandom("notthistime"), joker_obj.ability.extra.odds, joker_obj.ability.extra.dollars, 0) - DV.SIM.add_dollars(exact_dollars, min_dollars, max_dollars) + if FN.SIM.is_face(context.other_card) and not context.other_card.debuff then + local exact_dollars, min_dollars, max_dollars = FN.SIM.get_probabilistic_extremes(pseudorandom("notthistime"), joker_obj.ability.extra.odds, joker_obj.ability.extra.dollars, 0) + FN.SIM.add_dollars(exact_dollars, min_dollars, max_dollars) end end end -DVSJ.simulate_mail = function(joker_obj, context) +FNSJ.simulate_mail = function(joker_obj, context) if context.cardarea == G.hand and context.discard then if context.other_card.id == G.GAME.current_round.mail_card.id and not context.other_card.debuff then - DV.SIM.add_dollars(joker_obj.ability.extra) + FN.SIM.add_dollars(joker_obj.ability.extra) end end end -DVSJ.simulate_to_the_moon = function(joker_obj, context) +FNSJ.simulate_to_the_moon = function(joker_obj, context) -- Effect not relevant (End of Round) end -DVSJ.simulate_hallucination = function(joker_obj, context) +FNSJ.simulate_hallucination = function(joker_obj, context) -- Effect not relevant (Outside of Play) end -DVSJ.simulate_fortune_teller = function(joker_obj, context) +FNSJ.simulate_fortune_teller = function(joker_obj, context) if context.cardarea == G.jokers and context.global then if G.GAME.consumeable_usage_total and G.GAME.consumeable_usage_total.tarot then - DV.SIM.add_mult(G.GAME.consumeable_usage_total.tarot) + FN.SIM.add_mult(G.GAME.consumeable_usage_total.tarot) end end end -DVSJ.simulate_juggler = function(joker_obj, context) +FNSJ.simulate_juggler = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_drunkard = function(joker_obj, context) +FNSJ.simulate_drunkard = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_stone = function(joker_obj, context) +FNSJ.simulate_stone = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_chips(joker_obj.ability.extra * joker_obj.ability.stone_tally) + FN.SIM.add_chips(joker_obj.ability.extra * joker_obj.ability.stone_tally) end end -DVSJ.simulate_golden = function(joker_obj, context) +FNSJ.simulate_golden = function(joker_obj, context) -- Effect not relevant (End of Round) end -DVSJ.simulate_lucky_cat = function(joker_obj, context) +FNSJ.simulate_lucky_cat = function(joker_obj, context) if not joker_obj.ability.x_mult_range then joker_obj.ability.x_mult_range = { min = joker_obj.ability.x_mult, @@ -533,184 +533,184 @@ DVSJ.simulate_lucky_cat = function(joker_obj, context) end if context.cardarea == G.jokers and context.global then - DV.SIM.x_mult(joker_obj.ability.x_mult_range.exact, joker_obj.ability.x_mult_range.min, joker_obj.ability.x_mult_range.max) + FN.SIM.x_mult(joker_obj.ability.x_mult_range.exact, joker_obj.ability.x_mult_range.min, joker_obj.ability.x_mult_range.max) end end -DVSJ.simulate_baseball = function(joker_obj, context) +FNSJ.simulate_baseball = function(joker_obj, context) if context.cardarea == G.jokers and context.other_joker then if context.other_joker.rarity == 2 and context.other_joker ~= joker_obj then - DV.SIM.x_mult(joker_obj.ability.extra) + FN.SIM.x_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_bull = function(joker_obj, context) +FNSJ.simulate_bull = function(joker_obj, context) if context.cardarea == G.jokers and context.global then local function bull(data) return joker_obj.ability.extra * math.max(0, G.GAME.dollars + data.dollars) end - local min_chips = bull(DV.SIM.running.min) - local exact_chips = bull(DV.SIM.running.exact) - local max_chips = bull(DV.SIM.running.max) - DV.SIM.add_chips(exact_chips, min_chips, max_chips) + local min_chips = bull(FN.SIM.running.min) + local exact_chips = bull(FN.SIM.running.exact) + local max_chips = bull(FN.SIM.running.max) + FN.SIM.add_chips(exact_chips, min_chips, max_chips) end end -DVSJ.simulate_diet_cola = function(joker_obj, context) +FNSJ.simulate_diet_cola = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_trading = function(joker_obj, context) +FNSJ.simulate_trading = function(joker_obj, context) -- Effect not relevant (Discard) end -DVSJ.simulate_flash = function(joker_obj, context) +FNSJ.simulate_flash = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(joker_obj.ability.mult) + FN.SIM.add_mult(joker_obj.ability.mult) end end -DVSJ.simulate_popcorn = function(joker_obj, context) +FNSJ.simulate_popcorn = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(joker_obj.ability.mult) + FN.SIM.add_mult(joker_obj.ability.mult) end end -DVSJ.simulate_trousers = function(joker_obj, context) +FNSJ.simulate_trousers = function(joker_obj, context) if context.cardarea == G.jokers and context.before and not context.blueprint then if (next(context.poker_hands["Two Pair"]) or next(context.poker_hands["Full House"])) then joker_obj.ability.mult = joker_obj.ability.mult + joker_obj.ability.extra end end if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(joker_obj.ability.mult) + FN.SIM.add_mult(joker_obj.ability.mult) end end -DVSJ.simulate_ancient = function(joker_obj, context) +FNSJ.simulate_ancient = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_suit(context.other_card, G.GAME.current_round.ancient_card.suit) and not context.other_card.debuff then - DV.SIM.x_mult(joker_obj.ability.extra) + if FN.SIM.is_suit(context.other_card, G.GAME.current_round.ancient_card.suit) and not context.other_card.debuff then + FN.SIM.x_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_ramen = function(joker_obj, context) +FNSJ.simulate_ramen = function(joker_obj, context) if context.cardarea == G.hand and context.discard then joker_obj.ability.x_mult = math.max(1, joker_obj.ability.x_mult - joker_obj.ability.extra) end - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_walkie_talkie = function(joker_obj, context) +FNSJ.simulate_walkie_talkie = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_rank(context.other_card, {10, 4}) and not context.other_card.debuff then - DV.SIM.add_chips(joker_obj.ability.extra.chips) - DV.SIM.add_mult(joker_obj.ability.extra.mult) + if FN.SIM.is_rank(context.other_card, {10, 4}) and not context.other_card.debuff then + FN.SIM.add_chips(joker_obj.ability.extra.chips) + FN.SIM.add_mult(joker_obj.ability.extra.mult) end end end -DVSJ.simulate_selzer = function(joker_obj, context) +FNSJ.simulate_selzer = function(joker_obj, context) if context.cardarea == G.play and context.repetition then - DV.SIM.add_reps(1) + FN.SIM.add_reps(1) end end -DVSJ.simulate_castle = function(joker_obj, context) +FNSJ.simulate_castle = function(joker_obj, context) if context.cardarea == G.hand and context.discard and not context.blueprint then - if DV.SIM.is_suit(context.other_card, G.GAME.current_round.castle_card.suit) and not context.other_card.debuff then + if FN.SIM.is_suit(context.other_card, G.GAME.current_round.castle_card.suit) and not context.other_card.debuff then joker_obj.ability.extra.chips = joker_obj.ability.extra.chips + joker_obj.ability.extra.chip_mod end end if context.cardarea == G.jokers and context.global then - DV.SIM.add_chips(joker_obj.ability.extra.chips) + FN.SIM.add_chips(joker_obj.ability.extra.chips) end end -DVSJ.simulate_smiley = function(joker_obj, context) +FNSJ.simulate_smiley = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_face(context.other_card) and not context.other_card.debuff then - DV.SIM.add_mult(joker_obj.ability.extra) + if FN.SIM.is_face(context.other_card) and not context.other_card.debuff then + FN.SIM.add_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_campfire = function(joker_obj, context) - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) +FNSJ.simulate_campfire = function(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_ticket = function(joker_obj, context) +FNSJ.simulate_ticket = function(joker_obj, context) if context.cardarea == G.play and context.individual then if context.other_card.ability.effect == "Gold Card" and not context.other_card.debuff then - DV.SIM.add_dollars(joker_obj.ability.extra) + FN.SIM.add_dollars(joker_obj.ability.extra) end end end -DVSJ.simulate_mr_bones = function(joker_obj, context) +FNSJ.simulate_mr_bones = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_acrobat = function(joker_obj, context) +FNSJ.simulate_acrobat = function(joker_obj, context) if context.cardarea == G.jokers and context.global then -- Note: Checking against 1 is needed as hands_left is not decremented as part of simulation if G.GAME.current_round.hands_left == 1 then - DV.SIM.x_mult(joker_obj.ability.extra) + FN.SIM.x_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_sock_and_buskin = function(joker_obj, context) +FNSJ.simulate_sock_and_buskin = function(joker_obj, context) if context.cardarea == G.play and context.repetition then - if DV.SIM.is_face(context.other_card) and not context.other_card.debuff then - DV.SIM.add_reps(joker_obj.ability.extra) + if FN.SIM.is_face(context.other_card) and not context.other_card.debuff then + FN.SIM.add_reps(joker_obj.ability.extra) end end end -DVSJ.simulate_swashbuckler = function(joker_obj, context) +FNSJ.simulate_swashbuckler = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(joker_obj.ability.mult) + FN.SIM.add_mult(joker_obj.ability.mult) end end -DVSJ.simulate_troubadour = function(joker_obj, context) +FNSJ.simulate_troubadour = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_certificate = function(joker_obj, context) +FNSJ.simulate_certificate = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_smeared = function(joker_obj, context) +FNSJ.simulate_smeared = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_throwback = function(joker_obj, context) - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) +FNSJ.simulate_throwback = function(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_hanging_chad = function(joker_obj, context) +FNSJ.simulate_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) + FN.SIM.add_reps(joker_obj.ability.extra) end end end -DVSJ.simulate_rough_gem = function(joker_obj, context) +FNSJ.simulate_rough_gem = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_suit(context.other_card, "Diamonds") and not context.other_card.debuff then - DV.SIM.add_dollars(joker_obj.ability.extra) + if FN.SIM.is_suit(context.other_card, "Diamonds") and not context.other_card.debuff then + FN.SIM.add_dollars(joker_obj.ability.extra) end end end -DVSJ.simulate_bloodstone = function(joker_obj, context) +FNSJ.simulate_bloodstone = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_suit(context.other_card, "Hearts") and not context.other_card.debuff then - local exact_xmult, min_xmult, max_xmult = DV.SIM.get_probabilistic_extremes(pseudorandom("nopeagain"), joker_obj.ability.extra.odds, joker_obj.ability.extra.Xmult, 1) - DV.SIM.x_mult(exact_xmult, min_xmult, max_xmult) + if FN.SIM.is_suit(context.other_card, "Hearts") and not context.other_card.debuff then + local exact_xmult, min_xmult, max_xmult = FN.SIM.get_probabilistic_extremes(pseudorandom("nopeagain"), joker_obj.ability.extra.odds, joker_obj.ability.extra.Xmult, 1) + FN.SIM.x_mult(exact_xmult, min_xmult, max_xmult) end end end -DVSJ.simulate_arrowhead = function(joker_obj, context) +FNSJ.simulate_arrowhead = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_suit(context.other_card, "Spades") and not context.other_card.debuff then - DV.SIM.add_chips(joker_obj.ability.extra) + if FN.SIM.is_suit(context.other_card, "Spades") and not context.other_card.debuff then + FN.SIM.add_chips(joker_obj.ability.extra) end end end -DVSJ.simulate_onyx_agate = function(joker_obj, context) +FNSJ.simulate_onyx_agate = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_suit(context.other_card, "Clubs") and not context.other_card.debuff then - DV.SIM.add_mult(joker_obj.ability.extra) + if FN.SIM.is_suit(context.other_card, "Clubs") and not context.other_card.debuff then + FN.SIM.add_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_glass = function(joker_obj, context) - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) +FNSJ.simulate_glass = function(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_ring_master = function(joker_obj, context) +FNSJ.simulate_ring_master = function(joker_obj, context) -- Effect not relevant (Note: this is actually Showman) end -DVSJ.simulate_flower_pot = function(joker_obj, context) +FNSJ.simulate_flower_pot = function(joker_obj, context) if context.cardarea == G.jokers and context.global then local suit_count = { ["Hearts"] = 0, @@ -727,10 +727,10 @@ DVSJ.simulate_flower_pot = function(joker_obj, context) -- NOTE: Debuffed (non-wild) cards are still counted for their suits for _, card in ipairs(context.scoring_hand) do if card.ability.effect ~= "Wild Card" then - if DV.SIM.is_suit(card, "Hearts", true) and suit_count["Hearts"] == 0 then inc_suit("Hearts") - elseif DV.SIM.is_suit(card, "Diamonds", true) and suit_count["Diamonds"] == 0 then inc_suit("Diamonds") - elseif DV.SIM.is_suit(card, "Spades", true) and suit_count["Spades"] == 0 then inc_suit("Spades") - elseif DV.SIM.is_suit(card, "Clubs", true) and suit_count["Clubs"] == 0 then inc_suit("Clubs") + if FN.SIM.is_suit(card, "Hearts", true) and suit_count["Hearts"] == 0 then inc_suit("Hearts") + elseif FN.SIM.is_suit(card, "Diamonds", true) and suit_count["Diamonds"] == 0 then inc_suit("Diamonds") + elseif FN.SIM.is_suit(card, "Spades", true) and suit_count["Spades"] == 0 then inc_suit("Spades") + elseif FN.SIM.is_suit(card, "Clubs", true) and suit_count["Clubs"] == 0 then inc_suit("Clubs") end end end @@ -739,57 +739,57 @@ DVSJ.simulate_flower_pot = function(joker_obj, context) -- NOTE: Debuffed wild cards are completely ignored for _, card in ipairs(context.scoring_hand) do if card.ability.effect == "Wild Card" then - if DV.SIM.is_suit(card, "Hearts") and suit_count["Hearts"] == 0 then inc_suit("Hearts") - elseif DV.SIM.is_suit(card, "Diamonds") and suit_count["Diamonds"] == 0 then inc_suit("Diamonds") - elseif DV.SIM.is_suit(card, "Spades") and suit_count["Spades"] == 0 then inc_suit("Spades") - elseif DV.SIM.is_suit(card, "Clubs") and suit_count["Clubs"] == 0 then inc_suit("Clubs") + if FN.SIM.is_suit(card, "Hearts") and suit_count["Hearts"] == 0 then inc_suit("Hearts") + elseif FN.SIM.is_suit(card, "Diamonds") and suit_count["Diamonds"] == 0 then inc_suit("Diamonds") + elseif FN.SIM.is_suit(card, "Spades") and suit_count["Spades"] == 0 then inc_suit("Spades") + elseif FN.SIM.is_suit(card, "Clubs") and suit_count["Clubs"] == 0 then inc_suit("Clubs") end end end if suit_count["Hearts"] > 0 and suit_count["Diamonds"] > 0 and suit_count["Spades"] > 0 and suit_count["Clubs"] > 0 then - DV.SIM.x_mult(joker_obj.ability.extra) + FN.SIM.x_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_blueprint = function(joker_obj, context) +FNSJ.simulate_blueprint = function(joker_obj, context) local joker_to_mimic = nil - for idx, joker in ipairs(DV.SIM.env.jokers) do - if joker == joker_obj then joker_to_mimic = DV.SIM.env.jokers[idx+1] end + for idx, joker in ipairs(FN.SIM.env.jokers) do + if joker == joker_obj then joker_to_mimic = FN.SIM.env.jokers[idx+1] end end if joker_to_mimic then context.blueprint = (context.blueprint and (context.blueprint + 1)) or 1 - if context.blueprint > #DV.SIM.env.jokers + 1 then return end - DV.SIM.simulate_joker(joker_to_mimic, context) + if context.blueprint > #FN.SIM.env.jokers + 1 then return end + FN.SIM.simulate_joker(joker_to_mimic, context) end end -DVSJ.simulate_wee = function(joker_obj, context) +FNSJ.simulate_wee = function(joker_obj, context) if context.cardarea == G.play and context.individual and not context.blueprint then - if DV.SIM.is_rank(context.other_card, 2) and not context.other_card.debuff then + if FN.SIM.is_rank(context.other_card, 2) and not context.other_card.debuff then joker_obj.ability.extra.chips = joker_obj.ability.extra.chips + joker_obj.ability.extra.chip_mod end end if context.cardarea == G.jokers and context.global then - DV.SIM.add_chips(joker_obj.ability.extra.chips) + FN.SIM.add_chips(joker_obj.ability.extra.chips) end end -DVSJ.simulate_merry_andy = function(joker_obj, context) +FNSJ.simulate_merry_andy = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_oops = function(joker_obj, context) +FNSJ.simulate_oops = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_idol = function(joker_obj, context) +FNSJ.simulate_idol = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_rank(context.other_card, G.GAME.current_round.idol_card.id) and - DV.SIM.is_suit(context.other_card, G.GAME.current_round.idol_card.suit) and + if FN.SIM.is_rank(context.other_card, G.GAME.current_round.idol_card.id) and + FN.SIM.is_suit(context.other_card, G.GAME.current_round.idol_card.suit) and not context.other_card.debuff then - DV.SIM.x_mult(joker_obj.ability.extra) + FN.SIM.x_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_seeing_double = function(joker_obj, context) +FNSJ.simulate_seeing_double = function(joker_obj, context) if context.cardarea == G.jokers and context.global then local suit_count = { ["Hearts"] = 0, @@ -805,129 +805,129 @@ DVSJ.simulate_seeing_double = function(joker_obj, context) -- Account for all 'real' suits: for _, card in ipairs(context.scoring_hand) do if card.ability.effect ~= "Wild Card" then - if DV.SIM.is_suit(card, "Hearts") then inc_suit("Hearts") end - if DV.SIM.is_suit(card, "Diamonds") then inc_suit("Diamonds") end - if DV.SIM.is_suit(card, "Spades") then inc_suit("Spades") end - if DV.SIM.is_suit(card, "Clubs") then inc_suit("Clubs") end + if FN.SIM.is_suit(card, "Hearts") then inc_suit("Hearts") end + if FN.SIM.is_suit(card, "Diamonds") then inc_suit("Diamonds") end + if FN.SIM.is_suit(card, "Spades") then inc_suit("Spades") end + if FN.SIM.is_suit(card, "Clubs") then inc_suit("Clubs") end end end -- Let Wild Cards fill in the gaps: for _, card in ipairs(context.scoring_hand) do if card.ability.effect == "Wild Card" then - if DV.SIM.is_suit(card, "Hearts") and suit_count["Hearts"] == 0 then inc_suit("Hearts") - elseif DV.SIM.is_suit(card, "Diamonds") and suit_count["Diamonds"] == 0 then inc_suit("Diamonds") - elseif DV.SIM.is_suit(card, "Spades") and suit_count["Spades"] == 0 then inc_suit("Spades") - elseif DV.SIM.is_suit(card, "Clubs") and suit_count["Clubs"] == 0 then inc_suit("Clubs") + if FN.SIM.is_suit(card, "Hearts") and suit_count["Hearts"] == 0 then inc_suit("Hearts") + elseif FN.SIM.is_suit(card, "Diamonds") and suit_count["Diamonds"] == 0 then inc_suit("Diamonds") + elseif FN.SIM.is_suit(card, "Spades") and suit_count["Spades"] == 0 then inc_suit("Spades") + elseif FN.SIM.is_suit(card, "Clubs") and suit_count["Clubs"] == 0 then inc_suit("Clubs") end end end if suit_count["Clubs"] > 0 and (suit_count["Hearts"] > 0 or suit_count["Diamonds"] > 0 or suit_count["Spades"] > 0) then - DV.SIM.x_mult(joker_obj.ability.extra) + FN.SIM.x_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_matador = function(joker_obj, context) +FNSJ.simulate_matador = function(joker_obj, context) if context.cardarea == G.jokers and context.debuffed_hand then if G.GAME.blind.triggered then - DV.SIM.add_dollars(joker_obj.ability.extra) + FN.SIM.add_dollars(joker_obj.ability.extra) end end end -DVSJ.simulate_hit_the_road = function(joker_obj, context) +FNSJ.simulate_hit_the_road = function(joker_obj, context) if context.cardarea == G.hand and context.discard and not context.blueprint then if context.other_card.id == 11 and not context.other_card.debuff then joker_obj.ability.x_mult = joker_obj.ability.x_mult + joker_obj.ability.extra end end - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_duo = function(joker_obj, context) - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) +FNSJ.simulate_duo = function(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_trio = function(joker_obj, context) - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) +FNSJ.simulate_trio = function(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_family = function(joker_obj, context) - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) +FNSJ.simulate_family = function(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_order = function(joker_obj, context) - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) +FNSJ.simulate_order = function(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_tribe = function(joker_obj, context) - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) +FNSJ.simulate_tribe = function(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_stuntman = function(joker_obj, context) +FNSJ.simulate_stuntman = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_chips(joker_obj.ability.extra.chip_mod) + FN.SIM.add_chips(joker_obj.ability.extra.chip_mod) end end -DVSJ.simulate_invisible = function(joker_obj, context) +FNSJ.simulate_invisible = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_brainstorm = function(joker_obj, context) - local joker_to_mimic = DV.SIM.env.jokers[1] +FNSJ.simulate_brainstorm = function(joker_obj, context) + local joker_to_mimic = FN.SIM.env.jokers[1] if joker_to_mimic and joker_to_mimic ~= joker_obj then context.blueprint = (context.blueprint and (context.blueprint + 1)) or 1 - if context.blueprint > #DV.SIM.env.jokers + 1 then return end - DV.SIM.simulate_joker(joker_to_mimic, context) + if context.blueprint > #FN.SIM.env.jokers + 1 then return end + FN.SIM.simulate_joker(joker_to_mimic, context) end end -DVSJ.simulate_satellite = function(joker_obj, context) +FNSJ.simulate_satellite = function(joker_obj, context) -- Effect not relevant (End of Round) end -DVSJ.simulate_shoot_the_moon = function(joker_obj, context) +FNSJ.simulate_shoot_the_moon = function(joker_obj, context) if context.cardarea == G.hand and context.individual then - if DV.SIM.is_rank(context.other_card, 12) and not context.other_card.debuff then - DV.SIM.add_mult(13) + if FN.SIM.is_rank(context.other_card, 12) and not context.other_card.debuff then + FN.SIM.add_mult(13) end end end -DVSJ.simulate_drivers_license = function(joker_obj, context) +FNSJ.simulate_drivers_license = function(joker_obj, context) if context.cardarea == G.jokers and context.global then if (joker_obj.ability.driver_tally or 0) >= 16 then - DV.SIM.x_mult(joker_obj.ability.extra) + FN.SIM.x_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_cartomancer = function(joker_obj, context) +FNSJ.simulate_cartomancer = function(joker_obj, context) -- Effect not relevant (Blind) end -DVSJ.simulate_astronomer = function(joker_obj, context) +FNSJ.simulate_astronomer = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_burnt = function(joker_obj, context) +FNSJ.simulate_burnt = function(joker_obj, context) -- Effect not relevant (Discard) end -DVSJ.simulate_bootstraps = function(joker_obj, context) +FNSJ.simulate_bootstraps = function(joker_obj, context) if context.cardarea == G.jokers and context.global then local function bootstraps(data) return joker_obj.ability.extra.mult * math.floor((G.GAME.dollars + data.dollars) / joker_obj.ability.extra.dollars) end - local min_mult = bootstraps(DV.SIM.running.min) - local exact_mult = bootstraps(DV.SIM.running.exact) - local max_mult = bootstraps(DV.SIM.running.max) - DV.SIM.add_mult(exact_mult, min_mult, max_mult) + local min_mult = bootstraps(FN.SIM.running.min) + local exact_mult = bootstraps(FN.SIM.running.exact) + local max_mult = bootstraps(FN.SIM.running.max) + FN.SIM.add_mult(exact_mult, min_mult, max_mult) end end -DVSJ.simulate_caino = function(joker_obj, context) +FNSJ.simulate_caino = function(joker_obj, context) if context.cardarea == G.jokers and context.global then if joker_obj.ability.caino_xmult > 1 then - DV.SIM.x_mult(joker_obj.ability.caino_xmult) + FN.SIM.x_mult(joker_obj.ability.caino_xmult) end end end -DVSJ.simulate_triboulet = function(joker_obj, context) +FNSJ.simulate_triboulet = function(joker_obj, context) if context.cardarea == G.play and context.individual then - if DV.SIM.is_rank(context.other_card, {12, 13}) and + if FN.SIM.is_rank(context.other_card, {12, 13}) and not context.other_card.debuff then - DV.SIM.x_mult(joker_obj.ability.extra) + FN.SIM.x_mult(joker_obj.ability.extra) end end end -DVSJ.simulate_yorick = function(joker_obj, context) +FNSJ.simulate_yorick = function(joker_obj, context) if context.cardarea == G.hand and context.discard and not context.blueprint then -- This is only necessary for 'The Hook' blind. if joker_obj.ability.yorick_discards > 1 then @@ -938,11 +938,11 @@ DVSJ.simulate_yorick = function(joker_obj, context) end end - DV.SIM.JOKERS.x_mult_if_global(joker_obj, context) + FN.SIM.JOKERS.x_mult_if_global(joker_obj, context) end -DVSJ.simulate_chicot = function(joker_obj, context) +FNSJ.simulate_chicot = function(joker_obj, context) -- Effect not relevant (Meta) end -DVSJ.simulate_perkeo = function(joker_obj, context) +FNSJ.simulate_perkeo = function(joker_obj, context) -- Effect not relevant (Blind) end diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f288702..0000000 --- a/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - 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. - - - Copyright (C) - - 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 . - -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: - - Copyright (C) - 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 -. - - 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 -. diff --git a/README.md b/README.md deleted file mode 100644 index 6a03f5f..0000000 --- a/README.md +++ /dev/null @@ -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 - diff --git a/FNPreview/Utils.lua b/UtilsPreview.lua similarity index 76% rename from FNPreview/Utils.lua rename to UtilsPreview.lua index 7cc321d..ee73374 100644 --- a/FNPreview/Utils.lua +++ b/UtilsPreview.lua @@ -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 diff --git a/FNSimulate/Utils.lua b/UtilsSimulate.lua similarity index 72% rename from FNSimulate/Utils.lua rename to UtilsSimulate.lua index f68a13a..18f20e2 100644 --- a/FNSimulate/Utils.lua +++ b/UtilsSimulate.lua @@ -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 diff --git a/assets/1x/icon.png b/assets/1x/icon.png new file mode 100644 index 0000000..16003f1 Binary files /dev/null and b/assets/1x/icon.png differ diff --git a/assets/2x/icon.png b/assets/2x/icon.png new file mode 100644 index 0000000..92ff5e0 Binary files /dev/null and b/assets/2x/icon.png differ diff --git a/lovely.toml b/lovely.toml index 1488e01..bbc91b7 100644 --- a/lovely.toml +++ b/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]