Make Arctic Circle retriggers more generic

This commit is contained in:
Emik 2026-07-27 14:43:32 +02:00
parent 4619a24736
commit f170f855a1
Signed by: emik
GPG key ID: 6B0CD72A5E503BDF
3 changed files with 45 additions and 20 deletions

View file

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

View file

@ -526,6 +526,29 @@ joker {
end,
}
---comment
---@param card Card
---@param context table|CalcContext
---@return function
local function copy(card, context)
---@param v Card
return function(v)
local override_compat = v.config.center.blueprint_compat == nil
if override_compat then
v.config.center.blueprint_compat = true
end
local ret = SMODS.blueprint_effect(card, v, context)
if override_compat then
v.config.center.blueprint_compat = nil
end
return ret
end
end
joker {
key = "arctic",
pronouns = "they_them",
@ -557,13 +580,13 @@ joker {
end
return SMODS.merge_effects(
f(G.jokers.cards)
f(G)
:where(getmetatable, CardArea)
:flatmap("cards", ipairs)
:where(is_frozen)
:map(function(v)
return SMODS.blueprint_effect(card, v, context)
end)
:map(copy(card, context))
:where(type, "table")
:map(f.assign(G.C[extra.color], "colour"))
:map(f.insert(G.C[extra.color], "colour"))
:values()
:table()
)

View file

@ -340,19 +340,6 @@ function f.arg(i)
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
---@param v K
---@return fun(x: { [K]: V }): V
@ -391,6 +378,21 @@ function f.indices(v)
end
end
---@generic K, V
---@param v V
---@param k K
---@return fun(x: { [K]: V }): { [K]: V }
---@nodiscard
function f.insert(v, k)
return function(x)
if type(x) == "table" then
x[k] = v
end
return x
end
end
---@generic T
---@param tbl T[]
---@return fun(t: T[], i?: integer): integer, T
@ -467,7 +469,6 @@ function f.new(fnext)
all = f.all,
any = f.any,
arg = f.arg,
assign = f.assign,
call = f.call,
chain = f.chain,
compose = f.compose,
@ -485,6 +486,7 @@ function f.new(fnext)
index = f.index,
index_into = f.index_into,
indices = f.indices,
insert = f.insert,
isf = f.isf,
keys = f.keys,
map = f.map,