Commit b255f4d4 authored by wind2009's avatar wind2009

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

parents bc4c2781 f904666c
......@@ -59,16 +59,17 @@ end
---@param minc integer
---@param maxc? integer
function Auxiliary.AddSynchroProcedure(c,f1,f2,minc,maxc)
if maxc==nil then maxc=99 end
if maxc==nil then maxc=c:GetLevel()-1 end
local maxct=math.min(maxc,c:GetLevel()-1)
local e1=Effect.CreateEffect(c)
e1:SetDescription(1164)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(Auxiliary.SynCondition(f1,f2,minc,maxc))
e1:SetTarget(Auxiliary.SynTarget(f1,f2,minc,maxc))
e1:SetOperation(Auxiliary.SynOperation(f1,f2,minc,maxc))
e1:SetCondition(Auxiliary.SynCondition(f1,f2,minc,maxct))
e1:SetTarget(Auxiliary.SynTarget(f1,f2,minc,maxct))
e1:SetOperation(Auxiliary.SynOperation(f1,f2,minc,maxct))
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
end
......@@ -133,15 +134,22 @@ end
---@param maxc integer
---@param gc? function
function Auxiliary.AddSynchroMixProcedure(c,f1,f2,f3,f4,minc,maxc,gc)
local maxct=maxc
if maxct>c:GetLevel() then
maxct=c:GetLevel()
if f1 then maxct=maxct-1 end
if f2 then maxct=maxct-1 end
if f3 then maxct=maxct-1 end
end
local e1=Effect.CreateEffect(c)
e1:SetDescription(1164)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(Auxiliary.SynMixCondition(f1,f2,f3,f4,minc,maxc,gc))
e1:SetTarget(Auxiliary.SynMixTarget(f1,f2,f3,f4,minc,maxc,gc))
e1:SetOperation(Auxiliary.SynMixOperation(f1,f2,f3,f4,minc,maxc,gc))
e1:SetCondition(Auxiliary.SynMixCondition(f1,f2,f3,f4,minc,maxct,gc))
e1:SetTarget(Auxiliary.SynMixTarget(f1,f2,f3,f4,minc,maxct,gc))
e1:SetOperation(Auxiliary.SynMixOperation(f1,f2,f3,f4,minc,maxct,gc))
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
end
......@@ -154,6 +162,15 @@ end
function Auxiliary.GetSynchroLevelFlowerCardian(c)
return 2
end
function Auxiliary.GetMinSynchroLevel(c,syncard)
local lv=c:GetSynchroLevel(syncard)
local minlv=c:GetLevel()
while lv&MAX_PARAMETER>0 do
minlv=math.min(minlv,lv&MAX_PARAMETER)
lv=lv>>16
end
return minlv
end
function Auxiliary.GetSynMaterials(tp,syncard)
local mg=Duel.GetSynchroMaterial(tp):Filter(Auxiliary.SynMaterialFilter,nil,syncard)
if mg:IsExists(Card.GetHandSynchro,1,nil) then
......@@ -332,7 +349,19 @@ function Auxiliary.SynMixCheckRecursive(c,tp,sg,mg,ct,minc,maxc,syncard,sg1,smat
sg:AddCard(c)
ct=ct+1
local res=Auxiliary.SynMixCheckGoal(tp,sg,minc,ct,syncard,sg1,smat,gc,mgchk)
or (ct<maxc and mg:IsExists(Auxiliary.SynMixCheckRecursive,1,sg,tp,sg,mg,ct,minc,maxc,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
end
sg:RemoveCard(c)
ct=ct-1
return res
......
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