Optimize Arctic Circle

This commit is contained in:
Emik 2026-06-05 17:35:03 +02:00
parent fc29871a43
commit 40b9757895
Signed by: emik
GPG key ID: 6B0CD72A5E503BDF
3 changed files with 41 additions and 15 deletions

View file

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

View file

@ -438,7 +438,7 @@ joker {
pronouns = "they_them", pronouns = "they_them",
cost = 10, cost = 10,
rarity = 3, rarity = 3,
config = {extra = {frozen = 1}}, config = {extra = {frozen = 1, non_frozen = 0, max_stack = 6, color = "DARK_EDITION"}},
attributes = {"retrigger", "editions"}, attributes = {"retrigger", "editions"},
eternal_compat = true, eternal_compat = true,
blueprint_compat = true, blueprint_compat = true,
@ -449,26 +449,34 @@ joker {
calculate = function(_, card, context) calculate = function(_, card, context)
local extra = card.ability.extra 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 if context.repetition and context.other_card then
local repetitions = is_frozen(context.other_card) and extra.frozen or extra.non_frozen local repetitions = is_frozen(context.other_card) and extra.frozen or extra.non_frozen
if repetitions and repetitions > 0 then if repetitions and repetitions > 0 then
return {card = card, repetitions = repetitions} return {card = card, colour = G.C[extra.color], repetitions = repetitions}
end end
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) 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) end):map(function(v)
return SMODS.blueprint_effect(card, v, context) or true return SMODS.blueprint_effect(card, v, context)
end):where(function(v) end):where(type, "table"):map(function(v)
return type(v) == "table" v.colour = G.C[extra.color]
end):map(function(v)
v.colour = G.C.DARK_EDITION
return v return v
end):values():table() end):values():table()
) )
return merged
end, end,
} }

View file

@ -115,7 +115,25 @@ end
---@nodiscard ---@nodiscard
function f.index(v) function f.index(v)
return function(x) 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
end end
@ -146,18 +164,18 @@ end
---@overload fun(iter: true): fun(): true ---@overload fun(iter: true): fun(): true
---@overload fun(iter: nil): F ---@overload fun(iter: nil): F
function f.from(iter, fpairs, step) function f.from(iter, fpairs, step)
if iter == true then if iter == nil then
return none
elseif iter == true then
return f.tru return f.tru
elseif iter == false then elseif iter == false then
return f.fals return f.fals
elseif iter == nil then
return none
end end
local t = type(iter) local t = type(iter)
if t == "string" then if t == "string" then
return f.index(iter) return f.indices(iter)
elseif t == "number" then elseif t == "number" then
local ik, is, start = 0, step or 1, fpairs and iter or 1 local ik, is, start = 0, step or 1, fpairs and iter or 1