Commit 784936d4 authored by Chen Bill's avatar Chen Bill

add Auxiliary.SameValueCheck

parent 98714204
......@@ -36,13 +36,7 @@ function c41659072.initial_effect(c)
c:RegisterEffect(e3)
end
function c41659072.syncheck(g)
local sg=g:Clone()
local attr=ATTRIBUTE_ALL
for c in aux.Next(sg) do
attr=attr&c:GetAttribute()
if attr==0 then break end
end
return attr~=0
return aux.SameValueCheck(g,Card.GetAttribute)
end
function c41659072.sumlimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_SYNCHRO)~=SUMMON_TYPE_SYNCHRO or not se
......
......@@ -1481,3 +1481,18 @@ end
function Auxiliary.NegateSummonCondition()
return Duel.GetReadyChain()==0
end
--
function Auxiliary.SameValueFilter(f,value)
return function(c)
return f(c)&value==0
end
end
---Check if all cards in g have the same Attribute/Race
---@param g Group
---@param f function
---@return boolean
function Auxiliary.SameValueCheck(g,f)
local tc=g:GetFirst()
local filter=Auxiliary.SameValueFilter(f,f(tc))
return not g:IsExists(filter,1,tc)
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