Rewrite Arctic Circle to be uncapped without crashing

This commit is contained in:
Emik 2026-07-27 12:55:58 +02:00
parent 9f19d85769
commit 4619a24736
Signed by: emik
GPG key ID: 6B0CD72A5E503BDF
3 changed files with 30 additions and 15 deletions

View file

@ -3,7 +3,7 @@
"id": "Roland", "id": "Roland",
"name": "Roland", "name": "Roland",
"prefix": "Roland", "prefix": "Roland",
"version": "2.9.77", "version": "2.9.78",
"badge_colour": "8BE9FD", "badge_colour": "8BE9FD",
"display_name": "Roland", "display_name": "Roland",
"main_file": "src/main.lua", "main_file": "src/main.lua",

View file

@ -57,7 +57,7 @@ end)()
---@param card Card ---@param card Card
---@return boolean ---@return boolean
local function is_frozen(card) local function is_frozen(card)
return card and card.edition and card.edition.key == "e_Roland_frozen" return card and card.edition and card.edition.Roland_frozen
end end
---@param card? Card|false|{suit: string, value: string} ---@param card? Card|false|{suit: string, value: string}
@ -531,8 +531,8 @@ joker {
pronouns = "they_them", pronouns = "they_them",
cost = 10, cost = 10,
rarity = 3, rarity = 3,
config = {extra = {frozen = 1, non_frozen = 0, max_stack = 6, color = "DARK_EDITION"}}, config = {extra = {frozen = 1, non_frozen = 0, color = "DARK_EDITION"}},
attributes = {"retrigger", "editions"}, attributes = {"retrigger", "editions", "copying"},
eternal_compat = true, eternal_compat = true,
blueprint_compat = true, blueprint_compat = true,
perishable_compat = true, perishable_compat = true,
@ -542,9 +542,9 @@ joker {
calculate = function(_, card, context) calculate = function(_, card, context)
local extra = card.ability.extra local extra = card.ability.extra
if extra.max_stack and if f(context.blueprint_copiers_stack)
context.blueprint_copiers_stack and :where("config.center.key", card.config.center.key)
extra.max_stack < #context.blueprint_copiers_stack then :any() then
return return
end end
@ -557,14 +557,15 @@ joker {
end end
return SMODS.merge_effects( return SMODS.merge_effects(
f(G.jokers.cards):where(is_frozen):where(function(v) f(G.jokers.cards)
return v.config.center.key ~= card.config.center.key :where(is_frozen)
end):map(function(v) :map(function(v)
return SMODS.blueprint_effect(card, v, context) return SMODS.blueprint_effect(card, v, context)
end):where(type, "table"):map(function(v) end)
v.colour = G.C[extra.color] :where(type, "table")
return v :map(f.assign(G.C[extra.color], "colour"))
end):values():table() :values()
:table()
) )
end, end,
} }

View file

@ -340,6 +340,19 @@ function f.arg(i)
end end
end end
---@generic K, V
---@param v V
---@param k K
---@return fun(x: { [K]: V })
---@nodiscard
function f.assign(v, k)
return function(x)
if type(x) == "table" then
x[k] = v
end
end
end
---@generic K, V ---@generic K, V
---@param v K ---@param v K
---@return fun(x: { [K]: V }): V ---@return fun(x: { [K]: V }): V
@ -406,7 +419,7 @@ f[true and "call"] = function(self, ...)
local args = {...} local args = {...}
return type(self) == "string" and function(v) return type(self) == "string" and function(v)
return v[self](self, unpack(args)) return v[self](v, unpack(args))
end or function(v) end or function(v)
return v(unpack(args)) return v(unpack(args))
end end
@ -454,6 +467,7 @@ function f.new(fnext)
all = f.all, all = f.all,
any = f.any, any = f.any,
arg = f.arg, arg = f.arg,
assign = f.assign,
call = f.call, call = f.call,
chain = f.chain, chain = f.chain,
compose = f.compose, compose = f.compose,