From f170f855a1207e41420601c03a965dba5d7de83e Mon Sep 17 00:00:00 2001 From: Emik Date: Mon, 27 Jul 2026 14:43:32 +0200 Subject: [PATCH] Make Arctic Circle retriggers more generic --- manifest.json | 2 +- src/joker.lua | 33 ++++++++++++++++++++++++++++----- src/lib/funky.lua | 30 ++++++++++++++++-------------- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/manifest.json b/manifest.json index f3ed1c2..87dbfa2 100644 --- a/manifest.json +++ b/manifest.json @@ -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", diff --git a/src/joker.lua b/src/joker.lua index b05e500..a163a7b 100644 --- a/src/joker.lua +++ b/src/joker.lua @@ -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() ) diff --git a/src/lib/funky.lua b/src/lib/funky.lua index 4e55b33..8d40073 100644 --- a/src/lib/funky.lua +++ b/src/lib/funky.lua @@ -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,