Commit 942fcd92 authored by nanahira's avatar nanahira

update aux base functions

parent 891444b1
...@@ -58,19 +58,31 @@ end ...@@ -58,19 +58,31 @@ end
function Auxiliary.FALSE() function Auxiliary.FALSE()
return false return false
end end
function Auxiliary.AND(f1,f2) function Auxiliary.AND(...)
return function(a,b,c) local function_list={...}
return f1(a,b,c) and f2(a,b,c) return function(...)
local res=false
for i,f in ipairs(function_list) do
res=f(...)
if not res then return res end
end
return res
end end
end end
function Auxiliary.OR(f1,f2) function Auxiliary.OR(...)
return function(a,b,c) local function_list={...}
return f1(a,b,c) or f2(a,b,c) return function(...)
local res=false
for i,f in ipairs(function_list) do
res=f(...)
if res then return res end
end
return res
end end
end end
function Auxiliary.NOT(f) function Auxiliary.NOT(f)
return function(a,b,c) return function(...)
return not f(a,b,c) return not f(...)
end end
end end
function Auxiliary.BeginPuzzle(effect) function Auxiliary.BeginPuzzle(effect)
...@@ -101,7 +113,7 @@ function Auxiliary.IsDualState(effect) ...@@ -101,7 +113,7 @@ function Auxiliary.IsDualState(effect)
return not c:IsDisabled() and c:IsDualState() return not c:IsDisabled() and c:IsDualState()
end end
function Auxiliary.IsNotDualState(effect) function Auxiliary.IsNotDualState(effect)
local c=effect:GetHandle() local c=effect:GetHandler()
return c:IsDisabled() or not c:IsDualState() return c:IsDisabled() or not c:IsDualState()
end end
function Auxiliary.DualNormalCondition(effect) function Auxiliary.DualNormalCondition(effect)
...@@ -197,34 +209,40 @@ function Auxiliary.CheckUnionEquip(uc,tc) ...@@ -197,34 +209,40 @@ function Auxiliary.CheckUnionEquip(uc,tc)
if uc.old_union then return ct1==0 if uc.old_union then return ct1==0
else return ct2==0 end else return ct2==0 end
end end
function Auxiliary.TargetEqualFunction(f,value,a,b,c) function Auxiliary.TargetEqualFunction(f,value,...)
local ext_params={...}
return function(effect,target) return function(effect,target)
return f(target,a,b,c)==value return f(target,table.unpack(ext_params))==value
end end
end end
function Auxiliary.TargetBoolFunction(f,a,b,c) function Auxiliary.TargetBoolFunction(f,...)
local ext_params={...}
return function(effect,target) return function(effect,target)
return f(target,a,b,c) return f(target,table.unpack(ext_params))
end end
end end
function Auxiliary.FilterEqualFunction(f,value,a,b,c) function Auxiliary.FilterEqualFunction(f,value,...)
local ext_params={...}
return function(target) return function(target)
return f(target,a,b,c)==value return f(target,table.unpack(ext_params))==value
end end
end end
function Auxiliary.FilterBoolFunction(f,a,b,c) function Auxiliary.FilterBoolFunction(f,...)
local ext_params={...}
return function(target) return function(target)
return f(target,a,b,c) return f(target,table.unpack(ext_params))
end end
end end
function Auxiliary.Tuner(f,a,b,c) function Auxiliary.Tuner(f,...)
local ext_params={...}
return function(target) return function(target)
return target:IsType(TYPE_TUNER) and (not f or f(target,a,b,c)) return target:IsType(TYPE_TUNER) and (not f or f(target,table.unpack(ext_params)))
end end
end end
function Auxiliary.NonTuner(f,a,b,c) function Auxiliary.NonTuner(f,...)
local ext_params={...}
return function(target) return function(target)
return target:IsNotTuner() and (not f or f(target,a,b,c)) return target:IsNotTuner() and (not f or f(target,table.unpack(ext_params)))
end end
end end
function Auxiliary.GetValueType(v) function Auxiliary.GetValueType(v)
......
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