Commit aef63c29 authored by wind2009's avatar wind2009

Merge remote-tracking branch '233/patch-sync-workaround' into master

parents b255f4d4 c6bab92c
......@@ -29,10 +29,20 @@ function c45675980.initial_effect(c)
c:RegisterEffect(e2)
end
function c45675980.syncheck(g,tp,syncard)
return g:IsExists(Card.IsRace,1,nil,RACE_DRAGON) and syncard:IsSynchroSummonable(nil,g,#g-1,#g-1) and aux.SynMixHandCheck(g,tp,syncard)
return aux.SynMixHandCheck(g,tp,syncard) and syncard:IsSynchroSummonable(nil,g,#g-1,#g-1)
end
function c45675980.syncheckaddition(syncard)
return function(g)
if not g:IsExists(Card.IsRace,1,nil,RACE_DRAGON) then return false end
local sumlv=g:GetSum(Auxiliary.GetMinSynchroLevel,syncard)
return sumlv<=syncard:GetLevel()
end
end
function c45675980.spfilter(c,tp,mg)
return mg:CheckSubGroup(c45675980.syncheck,2,#mg,tp,c)
aux.GCheckAdditional=c45675980.syncheckaddition(c)
local res=mg:CheckSubGroup(c45675980.syncheck,2,#mg,tp,c)
aux.GCheckAdditional=nil
return res
end
function c45675980.sctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
......
......@@ -271,7 +271,8 @@ function Auxiliary.SynMixTarget(f1,f2,f3,f4,minct,maxct,gc)
else
mg2:Sub(g)
end
local cg=mg2:Filter(Auxiliary.SynMixCheckRecursive,g4,tp,g4,mg2,i,minc,maxc,c,g,smat,gc,mgchk)
local fulltraversal=mg:IsExists(Card.IsHasEffect,1,nil,89818984)
local cg=mg2:Filter(Auxiliary.SynMixCheckRecursive,g4,tp,g4,mg2,i,minc,maxc,c,g,smat,gc,mgchk,fulltraversal)
if cg:GetCount()==0 then break end
local finish=Auxiliary.SynMixCheckGoal(tp,g4,minc,i,c,g,smat,gc,mgchk)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
......@@ -336,36 +337,33 @@ function Auxiliary.SynMixFilter4(c,f4,minc,maxc,syncard,mg1,smat,c1,c2,c3,gc,mgc
else
mg:Sub(sg)
end
return Auxiliary.SynMixCheck(mg,sg,minc-1,maxc-1,syncard,smat,gc,mgchk)
return Auxiliary.SynMixCheck(mg,sg,minc-1,maxc-1,syncard,mg1,smat,gc,mgchk)
end
function Auxiliary.SynMixCheck(mg,sg1,minc,maxc,syncard,smat,gc,mgchk)
function Auxiliary.SynMixCheck(mg,sg1,minc,maxc,syncard,mg1,smat,gc,mgchk)
local tp=syncard:GetControler()
local sg=Group.CreateGroup()
if minc<=0 and Auxiliary.SynMixCheckGoal(tp,sg1,0,0,syncard,sg,smat,gc,mgchk) then return true end
if maxc==0 then return false end
return mg:IsExists(Auxiliary.SynMixCheckRecursive,1,nil,tp,sg,mg,0,minc,maxc,syncard,sg1,smat,gc,mgchk)
local fulltraversal=#mg<=5 or mg1:IsExists(Card.IsHasEffect,1,nil,89818984)
return mg:IsExists(Auxiliary.SynMixCheckRecursive,1,nil,tp,sg,mg,0,minc,maxc,syncard,sg1,smat,gc,mgchk,fulltraversal)
end
function Auxiliary.SynMixCheckRecursive(c,tp,sg,mg,ct,minc,maxc,syncard,sg1,smat,gc,mgchk)
function Auxiliary.SynMixCheckRecursive(c,tp,sg,mg,ct,minc,maxc,syncard,sg1,smat,gc,mgchk,fulltraversal)
sg:AddCard(c)
ct=ct+1
local res=Auxiliary.SynMixCheckGoal(tp,sg,minc,ct,syncard,sg1,smat,gc,mgchk)
if not res and ct<maxc then
local maxlv=syncard:GetLevel()
if #mg<=7 or #sg<=maxlv/7 then
res=mg:IsExists(Auxiliary.SynMixCheckRecursive,1,sg,tp,sg,mg,ct,minc,maxc,syncard,sg1,smat,gc,mgchk)
else
local g=sg:Clone()
g:Merge(sg1)
local sumlv=g:GetSum(Auxiliary.GetMinSynchroLevel,syncard)
if sumlv<maxlv or g:IsExists(Card.IsHasEffect,1,nil,89818984) and #g<maxlv/2 then
res=mg:IsExists(Auxiliary.SynMixCheckRecursive,1,sg,tp,sg,mg,ct,minc,maxc,syncard,sg1,smat,gc,mgchk)
end
end
if not res and ct<maxc
and (fulltraversal or not Auxiliary.SynMixCheckPrune(sg,sg1,syncard)) then
res=mg:IsExists(Auxiliary.SynMixCheckRecursive,1,sg,tp,sg,mg,ct,minc,maxc,syncard,sg1,smat,gc,mgchk,fulltraversal)
end
sg:RemoveCard(c)
ct=ct-1
return res
end
function Auxiliary.SynMixCheckPrune(sg,sg1,syncard)
local g=sg+sg1
local sumlv=g:GetSum(Auxiliary.GetMinSynchroLevel,syncard)
return sumlv>=syncard:GetLevel()
end
-- the material is in hand and don't has extra synchro material effect itself
-- that mean some other tuner added it as material
function Auxiliary.SynMixHandFilter(c,tp,syncard)
......@@ -400,8 +398,7 @@ function Auxiliary.SynMixHandCheck(g,tp,syncard)
end
function Auxiliary.SynMixCheckGoal(tp,sg,minc,ct,syncard,sg1,smat,gc,mgchk)
if ct<minc then return false end
local g=sg:Clone()
g:Merge(sg1)
local g=sg+sg1
if Duel.GetLocationCountFromEx(tp,tp,g,syncard)<=0 then return false end
if gc and not gc(g,syncard,tp) then return false end
if smat and not g:IsContains(smat) then return false 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