From 5204ba71a0bb82653d890364714ff53b72de737c Mon Sep 17 00:00:00 2001 From: Emik Date: Tue, 21 Jul 2026 01:05:36 +0200 Subject: [PATCH] Make harsh ante scaling even harsher --- manifest.json | 2 +- src/joker.lua | 23 ++++------------------- src/lib/intellisense.lua | 3 +++ src/lib/shared.lua | 17 ++++++++++++++++- src/main.lua | 13 ++++++------- src/tweaks.lua | 40 +++++++++++++++++++++++++++------------- 6 files changed, 57 insertions(+), 41 deletions(-) diff --git a/manifest.json b/manifest.json index 3cf437c..e75c97a 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "id": "Roland", "name": "Roland", "prefix": "Roland", - "version": "2.9.69", + "version": "2.9.70", "badge_colour": "8BE9FD", "display_name": "Roland", "main_file": "src/main.lua", diff --git a/src/joker.lua b/src/joker.lua index 205fb8b..8a9c636 100644 --- a/src/joker.lua +++ b/src/joker.lua @@ -1,4 +1,4 @@ -local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2] +local f, q, r = (... or require "lib.shared")[1], (... or require "lib.shared")[2], (... or require "lib.shared")[4] local atlas = SMODS.Atlas { key = "joker", @@ -54,21 +54,6 @@ local joker = (function() end end)() ----@generic T ----@param tbl T[] ----@return fun(t: T[], i: integer): integer, T ----@return T[] -local function ipairs_reversed(tbl) - return function(t, i) - local k = i and i - 1 or #t - local v = t[k] - - if v ~= nil then - return k, v - end - end, tbl -end - ---@param card Card ---@return boolean local function is_frozen(card) @@ -720,9 +705,9 @@ joker { {card = card, xmult = card.ability.extra.xmult} or nil end, crimson = function() - local _ = G.jokers and f(G.jokers.cards, ipairs_reversed):where(is_frozen, false):each(function(v) - local r = G.jokers.cards[v.rank + 1] - local debuffed_by_crimson = r and not r.debuff and r.config.center.key == "j_Roland_crimson" + local _ = G.jokers and f(G.jokers.cards, r):where(is_frozen, false):each(function(v) + local right = G.jokers.cards[v.rank + 1] + local debuffed_by_crimson = right and not right.debuff and right.config.center.key == "j_Roland_crimson" if debuffed_by_crimson and v.ability.Roland_crimson == nil then local debuff = not not v.debuff diff --git a/src/lib/intellisense.lua b/src/lib/intellisense.lua index 281e1d2..ad116b3 100644 --- a/src/lib/intellisense.lua +++ b/src/lib/intellisense.lua @@ -50,6 +50,9 @@ end SMODS.Mods.Roland.config = require "config" +---@type (fun(rem: number): number|table)[] +SMODS.Mods.Roland.harsh_ante_scaling = SMODS.Mods.Roland.harsh_ante_scaling + --- @type table Talisman = Talisman diff --git a/src/lib/shared.lua b/src/lib/shared.lua index b4b5ee4..d256855 100644 --- a/src/lib/shared.lua +++ b/src/lib/shared.lua @@ -137,6 +137,21 @@ local function u() G.STATE ~= G.STATES.PLAY_TAROT) end +---@generic T +---@param tbl T[] +---@return fun(t: T[], i: integer): integer, T +---@return T[] +local function r(tbl) + return function(t, i) + local k = i and i - 1 or #t + local v = t[k] + + if v ~= nil then + return k, v + end + end, tbl +end + --- Creates one or more cards. ---@param ... any ---@return Card|Tag|(Card|Tag[]) @@ -154,7 +169,7 @@ local function c(...) return #cards > 1 and cards or cards[1] end -return {f, q, u, setmetatable({}, { +return {f, q, u, r, setmetatable({}, { __call = function(_, ...) return c(...) end, diff --git a/src/main.lua b/src/main.lua index 5b2a9f5..ca3363e 100644 --- a/src/main.lua +++ b/src/main.lua @@ -1,9 +1,8 @@ local qol = assert(SMODS.load_file "src/lib/shared.lua")() or require "lib.shared" -local f, q = qol[1], qol[2] +local animated = SMODS.current_mod.config.animated_icon SMODS.current_mod.qol = qol -local animated = SMODS.Mods.Roland.config.animated_icon -q { +qol[2] { front = true, no_delete = true, blocking = false, @@ -15,22 +14,22 @@ q { return false end - f(assert(SMODS.load_file("src/credits.lua", "Roland"))() or require "credits"):each(function(v, k) + qol[1](assert(SMODS.load_file("src/credits.lua", "Roland"))() or require "credits"):each(function(v, k) contributors["Roland_" .. k] = v end) if SMODS.Mods.DebugPlus and SMODS.Mods.Roland.config.import_funky then - _G.f, _G.q, _G.u, _G.c = unpack(qol) + _G.f, _G.q, _G.u, _G.r, _G.c = unpack(qol) end end, } -f {"challenge", "spectral", "edition", "voucher", "tweaks", "blind", "charm", "joker", "tarot", "back", "seal", "tag"} +qol[1] {"challenge", "spectral", "edition", "voucher", "tweaks", "blind", "charm", "joker", "tarot", "back", "seal", "tag"} :each(function(v) assert(SMODS.load_file("src/" .. v .. ".lua"))(qol) end) -local _ = Balatest and f {"joker", "blind", "spectral"}:each(function(v) +local _ = Balatest and qol[1] {"joker", "blind", "spectral"}:each(function(v) assert(SMODS.load_file("src/tests/" .. v .. ".tests.lua"))(qol) end) diff --git a/src/tweaks.lua b/src/tweaks.lua index 82d9b94..4ff914f 100644 --- a/src/tweaks.lua +++ b/src/tweaks.lua @@ -1,4 +1,4 @@ -local f, q = (... or require "lib.shared")[1], (... or require "lib.shared")[2] +local f, q, r = (... or require "lib.shared")[1], (... or require "lib.shared")[2], (... or require "lib.shared")[4] SMODS.Joker:take_ownership("joker", {cost = 1}, true) local orig_set_debuff = Card.set_debuff @@ -110,21 +110,35 @@ local function no_harsh_ante_scaling() return not Talisman or not SMODS.Mods.Roland.config.harsh_ante_scaling end -function get_blind_amount(ante, ...) - local loop = 39 +---@type (fun(rem: number): number|table)[] +SMODS.current_mod.harsh_ante_scaling = { + function(rem) + return (Big.constants and Big.constants.TEN or Big:new {10}):pow(blind(rem + 1)) + end, + function(rem) + return Big:new {1, rem + 1} + end, + function(rem) + return Big:new {1, 1, [rem + 2] = 1} + end, + function(rem) + return Big:new {1, 1, [blind(rem) + 2] = 1} + end, + function(rem) + return rem <= 1 and Big:new {1.7976931348623157e308, 1, [1.7975e308] = 1} or 1 / 0 + end, +} - if ante < loop or no_harsh_ante_scaling() then +function get_blind_amount(ante, ...) + local offset = 40 + + if ante < offset or no_harsh_ante_scaling() then return orig_get_blind_amount(ante, ...) end - if (ante - 9) / 15 >= loop then - return 1 / 0 - end + local loop = 10 - local rem = tonumber(blind((ante % loop) + 1)) - - return ante / 15 >= loop and Big:new(f(blind(ante - (loop * 15))):map(f.const(10)):table()) or - (ante / 9 >= loop and Big:new(f(ante / loop - 8):map(f.const(10)):concat {rem}:table()) or - (ante / 2 >= loop and Big:new {rem, ante / loop} or - (Big.constants and Big.constants.TEN or Big:new {10}):pow(rem))) + return f(SMODS.Mods.Roland.harsh_ante_scaling, r):any(function(_, k) + return (ante - offset) / loop + 1 >= k + end)((ante - offset) % loop + 1) end