Commit 3360bf34 authored by VanillaSalt's avatar VanillaSalt

fix

parent 281fa4cb
...@@ -371,6 +371,9 @@ function Auxiliary.AddFusionProcCode2(c,code1,code2,sub,insf) ...@@ -371,6 +371,9 @@ function Auxiliary.AddFusionProcCode2(c,code1,code2,sub,insf)
e1:SetOperation(Auxiliary.FOperationCode2(code1,code2,sub,insf)) e1:SetOperation(Auxiliary.FOperationCode2(code1,code2,sub,insf))
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function Auxiliary.FConditionFilter12(c,code,sub)
return c:IsFusionCode(code) or (sub and c:IsHasEffect(EFFECT_FUSION_SUBSTITUTE))
end
function Auxiliary.FConditionFilter21(c,code1,code2) function Auxiliary.FConditionFilter21(c,code1,code2)
return c:IsFusionCode(code1) or c:IsFusionCode(code2) return c:IsFusionCode(code1) or c:IsFusionCode(code2)
end end
...@@ -383,60 +386,86 @@ function Auxiliary.FConditionCode2(code1,code2,sub,insf) ...@@ -383,60 +386,86 @@ function Auxiliary.FConditionCode2(code1,code2,sub,insf)
--chkf: check field, default:PLAYER_NONE --chkf: check field, default:PLAYER_NONE
return function(e,g,gc,chkf) return function(e,g,gc,chkf)
if g==nil then return insf end if g==nil then return insf end
local mg=g:Filter(Card.IsCanBeFusionMaterial,nil,e:GetHandler()) local mg=g:Filter(Card.IsCanBeFusionMaterial,gc,e:GetHandler())
if gc then if gc then
if not gc:IsCanBeFusionMaterial(e:GetHandler()) then return false end if not gc:IsCanBeFusionMaterial(e:GetHandler()) then return false end
if gc:IsHasEffect(EFFECT_FUSION_SUBSTITUTE) then local b1=0 local b2=0 local bw=0
return mg:IsExists(Auxiliary.FConditionFilter21,1,gc,code1,code2) if gc:IsFusionCode(code1) then b1=1 end
elseif gc:IsFusionCode(code1) then if gc:IsFusionCode(code2) then b2=1 end
return mg:IsExists(Card.IsFusionCode,1,gc,code2) if sub and gc:IsHasEffect(EFFECT_FUSION_SUBSTITUTE) then bw=1 end
elseif gc:IsFusionCode(code2) then if b1+b2+bw==0 then return false end
return mg:IsExists(Card.IsFusionCode,1,gc,code1) if b1+b2+bw==1 then b1=b1*2 b2=b2*2 bw=bw*2 end
if chkf~=PLAYER_NONE and Auxiliary.FConditionCheckF(gc,chkf) then
mg=mg:Filter(Auxiliary.FConditionCheckF,nil,chkf)
end
if b1==2 then
return mg:IsExists(Auxiliary.FConditionFilter12,1,nil,code2,sub)
elseif b2==2 then
return mg:IsExists(Auxiliary.FConditionFilter12,1,nil,code1,sub)
elseif bw==2 then
return mg:IsExists(Auxiliary.FConditionFilter21,1,nil,code1,code2)
else else
return false return mg:IsExists(Auxiliary.FConditionFilter22,1,nil,code1,code2,sub)
end end
end end
local b1=0 local b2=0 local bs=0 local b1=0 local b2=0 local bw=0
local fs=false local fs=chkf==PLAYER_NONE
local tc=mg:GetFirst() local tc=mg:GetFirst()
while tc do while tc do
if tc:IsFusionCode(code1) then b1=1 if Auxiliary.FConditionCheckF(tc,chkf) then fs=true end local c1=0 local c2=0 local cw=0
elseif tc:IsFusionCode(code2) then b2=1 if Auxiliary.FConditionCheckF(tc,chkf) then fs=true end if tc:IsFusionCode(code1) then c1=1 end
elseif sub and tc:IsHasEffect(EFFECT_FUSION_SUBSTITUTE) then bs=1 if Auxiliary.FConditionCheckF(tc,chkf) then fs=true end if tc:IsFusionCode(code2) then c2=1 end
if sub and tc:IsHasEffect(EFFECT_FUSION_SUBSTITUTE) then cw=1 end
if c1+c2+cw>0 then
if Auxiliary.FConditionCheckF(tc,chkf) then fs=true end
if c1+c2+cw>1 then b1=b1+c1 b2=b2+c2 bw=bw+cw
elseif c1+c2+cw==1 then b1=b1+c1*2 b2=b2+c2*2 bw=bw+cw*2
end
end end
tc=mg:GetNext() tc=mg:GetNext()
end end
return b1+b2+bs>=2 and (fs or chkf==PLAYER_NONE) local c1=0 local c2=0
if b1==1 then c1=c1+1 elseif b1>1 then c2=c2+1 end
if b2==1 then c1=c1+1 elseif b2>1 then c2=c2+1 end
if bw==1 then c1=c1+1 elseif bw>1 then c2=c2+1 end
return c2>0 and c1+c2>1 and fs
end end
end end
function Auxiliary.FOperationCode2(code1,code2,sub,insf) function Auxiliary.FOperationCode2(code1,code2,sub,insf)
return function(e,tp,eg,ep,ev,re,r,rp,gc,chkf) return function(e,tp,eg,ep,ev,re,r,rp,gc,chkf)
local g=eg:Filter(Card.IsCanBeFusionMaterial,nil,e:GetHandler()) local g=eg:Filter(Card.IsCanBeFusionMaterial,gc,e:GetHandler())
local tc=gc
local g1=nil
if gc then if gc then
local g1=nil if chkf~=PLAYER_NONE and Auxiliary.FConditionCheckF(gc,chkf) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL) g=g:Filter(Auxiliary.FConditionCheckF,nil,chkf)
if gc:IsHasEffect(EFFECT_FUSION_SUBSTITUTE) then
g1=g:FilterSelect(tp,Auxiliary.FConditionFilter21,1,1,gc,code1,code2)
elseif gc:IsFusionCode(code1) then
g1=g:FilterSelect(tp,Card.IsFusionCode,1,1,gc,code2)
else
g1=g:FilterSelect(tp,Card.IsFusionCode,1,1,gc,code1)
end end
Duel.SetFusionMaterial(g1) else
return local sg=g:Filter(Auxiliary.FConditionFilter22,nil,code1,code2,sub)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
if chkf~=PLAYER_NONE then g1=sg:FilterSelect(tp,Auxiliary.FConditionCheckF,1,1,nil,chkf)
else g1=sg:Select(tp,1,1,nil) end
tc=g1:GetFirst()
g:RemoveCard(tc)
end end
local sg=g:Filter(Auxiliary.FConditionFilter22,nil,code1,code2,sub) local b1=0 local b2=0 local bw=0
local g1=nil if tc:IsFusionCode(code1) then b1=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL) if tc:IsFusionCode(code2) then b2=1 end
if chkf~=PLAYER_NONE then g1=sg:FilterSelect(tp,Auxiliary.FConditionCheckF,1,1,nil,chkf) if sub and tc:IsHasEffect(EFFECT_FUSION_SUBSTITUTE) then bw=1 end
else g1=sg:Select(tp,1,1,nil) end if b1+b2+bw==1 then b1=b1*2 b2=b2*2 bw=bw*2 end
if g1:GetFirst():IsHasEffect(EFFECT_FUSION_SUBSTITUTE) then local g2=nil
sg:Remove(Card.IsHasEffect,nil,EFFECT_FUSION_SUBSTITUTE)
else sg:Remove(Card.IsFusionCode,nil,g1:GetFirst():GetCode()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local g2=sg:Select(tp,1,1,nil) if b1==2 then
g1:Merge(g2) g2=g:FilterSelect(tp,Auxiliary.FConditionFilter12,1,1,nil,code2,sub)
Duel.SetFusionMaterial(g1) elseif b2==2 then
g2=g:FilterSelect(tp,Auxiliary.FConditionFilter12,1,1,nil,code1,sub)
elseif bw==2 then
g2=g:FilterSelect(tp,Auxiliary.FConditionFilter21,1,1,nil,code1,code2)
else
g2=g:FilterSelect(tp,Auxiliary.FConditionFilter22,1,1,nil,code1,code2,sub)
end
if g1 then g2:Merge(g1) end
Duel.SetFusionMaterial(g2)
end end
end end
--Fusion monster, name + name + name --Fusion monster, name + name + name
...@@ -989,7 +1018,7 @@ end ...@@ -989,7 +1018,7 @@ end
function Auxiliary.FConditionFilterFFR(c,f1,f2,mg,minc,chkf) function Auxiliary.FConditionFilterFFR(c,f1,f2,mg,minc,chkf)
if not f1(c) then return false end if not f1(c) then return false end
if chkf==PLAYER_NONE or aux.FConditionCheckF(c,chkf) then if chkf==PLAYER_NONE or aux.FConditionCheckF(c,chkf) then
return mg:IsExists(f2,minc,c) return minc<=0 or mg:IsExists(f2,minc,c)
else else
local mg2=mg:Filter(f2,c) local mg2=mg:Filter(f2,c)
return mg2:GetCount()>=minc and mg2:IsExists(aux.FConditionCheckF,1,nil,chkf) return mg2:GetCount()>=minc and mg2:IsExists(aux.FConditionCheckF,1,nil,chkf)
...@@ -1036,7 +1065,7 @@ function Auxiliary.FOperationFunFunRep(f1,f2,minc,maxc,insf) ...@@ -1036,7 +1065,7 @@ function Auxiliary.FOperationFunFunRep(f1,f2,minc,maxc,insf)
minct=minct-1 minct=minct-1
maxct=maxct-1 maxct=maxct-1
if not f2(sg:GetFirst()) then if not f2(sg:GetFirst()) then
if maxct>0 and (minct>0 or Duel.SelectYesNo(tp,93)) then if mg1:GetCount()>0 and maxct>0 and (minct>0 or Duel.SelectYesNo(tp,93)) then
if minct<=0 then minct=1 end if minct<=0 then minct=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local sg=mg1:FilterSelect(tp,f2,minct,maxct,nil) local sg=mg1:FilterSelect(tp,f2,minct,maxct,nil)
...@@ -1061,7 +1090,7 @@ function Auxiliary.FOperationFunFunRep(f1,f2,minc,maxc,insf) ...@@ -1061,7 +1090,7 @@ function Auxiliary.FOperationFunFunRep(f1,f2,minc,maxc,insf)
mg1:Sub(sg) mg1:Sub(sg)
minct=minct-1 minct=minct-1
maxct=maxct-1 maxct=maxct-1
if maxct>0 and (minct>0 or Duel.SelectYesNo(tp,93)) then if mg1:GetCount()>0 and maxct>0 and (minct>0 or Duel.SelectYesNo(tp,93)) then
if minct<=0 then minct=1 end if minct<=0 then minct=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local sg=mg1:FilterSelect(tp,f2,minct,maxct,nil) local sg=mg1:FilterSelect(tp,f2,minct,maxct,nil)
...@@ -1080,7 +1109,7 @@ function Auxiliary.FOperationFunFunRep(f1,f2,minc,maxc,insf) ...@@ -1080,7 +1109,7 @@ function Auxiliary.FOperationFunFunRep(f1,f2,minc,maxc,insf)
minct=minct-1 minct=minct-1
maxct=maxct-1 maxct=maxct-1
end end
if maxct>0 and (minct>0 or Duel.SelectYesNo(tp,93)) then if mg:GetCount()>0 and maxct>0 and (minct>0 or Duel.SelectYesNo(tp,93)) then
if minct<=0 then minct=1 end if minct<=0 then minct=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local sg=mg:Select(tp,minct,maxct,nil) local sg=mg:Select(tp,minct,maxct,nil)
...@@ -1105,7 +1134,7 @@ function Auxiliary.FOperationFunFunRep(f1,f2,minc,maxc,insf) ...@@ -1105,7 +1134,7 @@ function Auxiliary.FOperationFunFunRep(f1,f2,minc,maxc,insf)
minct=minct-1 minct=minct-1
maxct=maxct-1 maxct=maxct-1
end end
if maxct>0 and (minct>0 or Duel.SelectYesNo(tp,93)) then if mg:GetCount()>0 and maxct>0 and (minct>0 or Duel.SelectYesNo(tp,93)) then
if minct<=0 then minct=1 end if minct<=0 then minct=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local sg=mg:Select(tp,minct,maxct,nil) local sg=mg:Select(tp,minct,maxct,nil)
......
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