diff --git a/FNPreview/Card.lua b/FNPreview/Card.lua deleted file mode 100644 index 4b33d4e..0000000 --- a/FNPreview/Card.lua +++ /dev/null @@ -1,13 +0,0 @@ --- --- SMODS compatibility: --- - -local orig_get_X_same = get_X_same -function get_X_same(num, hand) - return orig_get_X_same(num, clean_hand(hand)) -end - -local orig_get_highest = get_highest -function get_highest(hand) - return orig_get_highest(clean_hand(hand)) -end \ No newline at end of file diff --git a/FNPreview/Core.lua b/FNPreview/Core.lua index abe9f41..a82aab5 100644 --- a/FNPreview/Core.lua +++ b/FNPreview/Core.lua @@ -4,29 +4,25 @@ -- ie. whenever the player modifies card selection or card order. function DV.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 G.STATE == G.STATES.PLAY_TAROT) - then - return { score = { min = 0, exact = 0, max = 0 }, dollars = { min = 0, exact = 0, max = 0 } } - end + -- Guard against simulating in redundant places: + if not (G.STATE == G.STATES.SELECTING_HAND or + G.STATE == G.STATES.DRAW_TO_HAND or + G.STATE == G.STATES.PLAY_TAROT) + 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 - for _, card in ipairs(G.hand.highlighted) do - if card.facing == "back" then - return nil - end - end - if #G.hand.highlighted ~= 0 then - for _, joker in ipairs(G.jokers.cards) do - if joker.facing == "back" then - return nil - end - end - end - end + if G.SETTINGS.DV.hide_face_down then + for _, card in ipairs(G.hand.highlighted) do + if card.facing == "back" then return nil end + end + if #(G.hand.highlighted) ~= 0 then + for _, joker in ipairs(G.jokers.cards) do + if joker.facing == "back" then return nil end + end + end + end - return DV.SIM.run() + return DV.SIM.run() end -- @@ -34,90 +30,85 @@ end -- function DV.PRE.add_update_event(trigger) - function sim_func() - DV.PRE.data = DV.PRE.simulate() - return true - end - if DV.PRE.enabled() then - G.E_MANAGER:add_event(Event({ trigger = trigger, func = sim_func })) - end + function sim_func() + DV.PRE.data = DV.PRE.simulate() + return true + end + if DV.PRE.enabled() then + G.E_MANAGER:add_event(Event({trigger = trigger, func = sim_func})) + end end -- Update simulation after a consumable (eg. Tarot, Planet) is used: local orig_use = Card.use_consumeable function Card:use_consumeable(area, copier) - orig_use(self, area, copier) - DV.PRE.add_update_event("immediate") + orig_use(self, area, copier) + DV.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") + orig_hl(self) + DV.PRE.add_update_event("immediate") end -- Update simulation after joker sold: 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") - end + orig_card_remove(self) + if self.config.type == 'joker' then + DV.PRE.add_update_event("immediate") + end end -- Update simulation after joker reordering: local orig_update = CardArea.update function CardArea:update(dt) - orig_update(self, dt) - DV.PRE.update_on_card_order_change(self) + orig_update(self, dt) + DV.PRE.update_on_card_order_change(self) end function DV.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 G.STATE == G.STATES.PLAY_TAROT - ) - then - return - end - -- Important not to update on G.STATES.HAND_PLAYED, because it would reset the preview text! + if #cardarea.cards == 0 or + not (G.STATE == G.STATES.SELECTING_HAND or + G.STATE == G.STATES.DRAW_TO_HAND or + G.STATE == G.STATES.PLAY_TAROT) + then return end + -- Important not to update on G.STATES.HAND_PLAYED, because it would reset the preview text! - local prev_order = nil - if cardarea.config.type == "joker" and cardarea.cards[1].ability.set == "Joker" then - -- Note that the consumables cardarea also has type 'joker' so must verify by checking first card. - prev_order = DV.PRE.joker_order - elseif cardarea.config.type == "hand" then - prev_order = DV.PRE.hand_order - else - return - end + local prev_order = nil + if cardarea.config.type == 'joker' and cardarea.cards[1].ability.set == 'Joker' then + -- Note that the consumables cardarea also has type 'joker' so must verify by checking first card. + prev_order = DV.PRE.joker_order + elseif cardarea.config.type == 'hand' then + prev_order = DV.PRE.hand_order + else + return + end - -- Go through stored card IDs and check against current card IDs, in-order. - -- If any mismatch occurs, toggle flag and update name for next time. - local should_update = false - if #cardarea.cards ~= #prev_order then - prev_order = {} - end - for i, c in ipairs(cardarea.cards) do - if c.sort_id ~= prev_order[i] then - prev_order[i] = c.sort_id - should_update = true - end - end + -- Go through stored card IDs and check against current card IDs, in-order. + -- If any mismatch occurs, toggle flag and update name for next time. + local should_update = false + if #cardarea.cards ~= #prev_order then + prev_order = {} + end + for i, c in ipairs(cardarea.cards) do + if c.sort_id ~= prev_order[i] then + prev_order[i] = c.sort_id + should_update = true + end + end - if should_update then - if cardarea.config.type == "joker" or cardarea.cards[1].ability.set == "Joker" then - DV.PRE.joker_order = prev_order - elseif cardarea.config.type == "hand" then - DV.PRE.hand_order = prev_order - end + if should_update then + if cardarea.config.type == 'joker' or cardarea.cards[1].ability.set == 'Joker' then + DV.PRE.joker_order = prev_order + elseif cardarea.config.type == 'hand' then + DV.PRE.hand_order = prev_order + end - DV.PRE.add_update_event("immediate") - end + DV.PRE.add_update_event("immediate") + end end -- @@ -125,27 +116,27 @@ end -- function DV.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 } } - return true - end - if DV.PRE.enabled() then - G.E_MANAGER:add_event(Event({ trigger = trigger, func = reset_func })) - end + function reset_func() + DV.PRE.data = {score = {min = 0, exact = 0, max = 0}, dollars = {min = 0, exact = 0, max = 0}} + return true + end + if DV.PRE.enabled() then + G.E_MANAGER:add_event(Event({trigger = trigger, func = reset_func})) + end end local orig_eval = G.FUNCS.evaluate_play function G.FUNCS.evaluate_play(e) - orig_eval(e) - DV.PRE.add_reset_event("after") + orig_eval(e) + DV.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") - end + orig_discard(e, is_hook_blind) + if not is_hook_blind then + DV.PRE.add_reset_event("immediate") + end end -- @@ -154,105 +145,94 @@ end -- Add animation to preview text: function G.FUNCS.dv_pre_score_UI_set(e) - local new_preview_text = "" - local should_juice = false - if DV.PRE.data then - if G.SETTINGS.DV.show_min_max and (DV.PRE.data.score.min ~= DV.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 - end - else - -- Format as single number: - if e.config.id == "dv_pre_l" then - if G.SETTINGS.DV.show_min_max 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 - 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 - end - else - new_preview_text = "" - end - 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 G.SETTINGS.DV.show_min_max then - new_preview_text = " ?????? " - else - new_preview_text = "??????" - end - else - new_preview_text = "" - end - end + local new_preview_text = "" + local should_juice = false + if DV.PRE.data then + if G.SETTINGS.DV.show_min_max and (DV.PRE.data.score.min ~= DV.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 + end + else + -- Format as single number: + if e.config.id == "dv_pre_l" then + if G.SETTINGS.DV.show_min_max 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 + 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 + end + else + new_preview_text = "" + end + 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 G.SETTINGS.DV.show_min_max then new_preview_text = " ?????? " + else new_preview_text = "??????" + end + else + new_preview_text = "" + 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 - e.config.object:update_text() - -- Wobble: - if not G.TAROT_INTERRUPT_PULSE then - if should_juice then - G.FUNCS.text_super_juice(e, 5) - e.config.object.colours = { G.C.MONEY } - else - G.FUNCS.text_super_juice(e, 0) - e.config.object.colours = { G.C.UI.TEXT_LIGHT } - end - 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 + e.config.object:update_text() + -- Wobble: + if not G.TAROT_INTERRUPT_PULSE then + if should_juice + then + G.FUNCS.text_super_juice(e, 5) + e.config.object.colours = {G.C.MONEY} + else + G.FUNCS.text_super_juice(e, 0) + e.config.object.colours = {G.C.UI.TEXT_LIGHT} + end + end + end end function G.FUNCS.dv_pre_dollars_UI_set(e) - local new_preview_text = "" - local new_colour = nil - if DV.PRE.data then - if G.SETTINGS.DV.show_min_max 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) - 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 + local new_preview_text = "" + local new_colour = nil + if DV.PRE.data then + if G.SETTINGS.DV.show_min_max 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) + 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 - new_preview_text = " " .. DV.PRE.get_sign_str(_data) .. _data - new_colour = DV.PRE.get_dollar_colour(_data) - else - new_preview_text = "" - new_colour = DV.PRE.get_dollar_colour(0) - end - end - else - new_preview_text = " +??" - new_colour = DV.PRE.get_dollar_colour(0) - end + new_preview_text = " " .. DV.PRE.get_sign_str(_data) .. _data + new_colour = DV.PRE.get_dollar_colour(_data) + else + new_preview_text = "" + new_colour = DV.PRE.get_dollar_colour(0) + end + end + else + new_preview_text = " +??" + new_colour = DV.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 - 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 - 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 + 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 + end end diff --git a/FNPreview/Init.lua b/FNPreview/Init.lua index 4d5df66..6673ab0 100644 --- a/FNPreview/Init.lua +++ b/FNPreview/Init.lua @@ -2,36 +2,33 @@ -- -- Global values that must be present for the rest of this mod to work. -if not DV then - DV = {} -end +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 = {}, + 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) + 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 + 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 - 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/FNPreview/Utils.lua b/FNPreview/Utils.lua index 1f7d030..0fac3d2 100644 --- a/FNPreview/Utils.lua +++ b/FNPreview/Utils.lua @@ -39,13 +39,3 @@ end function DV.PRE.enabled() return G.SETTINGS.DV.preview_score or G.SETTINGS.DV.preview_dollars end - -function clean_hand(hand) - local clean_hand = {} - for _, v in pairs(hand) do - if v.get_id then -- Should work for all functions even if they don't use get_id because get_id is a meta function and the broken cards don't have meta values - table.insert(clean_hand, v) - end - end - return clean_hand -end diff --git a/FNSimulate/Jokers/ExtraCredit.lua b/FNSimulate/Jokers/ExtraCredit.lua new file mode 100644 index 0000000..bbe9e0d --- /dev/null +++ b/FNSimulate/Jokers/ExtraCredit.lua @@ -0,0 +1,48 @@ +local DVSJ = DV.SIM.JOKERS + +DVSJ.simulate_doublerainbow = function(j, context) + if context.cardarea == G.play and context.repetition then + if context.other_card.ability.name == "Lucky Card" then + DV.SIM.add_reps(1) + end + end + -- TODO: The source also has G.hand cardarea predicated on context.card_effects. + -- I'm unsure of what it does, and currently not mirroring here. +end +DVSJ.simulate_starfruit = function(j, context) + -- TODO: Verify + if context.cardarea == G.jokers and context.before then + if G.GAME.current_round.hands_played == 0 then + local hand_data = G.GAME.hands[DV.SIM.env.scoring_name] + + local rand = pseudorandom("star") -- Must reuse same pseudorandom value: + local exact_chips, min_chips, max_chips = DV.SIM.get_probabilistic_extremes(rand, j.ability.extra, hand_data.l_chips, 0) + local exact_mult, min_mult, max_mult = DV.SIM.get_probabilistic_extremes(rand, j.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) + end + end +end + +local function level_diff() + local num_hands = 0 + local num_levels = 0 + for _, hand in ipairs(G.GAME.hands) do + num_hands = num_hands + 1 + num_levels = num_levels + hand.level + end + return (num_levels - num_hands) +end +DVSJ.simulate_eclipse = function(j, context) + -- TODO: Verify + if context.cardarea == G.jokers and context.global then + local lvl_diff = level_diff() + if lvl_diff > 0 then + DV.SIM.add_chips(lvl_diff) + end + end +end + +DVSJ.simulate_rubberducky = function(j, context) +end diff --git a/FNSimulate/Jokers/MoreFluff.lua b/FNSimulate/Jokers/MoreFluff.lua new file mode 100644 index 0000000..240b355 --- /dev/null +++ b/FNSimulate/Jokers/MoreFluff.lua @@ -0,0 +1,261 @@ +local DVSJ = DV.SIM.JOKERS + +DVSJ.simulate_badlegaldefence = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_basepaul_card = function(j, context) + if context.cardarea == G.jokers and context.gloabl then + DV.SIM.x_mult(j.ability.extra.x_mult) + if string.find(string.lower(G.PROFILES[G.SETTINGS.profile].name), "paul") then + DV.SIM.x_mult(10) + end + end +end +DVSJ.simulate_bladedance = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_blasphemy = function(j, context) + if context.cardarea == G.jokers and context.global then + DV.SIM.x_mult(j.ability.extra.xmult) + end +end +DVSJ.simulate_bloodpact = function(j, context) + if context.cardarea == G.jokers and context.global then + local any_heart = false + for _, card in ipairs(context.full_hand) do + if DV.SIM.is_suit(card, "Hearts") then + any_heart = true + break + end + end + if not any_heart then + DV.SIM.x_mult(j.ability.extra) + end + end +end +DVSJ.simulate_bowlingball = function(j, context) + if context.cardarea == G.play and context.individual then + if DV.SIM.is_rank(context.other_card, 3) then + DV.SIM.add_chips(j.ability.extra.chips) + DV.SIM.add_mult(j.ability.extra.mult) + end + end +end +DVSJ.simulate_cba = function(j, context) + -- TODO: Unsure how the mod's implementation works? +end +DVSJ.simulate_clipart = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_clownfish = function(j, context) + if context.cardarea == G.play and context.individual then + if context.other_card.ability.name ~= "Default Base" then + DV.SIM.add_chips(j.ability.extra.chips) + DV.SIM.add_mult(j.ability.extra.mult) + end + end +end +DVSJ.simulate_colorem = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_coupon_catalogue = function(j, context) + if context.cardarea == G.jokers and context.global then + local redeemed = 0 + for _, v in pairs(G.GAME.used_vouchers) do + if v then redeemed = redeemed + 1 end + end + DV.SIM.add_mult(j.ability.extra.mult * redeemed) + end +end +DVSJ.simulate_css = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_dramaticentrance = function(j, context) + if context.cardarea == G.jokers and context.global then + if G.GAME.current_round.hands_played == 0 then + DV.SIM.add_chips(j.ability.extra.chips) + end + end +end +DVSJ.simulate_dropkick = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_expansion_pack = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_fleshpanopticon = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_fleshprison = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_globe = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_goldencarrot = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_hallofmirrors = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_hollow = function(j, context) + if context.cardarea == G.jokers and context.global then + if G.hand.config.card_limit < j.ability.extra.thresh then + local diff = j.ability.extra.thresh - G.hand.config.card_limit + DV.SIM.add_mult(j.ability.extra.mult_per * diff) + end + end +end +DVSJ.simulate_hugejoker = function(j, context) + if context.cardarea == G.jokers and context.global then + DV.SIM.x_mult(j.ability.extra.x_mult) + end +end +DVSJ.simulate_hyperbeam = function(j, context) + if context.cardarea == G.jokers and context.global then + DV.SIM.x_mult(j.ability.extra) + end +end +DVSJ.simulate_impostor = function(j, context) + if context.cardarea == G.jokers and context.global then + local num_reds = 0 + for _, card in ipairs(context.full_hand) do + if DV.SIM.is_suit(card, "Hearts") or DV.SIM.is_suit(card, "Diamonds") then + num_reds = num_reds + 1 + end + end + if num_reds == 1 then + DV.SIM.x_mult(j.ability.extra.x_mult) + end + end +end +DVSJ.simulate_jankman = function(j, context) + if context.cardarea == G.jokers and context.other_joker then + local is_vanilla = false + for _, j in ipairs(MF_VANILLA_JOKERS) do + if j == context.other_joker.config.center.key then + is_vanilla = true + break + end + end + if not is_vanilla then + DV.SIM.x_mult(j.ability.extra.x_mult) + end + end +end +DVSJ.simulate_jester = function(j, context) + if context.cardarea == G.jokers and context.global then + DV.SIM.add_chips(j.ability.extra.chips) + end +end +DVSJ.simulate_loadeddisk = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_lollipop = function(j, context) + if context.cardarea == G.jokers and context.global then + DV.SIM.x_mult(j.ability.x_mult) + end +end +DVSJ.simulate_luckycharm = function(j, context) + if context.cardarea == G.jokers and context.global then + local exact_mult, min_mult, max_mult = DV.SIM.get_probabilistic_extremes(pseudorandom("lucky_charm_mult"), j.ability.extra.mult_chance, j.ability.extra.mult, 0) + DV.SIM.add_mult(exact_mult, min_mult, max_mult) + end +end +DVSJ.simulate_mashupalbum = function(j, context) + if context.cardarea == G.jokers and context.before then + if next(context.poker_hands["Flush"]) then + local card1 = context.scoring_hand[1] + if DV.SIM.is_suit(card1, "Hearts") or DV.SIM.is_suit(card1, "Diamonds") then + j.ability.extra.mult = j.ability.extra.mult + 4 + else + j.ability.extra.chips = j.ability.extra.chips + 15 + end + end + end + if context.cardarea == G.jokers and context.global then + DV.SIM.add_chips(j.ability.extra.chips) + DV.SIM.add_mult(j.ability.extra.mult) + end +end +DVSJ.simulate_monochrome = function(j, context) + if context.cardarea == G.jokers and context.global then + DV.SIM.add_mult(j.ability.extra.mult) + end +end +DVSJ.simulate_mspaint = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_philosophical = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_pixeljoker = function(j, context) + if context.cardarea == G.play and context.individual then + if DV.SIM.is_rank(context.other_card, {4, 9, 14}) then + DV.SIM.x_mult(j.ability.extra.x_mult) + end + end +end +DVSJ.simulate_rainbow = function(j, context) + -- TODO: Unsure how to implement currently +end +DVSJ.simulate_recycling = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_rosetinted = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_simplified = function(j, context) + if context.cardarea == G.jokers and context.other_joker then + if context.other_joker.rarity == 1 then + DV.SIM.add_mult(j.ability.extra.mult) + end + end +end +DVSJ.simulate_spiral = function(j, context) + if context.cardarea == G.jokers and context.global then + local jdata = j.ability.extra + local jmult = jdata.mult + math.floor(jdata.coeff * math.cos(math.pi/jdata.dilation * G.GAME.dollars or 0) + 0.5) + DV.SIM.add_mult(jmult) + end +end +DVSJ.simulate_stylemeter = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_teacup = function(j, context) + if context.cardarea == G.jokers and context.before then + local hand_data = G.GAME.hands[DV.SIM.env.scoring_name] + DV.SIM.add_chips(hand_data.l_chips) + DV.SIM.add_mult(hand_data.l_mult) + end +end +DVSJ.simulate_the_solo = function(j, context) + if context.cardarea == G.jokers and context.before then + if #context.full_hand == 1 then + j.ability.extra.x_mult = j.ability.extra.x_mult + j.ability.extra.x_mult_gain + end + elseif context.cardarea == G.jokers and context.global then + DV.SIM.x_mult(j.ability.extra.x_mult) + end +end +DVSJ.simulate_tonersoup = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_treasuremap = function(j, context) + -- Effect not relevant +end +DVSJ.simulate_triangle = function(j, context) + if context.cardarea == G.play and context.individual then + -- vs. next(context.poker_hands["Three of a Kind"]) ? + if context.scoring_name == "Three of a Kind" then + DV.SIM.x_mult(j.ability.extra.x_mult) + end + end +end +DVSJ.simulate_virtual = function(j, context) + if context.cardarea == G.jokers and context.global then + DV.SIM.x_mult(j.ability.extra) + end +end + +local MF_VANILLA_JOKERS = {"j_joker", "j_greedy_joker", "j_lusty_joker", "j_wrathful_joker", "j_gluttenous_joker", "j_zany", "j_mad", "j_crazy", "j_droll", "j_sly", "j_wily", "j_clever", "j_devious", "j_crafty", "j_half", "j_stencil", "j_four_fingers", "j_mime", "j_credit_card", "j_ceremonial", "j_banner", "j_mystic_summit", "j_marble", "j_loyalty_card", "j_8_ball", "j_misprint", "j_dusk", "j_raised_fist", "j_chaos", "j_fibonacci", "j_steel_joker", "j_scary_face", "j_abstract", "j_delayed_grat", "j_hack", "j_pareidolia", "j_gros_michel", "j_even_steven", "j_odd_todd", "j_scholar", "j_business", "j_supernova", "j_ride_the_bus", "j_space", "j_egg", "j_burglar", "j_blackboard", "j_runner", "j_ice_cream", "j_dna", "j_splash", "j_blue_joker", "j_sixth_sense", "j_constellation", "j_hiker", "j_faceless", "j_green_joker", "j_superposition", "j_todo_list", "j_cavendish", "j_card_sharp", "j_red_card", "j_madness", "j_square", "j_seance", "j_riff_raff", "j_vampire", "j_shortcut", "j_hologram", "j_vagabond", "j_baron", "j_cloud_9", "j_rocket", "j_obelisk", "j_midas_mask", "j_luchador", "j_photograph", "j_gift", "j_turtle_bean", "j_erosion", "j_reserved_parking", "j_mail", "j_to_the_moon", "j_hallucination", "j_fortune_teller", "j_juggler", "j_drunkard", "j_stone", "j_golden", "j_lucky_cat", "j_baseball", "j_bull", "j_diet_cola", "j_trading", "j_flash", "j_popcorn", "j_trousers", "j_ancient", "j_ramen", "j_walkie_talkie", "j_selzer", "j_castle", "j_smiley", "j_campfire", "j_ticket", "j_mr_bones", "j_acrobat", "j_sock_and_buskin", "j_swashbuckler", "j_troubadour", "j_certificate", "j_smeared", "j_throwback", "j_hanging_chad", "j_rough_gem", "j_bloodstone", "j_arrowhead", "j_onyx_agate", "j_glass", "j_ring_master", "j_flower_pot", "j_blueprint", "j_wee", "j_merry_andy", "j_oops", "j_idol", "j_seeing_double", "j_matador", "j_hit_the_road", "j_duo", "j_trio", "j_family", "j_order", "j_tribe", "j_stuntman", "j_invisible", "j_brainstorm", "j_satellite", "j_shoot_the_moon", "j_drivers_license", "j_cartomancer", "j_astronomer", "j_burnt", "j_bootstraps", "j_caino", "j_triboulet", "j_yorick", "j_chicot", "j_perkeo"} diff --git a/FNSimulate/Jokers/Multiplayer.lua b/FNSimulate/Jokers/Multiplayer.lua index ee3e063..a24914e 100644 --- a/FNSimulate/Jokers/Multiplayer.lua +++ b/FNSimulate/Jokers/Multiplayer.lua @@ -1,28 +1,28 @@ -DVSJ.simulate_j_mp_defensive_joker= function(joker_obj, context) +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.extra.chips) + DV.SIM.add_chips(joker_obj.ability.t_chips) end end -DVSJ.simulate_j_mp_taxes = function(joker_obj, context) +DVSJ.simulate_mp_taxes = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.add_mult(joker_obj.ability.mult) + DV.SIM.add_mult(joker_obj.ability.extra.mult) end end -DVSJ.simulate_j_mp_pacifist = function(joker_obj, context) +DVSJ.simulate_mp_pacifist = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.x_mult(joker_obj.ability.extra.Xmult) + DV.SIM.x_mult(joker_obj.ability.extra.x_mult) end end -DVSJ.simulate_j_mp_conjoined_joker = function(joker_obj, context) +DVSJ.simulate_mp_conjoined_joker = function(joker_obj, context) if context.cardarea == G.jokers and context.global then - DV.SIM.x_mult(joker_obj.ability.extra.Xmult) + DV.SIM.x_mult(joker_obj.ability.extra.x_mult) end end -DVSJ.simulate_j_mp_hanging_chad = function(joker_obj, context) +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) @@ -33,14 +33,14 @@ DVSJ.simulate_j_mp_hanging_chad = function(joker_obj, context) end end -DVSJ.simulate_j_mp_lets_go_gambling = function(joker_obj, context) - if context.cardarea == G.jokers and context.before then +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, .25, 4, 1) - local exact_money, min_money, max_money = DV.SIM.get_probabilistic_extremes(rand, .25, 10, 0) + local exact_xmult, min_xmult, max_xmult = DV.SIM.get_probabilistic_extremes(rand, 4, 4, 1) + local exact_money, min_money, max_money = DV.SIM.get_probabilistic_extremes(rand, 4, 10, 0) DV.SIM.add_dollars(exact_money, min_money, max_money) - DV.SIM.add_xmult(exact_xmult, min_xmult, max_xmult) + DV.SIM.x_mult(exact_xmult, min_xmult, max_xmult) end end \ No newline at end of file diff --git a/lovely.toml b/lovely.toml index bdb5f1d..1488e01 100644 --- a/lovely.toml +++ b/lovely.toml @@ -5,31 +5,36 @@ priority = 0 # This manifest assumes the following release structure: # -# DVSimulate/ -# ├─ Engine.lua -# ├─ Init.lua -# ├─ Utils.lua -# ├─ Jokers/ -# │ ├─ _Vanilla.lua -# │ ├─ etc. +# Fantoms-Preview/ +# ├─ FNPreview +# ├─ FNSimulate [[patches]] [patches.copy] target = "globals.lua" position = "append" -sources = ["FNSimulate/Init.lua", "FNPreview/Init.lua", "FNPreview/Card.lua"] +sources = [ + "FNSimulate/Init.lua", + "FNPreview/Init.lua" +] [[patches]] [patches.copy] target = "main.lua" position = "append" -sources = ["FNPreview/Core.lua", "FNPreview/Utils.lua"] +sources = [ + "FNPreview/Core.lua", + "FNPreview/Utils.lua" +] [[patches]] [patches.copy] target = "functions/common_events.lua" position = "append" -sources = ["FNSimulate/Engine.lua", "FNSimulate/Utils.lua"] +sources = [ + "FNSimulate/Engine.lua", + "FNSimulate/Utils.lua" +] [[patches]] [patches.copy] @@ -37,21 +42,21 @@ target = "card.lua" position = "append" sources = [ "FNSimulate/Jokers/_Vanilla.lua", - "FNSimulate/Jokers/Multiplayer.lua", + "FNSimulate/Jokers/Multiplayer.lua" ] [[patches]] [patches.copy] target = "functions/UI_definitions.lua" position = "append" -sources = ["FNPreview/Interface.lua"] +sources = [ "FNPreview/Interface.lua" ] [[patches]] [patches.pattern] target = '''=[SMODS _ "src/overrides.lua"]''' -pattern = "function get_straight(hand, min_length, skip, wrap)" +pattern = "function Blind:debuff_hand(cards, hand, handname, check)" position = 'after' payload = ''' -hand = clean_hand(hand) +do return debuff_hand(self, cards, hand, handname, check) end ''' match_indent = true