Compare commits

..

No commits in common. "main" and "2.9.25" have entirely different histories.
main ... 2.9.25

6 changed files with 19 additions and 124 deletions

View file

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

View file

@ -648,7 +648,7 @@ joker {
local _ = card.area == G.jokers and self:cerulean(false) local _ = card.area == G.jokers and self:cerulean(false)
end, end,
cerulean = function(_, value) cerulean = function(_, value)
local _ = G.jokers and f(G.jokers.cards):each(function(v) f(G.jokers.cards):each(function(v)
f {"click", "drag", "focus", "hover"}:map(f.index_into(v.states)):each(function(s) f {"click", "drag", "focus", "hover"}:map(f.index_into(v.states)):each(function(s)
s.can = value or v.config.center.key == "j_Roland_cerulean" s.can = value or v.config.center.key == "j_Roland_cerulean"
end) end)
@ -675,7 +675,7 @@ joker {
{card = card, xmult = card.ability.extra.xmult} or nil {card = card, xmult = card.ability.extra.xmult} or nil
end, end,
crimson = function() crimson = function()
local _ = G.jokers and f(G.jokers.cards, ipairs_reversed):where(is_frozen, false):each(function(v) f(G.jokers.cards, ipairs_reversed):where(is_frozen, false):each(function(v)
local right = G.jokers.cards[v.rank + 1] local right = G.jokers.cards[v.rank + 1]
local debuffed_by_crimson = right and local debuffed_by_crimson = right and
@ -757,7 +757,7 @@ joker {
key = "violet", key = "violet",
pronouns = "she_they", pronouns = "she_they",
idea = "hamester", idea = "hamester",
config = {extra = {before = 0.1, xmult = 6}}, config = {extra = {before = 0.1, xmult = 9}},
pixel_size = {w = 68, h = 68}, pixel_size = {w = 68, h = 68},
attributes = {"xmult"}, attributes = {"xmult"},
cost = 6, cost = 6,
@ -1258,7 +1258,7 @@ joker {
return {card = card, numerator = extra.probability} return {card = card, numerator = extra.probability}
end end
if context.end_of_round and not context.repetition and extra.probability ~= extra.reset then if context.end_of_round and extra.probability ~= extra.reset then
extra.probability = extra.reset extra.probability = extra.reset
return {message = localize "k_reset", colour = G.C.RED, message_card = card, repetitions = 0} return {message = localize "k_reset", colour = G.C.RED, message_card = card, repetitions = 0}
end end

View file

@ -128,6 +128,13 @@ local function autopairs(tbl, fpairs)
return (fpairs or (tbl[#tbl] and ipairs or pairs))(tbl) return (fpairs or (tbl[#tbl] and ipairs or pairs))(tbl)
end end
---@param any any
---@return boolean
---@nodiscard
local function is_f(any)
return type(any) == "table" and any.from == f.from and any.new == f.new
end
--- Always returns nil. --- Always returns nil.
---@return nil ---@return nil
---@nodiscard ---@nodiscard
@ -195,15 +202,6 @@ function f.const(v)
end end
end end
---@param i integer
---@return fun(...: any): any
---@nodiscard
function f.arg(i)
return function(...)
return ({...})[i]
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
@ -242,32 +240,21 @@ function f.indices(v)
end end
end end
---@param any any
---@return boolean
---@nodiscard
function f.isf(any)
return type(any) == "table" and any.from == f.from and any.new == f.new
end
f[true and "chain"] = function(...) f[true and "chain"] = function(...)
local ret for _, v in ipairs(...) do
for _, v in ipairs {...} do
if type(v) == "table" then if type(v) == "table" then
for _, vv in ipairs(v) do for _, vv in ipairs(v) do
local copy = ret
vv = autofunc(vv) vv = autofunc(vv)
ret = ret and function(...) ret = ret and function(...)
return vv(copy(...)) return vv(ret(...))
end or vv end or vv
end end
else else
local copy = ret
v = autofunc(v) v = autofunc(v)
ret = ret and function(...) ret = ret and function(...)
return v(copy(...)) return v(ret(...))
end or v end or v
end end
end end
@ -284,7 +271,6 @@ function f.new(fnext)
return { return {
all = f.all, all = f.all,
any = f.any, any = f.any,
arg = f.arg,
chain = f.chain, chain = f.chain,
concat = f.concat, concat = f.concat,
const = f.const, const = f.const,
@ -299,7 +285,6 @@ function f.new(fnext)
index = f.index, index = f.index,
index_into = f.index_into, index_into = f.index_into,
indices = f.indices, indices = f.indices,
isf = f.isf,
keys = f.keys, keys = f.keys,
map = f.map, map = f.map,
new = f.new, new = f.new,
@ -386,7 +371,7 @@ function f:concat(...)
local sum, last = 0, 0 local sum, last = 0, 0
for i = 1, #fs do for i = 1, #fs do
fs[i] = f.isf(fs[i]) and fs[i] or f.from(fs[i]) fs[i] = is_f(fs[i]) and fs[i] or f.from(fs[i])
end end
return f.new(function() return f.new(function()

View file

@ -25,9 +25,6 @@ CardSleeves = CardSleeves
--- @type table|fun(obj: SMODS.Back): SMODS.Back --- @type table|fun(obj: SMODS.Back): SMODS.Back
CardSleeves.Sleeve = CardSleeves.Sleeve CardSleeves.Sleeve = CardSleeves.Sleeve
--- @type {aliases: { [string]: [string] }}
Cryptid = Cryptid
--- @type fun(area: CardArea, ...: ...): Card --- @type fun(area: CardArea, ...: ...): Card
create_card_for_shop = create_card_for_shop create_card_for_shop = create_card_for_shop

View file

@ -1,59 +1,5 @@
local f = assert(SMODS.load_file "src/lib/funky.lua")() or require "lib.funky" local f = assert(SMODS.load_file "src/lib/funky.lua")() or require "lib.funky"
---@param v string
---@return Card|Tag
local function add(v)
if not G.P_TAGS[v] then
return SMODS.add_card {no_edition = true, key = v}
end
local tag = Tag(v)
if tag.name == "Orbital Tag" then
local hands = f(G.GAME.hands):where "visible":keys():table()
tag.ability.orbital_hand = pseudorandom_element(hands, pseudoseed "Roland_c_orbital_tag")
end
add_tag(tag)
return tag
end
local function simplify(x)
return type(x) == "string" and x:lower():gsub("%s", ""):gsub("_", ""):gsub("^the", "") or x
end
local function flatten(v)
return type(v) ~= "table" and {v} or (f.isf(v) and v:table() or v)
end
---@param it string
local function find(it)
if (G.P_CENTERS[it] or {}).config then
return it
end
local match = simplify(it)
local pool = f(G.P_CENTER_POOLS):any(f.chain(f.arg(2), simplify, f.eq(match)))
if type(pool) == "table" and next(pool) then
return pseudorandom_element(pool, pseudoseed "Roland_c").key
end
if Cryptid and Cryptid.aliases and Cryptid.aliases[it] then
return Cryptid.aliases[it]
end
return f(G.localization.descriptions)
:flatmap(flatten)
:where(type, "table")
:where(f.chain(f.arg(2), f.index_into(G.P_CENTERS), "config"))
:where(function(v, k)
return match == simplify(k) or match == simplify(v.name)
end)
:keys()
:any()
end
local function protect(fun) local function protect(fun)
return function() return function()
local res, ret = pcall(fun) local res, ret = pcall(fun)
@ -110,35 +56,4 @@ local function u()
G.STATE ~= G.STATES.PLAY_TAROT) G.STATE ~= G.STATES.PLAY_TAROT)
end end
--- Creates one or more cards. return {f, q, u}
---@param ... any
---@return Card|Tag|(Card|Tag[])
local function c(...)
local cards = f {...}
:flatmap(flatten)
:where(type, "string")
:map(string.lower)
:map(find)
:where(f.id)
:map(add)
:values()
:table()
return #cards > 1 and cards or cards[1]
end
return {f, q, u, setmetatable({}, {
__call = function(_, ...)
return c(...)
end,
__index = function(_, k)
return c(k)
end,
__newindex = function(_, k, v)
local n = tonumber(v)
for _ = 1, type(n) == "number" and n or 1 do
c(k)
end
end,
})}

View file

@ -52,11 +52,9 @@ q {
-- G.ARGS.LOC_COLOURS["Bakery_credit_bg_Roland_" .. k] = v.bg -- G.ARGS.LOC_COLOURS["Bakery_credit_bg_Roland_" .. k] = v.bg
end) end)
if not SMODS.Mods.DebugPlus or not SMODS.Mods.Roland.config.import_funky then if SMODS.Mods.DebugPlus and SMODS.Mods.Roland.config.import_funky then
return _G.f, _G.q, _G.u = unpack(qol)
end end
_G.f, _G.q, _G.u, _G.c = unpack(qol)
end, end,
} }