Commit d0a226a4 authored by Chen Bill's avatar Chen Bill

workaround fix #1269

parent 5b0dd112
...@@ -45,8 +45,12 @@ function bit.replace(r,v,field,width) ...@@ -45,8 +45,12 @@ function bit.replace(r,v,field,width)
return (r&~(m<<f))|((v&m)<< f) return (r&~(m<<f))|((v&m)<< f)
end end
--Group check functions ---Subgroup check function
Auxiliary.GCheckAdditional=nil ---@param sg Group
---@param c Card
---@param g Group
---@return boolean
Auxiliary.GCheckAdditional=function(sg,c,g) return true end
--the table of xyz number --the table of xyz number
Auxiliary.xyz_number={} Auxiliary.xyz_number={}
...@@ -939,7 +943,7 @@ end ...@@ -939,7 +943,7 @@ end
Auxiliary.SubGroupCaptured=nil Auxiliary.SubGroupCaptured=nil
function Auxiliary.CheckGroupRecursive(c,sg,g,f,min,max,ext_params) function Auxiliary.CheckGroupRecursive(c,sg,g,f,min,max,ext_params)
sg:AddCard(c) sg:AddCard(c)
if Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,c,g,f,min,max,ext_params) then if Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,c,g) then
sg:RemoveCard(c) sg:RemoveCard(c)
return false return false
end end
...@@ -950,7 +954,7 @@ function Auxiliary.CheckGroupRecursive(c,sg,g,f,min,max,ext_params) ...@@ -950,7 +954,7 @@ function Auxiliary.CheckGroupRecursive(c,sg,g,f,min,max,ext_params)
end end
function Auxiliary.CheckGroupRecursiveCapture(c,sg,g,f,min,max,ext_params) function Auxiliary.CheckGroupRecursiveCapture(c,sg,g,f,min,max,ext_params)
sg:AddCard(c) sg:AddCard(c)
if Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,c,g,f,min,max,ext_params) then if Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,c,g) then
sg:RemoveCard(c) sg:RemoveCard(c)
return false return false
end end
...@@ -971,8 +975,8 @@ function Group.CheckSubGroup(g,f,min,max,...) ...@@ -971,8 +975,8 @@ function Group.CheckSubGroup(g,f,min,max,...)
local ext_params={...} local ext_params={...}
local sg=Duel.GrabSelectedCard() local sg=Duel.GrabSelectedCard()
if #sg>max or #(g+sg)<min then return false end if #sg>max or #(g+sg)<min then return false end
if #sg==max and (not f(sg,...) or Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,nil,g,f,min,max,ext_params)) then return false end if #sg==max and (not f(sg,...) or Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,nil,g)) then return false end
if #sg>=min and #sg<=max and f(sg,...) and (not Auxiliary.GCheckAdditional or Auxiliary.GCheckAdditional(sg,nil,g,f,min,max,ext_params)) then return true end if #sg>=min and #sg<=max and f(sg,...) and (not Auxiliary.GCheckAdditional or Auxiliary.GCheckAdditional(sg,nil,g)) then return true end
local eg=g:Clone() local eg=g:Clone()
for c in Auxiliary.Next(g-sg) do for c in Auxiliary.Next(g-sg) do
if Auxiliary.CheckGroupRecursive(c,sg,eg,f,min,max,ext_params) then return true end if Auxiliary.CheckGroupRecursive(c,sg,eg,f,min,max,ext_params) then return true end
...@@ -1040,7 +1044,7 @@ function Auxiliary.CheckGroupRecursiveEach(c,sg,g,f,checks,ext_params) ...@@ -1040,7 +1044,7 @@ function Auxiliary.CheckGroupRecursiveEach(c,sg,g,f,checks,ext_params)
return false return false
end end
sg:AddCard(c) sg:AddCard(c)
if Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,c,g,f,min,max,ext_params) then if Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,c,g) then
sg:RemoveCard(c) sg:RemoveCard(c)
return false return false
end 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