From 40b9757895481017299b1d7b9a7193e575a50fcc Mon Sep 17 00:00:00 2001 From: Emik Date: Fri, 5 Jun 2026 17:35:03 +0200 Subject: [PATCH] Optimize Arctic Circle --- manifest.json | 2 +- src/joker.lua | 26 +++++++++++++++++--------- src/lib/funky.lua | 28 +++++++++++++++++++++++----- 3 files changed, 41 insertions(+), 15 deletions(-) diff --git a/manifest.json b/manifest.json index 6e25919..d43cf5c 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "id": "Roland", "name": "Roland", "prefix": "Roland", - "version": "2.8.11", + "version": "2.8.12", "badge_colour": "8BE9FD", "display_name": "Roland", "main_file": "src/main.lua", diff --git a/src/joker.lua b/src/joker.lua index 8919c92..c247320 100644 --- a/src/joker.lua +++ b/src/joker.lua @@ -438,7 +438,7 @@ joker { pronouns = "they_them", cost = 10, rarity = 3, - config = {extra = {frozen = 1}}, + config = {extra = {frozen = 1, non_frozen = 0, max_stack = 6, color = "DARK_EDITION"}}, attributes = {"retrigger", "editions"}, eternal_compat = true, blueprint_compat = true, @@ -449,26 +449,34 @@ joker { calculate = function(_, card, context) local extra = card.ability.extra + if extra.max_stack and + context.blueprint_copiers_stack and + extra.max_stack < #context.blueprint_copiers_stack then + return + end + if context.repetition and context.other_card then local repetitions = is_frozen(context.other_card) and extra.frozen or extra.non_frozen if repetitions and repetitions > 0 then - return {card = card, repetitions = repetitions} + return {card = card, colour = G.C[extra.color], repetitions = repetitions} end end - return SMODS.merge_effects( + local key = card.config.center.key + + local merged = SMODS.merge_effects( f(G.jokers.cards):where(is_frozen):where(function(v) - return v.config.center.key ~= card.config.center.key + return v.config.center.key ~= key end):map(function(v) - return SMODS.blueprint_effect(card, v, context) or true - end):where(function(v) - return type(v) == "table" - end):map(function(v) - v.colour = G.C.DARK_EDITION + return SMODS.blueprint_effect(card, v, context) + end):where(type, "table"):map(function(v) + v.colour = G.C[extra.color] return v end):values():table() ) + + return merged end, } diff --git a/src/lib/funky.lua b/src/lib/funky.lua index 9c3b7da..9d1241b 100644 --- a/src/lib/funky.lua +++ b/src/lib/funky.lua @@ -115,7 +115,25 @@ end ---@nodiscard function f.index(v) return function(x) - return x and x[v] + return type(x) == "table" and x[v] or x + end +end + +---@generic V +---@param v string +---@return fun(x: { [string]: V }): V +---@nodiscard +function f.indices(v) + return function(x) + if type(x) ~= "table" then + return x + end + + for i in v:gmatch "[^.]+" do + x = x[i] + end + + return x end end @@ -146,18 +164,18 @@ end ---@overload fun(iter: true): fun(): true ---@overload fun(iter: nil): F function f.from(iter, fpairs, step) - if iter == true then + if iter == nil then + return none + elseif iter == true then return f.tru elseif iter == false then return f.fals - elseif iter == nil then - return none end local t = type(iter) if t == "string" then - return f.index(iter) + return f.indices(iter) elseif t == "number" then local ik, is, start = 0, step or 1, fpairs and iter or 1