Commit 5cecc59b authored by 未闻皂名's avatar 未闻皂名

2023/1/29 卡名检测修改

parent 41259ddf
Pipeline #19824 passed with stages
in 5 minutes and 17 seconds
......@@ -315,3 +315,32 @@ function RushDuel.GetEffectValues(card, code)
end
return values
end
-- 抹平表
function RushDuel.FlatTable(...)
local result = {}
for _, item in ipairs({...}) do
if type(item) == "table" then
local datas = RushDuel.FlatTable(table.unpack(item))
for _, data in ipairs(datas) do
table.insert(result, data)
end
else
table.insert(result, item)
end
end
return result
end
-- 递归检查表
function RushDuel.FlatCheck(check, ...)
for _, item in ipairs({...}) do
if type(item) == "table" then
if RushDuel.FlatCheck(check, table.unpack(item)) then
return true
end
elseif check(item) then
return true
end
end
return false
end
\ No newline at end of file
......@@ -32,15 +32,10 @@ end
-- 条件: 是否为传说卡的卡名
function RushDuel.IsLegendCode(card, ...)
for _, item in ipairs {...} do
local type = aux.GetValueType(item)
if type == "number" and RushDuel.GetCardCode(card) == item then
return true
elseif type == "table" and RushDuel.IsLegendCode(card, table.unpack(item)) then
return true
end
end
return false
local code = RushDuel.GetCardCode(card)
return RushDuel.FlatCheck(function(item)
return code == item
end, ...)
end
-- 获取卡牌的密码
......@@ -63,4 +58,4 @@ end
-- 条件: 是否卡名不同
function RushDuel.IsDifferentCode(card1, card2)
return RushDuel.GetCardCode(card1) ~= RushDuel.GetCardCode(card2)
end
\ No newline at end of file
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment