Compare commits

..

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

5 changed files with 28 additions and 69 deletions

View file

@ -212,13 +212,3 @@ match_indent = true
# position = "at" # position = "at"
# payload = 'local cmdName = inputText' # payload = 'local cmdName = inputText'
# match_indent = true # match_indent = true
# [[patches]]
# [patches.pattern]
# target = '=[SMODS DebugPlus "debugplus/util.lua"]'
# pattern = "function global.stringifyTable(tab, depth, num, dec, indent)"
# position = "after"
# payload = """if type(tab) == "table" and type(tab.table) == "function" then
# tab = tab:table()
# end"""
# match_indent = true

View file

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

View file

@ -232,21 +232,24 @@ blind {
boss = {min = 3}, boss = {min = 3},
boss_colour = HEX "102a41ff", boss_colour = HEX "102a41ff",
pronouns = "it_its", pronouns = "it_its",
defeat = function() defeat = function(self)
f(G.I.CARD):where "Roland_blizzard":each(set_freeze()) self.cards():where "Roland_blizzard":each(set_freeze())
G.GAME.blind.disabled = true G.GAME.blind.disabled = true
end, end,
disable = function(self) disable = function(self)
self:defeat() self:defeat()
end, end,
calculate = function(_, b, context) calculate = function(self, b, context)
return not b.disabled and return not b.disabled and
context.hand_drawn and context.hand_drawn and
f(G.I.CARD) self.cards()
:where("Roland_blizzard", false) :where("Roland_blizzard", false)
:where("facing", "front") :where("facing", "front")
:each(set_freeze(true)) or nil :each(set_freeze(true)) or nil
end, end,
cards = function()
return f(G):where(getmetatable, CardArea):flatmap("cards", ipairs)
end,
} }
blind { blind {

View file

@ -589,7 +589,9 @@ joker {
end end
return SMODS.merge_effects( return SMODS.merge_effects(
f(G.I.CARD) f(G)
:where(getmetatable, CardArea)
:flatmap("cards", ipairs)
:where(is_frozen) :where(is_frozen)
:map(copy(card, context)) :map(copy(card, context))
:where(type, "table") :where(type, "table")
@ -1204,8 +1206,7 @@ end
local orig_get_enhancements = SMODS.get_enhancements local orig_get_enhancements = SMODS.get_enhancements
function SMODS.get_enhancements(card, ...) function SMODS.get_enhancements(card, ...)
if not card.base or if (G.GAME.modifiers.Roland_suitable or 0) <= 0 or
(G.GAME.modifiers.Roland_suitable or 0) <= 0 or
card.base.suit ~= G.GAME.current_round.Roland_suitable.suit or card.base.suit ~= G.GAME.current_round.Roland_suitable.suit or
(card.area ~= G.hand and card.area ~= G.play) then (card.area ~= G.hand and card.area ~= G.play) then
return orig_get_enhancements(card, ...) return orig_get_enhancements(card, ...)

View file

@ -3,7 +3,7 @@
---@license MPL-2.0 ---@license MPL-2.0
---@version 1.0.0 ---@version 1.0.0
--- ---
---@alias FFrom (fun<K, V>(iter: { [K]: V }, fpairs?: fun(t: { [K]: V }): (fun(table: { [K]: V }, index?: K): K?, V?)): F | { [K]: V })|(fun(iter: number, fpairs?: number, step?: number): F | { [number]: number })|(fun<V>(iter: string): (fun(table: { [string]: V }): V))|(fun<V>(iter: string): (fun(table: { [string]: V }): V))|(fun<K, V>(iter: fun(): K, V): F | { [K]: V })|(fun(iter: false): fun(): false)|(fun(iter: true): fun(): true)|(fun(iter: nil): F) ---@alias FFrom (fun<K, V>(iter: table<K, V>, fpairs?: fun(t: table<K, V>): (fun(table: table<K, V>, index?: K): K?, V?)): F | { [K]: V })|(fun(iter: number, fpairs?: number, step?: number): F | { [number]: number })|(fun<V>(iter: string): (fun(table: { [string]: V }): V))|(fun<V>(iter: string): (fun(table: { [string]: V }): V))|(fun<K, V>(iter: fun(): K, V): F | { [K]: V })|(fun(iter: false): fun(): false)|(fun(iter: true): fun(): true)|(fun(iter: nil): F)
---@class F ---@class F
local f = {} local f = {}
@ -254,10 +254,10 @@ local function autofunc(func)
end end
---@generic K, V ---@generic K, V
---@param tbl { [K]: V } ---@param tbl table<K, V>
---@param fpairs? fun(t: { [K]: V }): (fun(table: { [K]: V }, index?: K): K, V) ---@param fpairs? fun(t: table<K, V>): (fun(table: table<K, V>, index?: K): K, V)
---@return fun(tbl: { [K]: V }, key: K): K, V ---@return fun(tbl: table<K, V>, key: K): K, V
---@return { [K]: V } ---@return table<K, V>
---@return V ---@return V
---@nodiscard ---@nodiscard
local function autopairs(tbl, fpairs) local function autopairs(tbl, fpairs)
@ -393,44 +393,19 @@ function f.insert(v, k)
end end
end end
local chairs = function(s, i) ---@generic T
local k = i and i + 1 or 1 ---@param tbl T[]
local v = s:sub(k, k) ---@return fun(t: T[], i?: integer): integer, T
---@return T[]
if v == nil then function f.revpairs(tbl)
return return function(t, i)
end
local t = type(v)
if t ~= "string" and t ~= "table" or #v ~= 0 then
return k, v
end
end
---@generic T: string|{sub: fun(self: self, i: integer, j: integer)}
---@param str T
---@return fun(t: T, i?: integer): integer, T
---@return T
function f.chairs(str)
return chairs, str
end
local revpairs = function(t, i)
local k = i and i - 1 or #t local k = i and i - 1 or #t
local v = t[k] local v = t[k]
if v ~= nil then if v ~= nil then
return k, v return k, v
end end
end end, tbl
---@generic T
---@param tbl T[]
---@return fun(t: T[], i?: integer): integer, T
---@return T[]
function f.revpairs(tbl)
return revpairs, tbl
end end
---@param any any ---@param any any
@ -496,7 +471,6 @@ function f.new(fnext)
arg = f.arg, arg = f.arg,
call = f.call, call = f.call,
chain = f.chain, chain = f.chain,
chairs = f.chairs,
compose = f.compose, compose = f.compose,
concat = f.concat, concat = f.concat,
const = f.const, const = f.const,
@ -550,16 +524,7 @@ function f.from(iter, fpairs, step)
local t = type(iter) local t = type(iter)
if t == "string" then if t == "string" then
if not fpairs then
return f.indices(iter) return f.indices(iter)
end
local next, tbl, k, v = fpairs(iter --[[@as { sub: fun(self: self, i: integer, j?: integer) }]])
return f.new(function()
k, v = next(tbl, k)
return k, v
end)
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
@ -682,9 +647,9 @@ end
---@generic K, V, U ---@generic K, V, U
---@param self F|{ [K]: V } ---@param self F|{ [K]: V }
---@param func fun(v: V, k: K): { [any]: U } ---@param func fun(v: V, k: K): { [any]: U }
---@param fpairs? fun(t: { [K]: V }): (fun(table: { [K]: V }, index?: K): K, V) ---@param fpairs? fun(t: table<K, V>): (fun(table: table<K, V>, index?: K): K, V)
---@return F|{ [K]: U } ---@return F|{ [K]: U }
---@overload fun(self: F|{ [K]: V }, func: string, fpairs?: fun(t: { [K]: V }): (fun(table: { [K]: V }, index?: K): K, V)): F|{ [K]: U } ---@overload fun(self: F|{ [K]: V }, func: string, fpairs?: fun(t: table<K, V>): (fun(table: table<K, V>, index?: K): K, V)): F|{ [K]: U }
---@nodiscard ---@nodiscard
function f:flatmap(func, fpairs) function f:flatmap(func, fpairs)
self = f.isf(self) and self or f.from(self) self = f.isf(self) and self or f.from(self)