Commit c9e1a046 authored by Tianchenglipu's avatar Tianchenglipu

Update utility.lua

parent 9c72d0c3
......@@ -1017,14 +1017,14 @@ function Auxiliary.FConditionFilterCFR(c,code,sub,f,mg,minc)
return (c:IsCode(code) or (sub and c:IsHasEffect(EFFECT_FUSION_SUBSTITUTE))) and mg:IsExists(f,minc,c)
end
function Auxiliary.FConditionCodeFunRep(code,f,minc,maxc,sub,insf)
return function(e,g,gc,chkf)
if g==nil then return insf end
local mg=g:Filter(Card.IsCanBeFusionMaterial,nil,e:GetHandler())
return function(e,eg,gc,chkf)
if eg==nil then return insf end
local g=eg:Filter(Card.IsCanBeFusionMaterial,nil,e:GetHandler())
if gc then return (gc:IsCode(code) or sub and gc:IsHasEffect(EFFECT_FUSION_SUBSTITUTE))
and mg:IsExists(f,minc,gc)
and g:IsExists(f,minc,gc)
end
local mg1=mg:Filter(aux.FConditionFilterCFR,nil,code,sub,f,mg,minc)
local mg2=mg:Filter(f,nil,minc)
local mg1=g:Filter(aux.FConditionFilterCFR,nil,code,sub,f,g,minc)
local mg2=g:Filter(f,nil)
if chkf~=PLAYER_NONE then return mg1:GetCount()>=1
and mg1:FilterCount(Card.IsOnField,nil)+mg2:FilterCount(Card.IsOnField,nil)~=0
else return mg1:GetCount()>=1 end
......@@ -1041,17 +1041,17 @@ function Auxiliary.FOperationCodeFunRep(code,f,minc,maxc,sub,insf)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local mg1=eg:FilterSelect(tp,aux.FConditionFilterCFR,1,1,nil,code,sub,f,eg,minc)
local g2=eg:Filter(f,mg1:GetFirst())
local offset=false
local offset=0
if chkf~=PLAYER_NONE and not mg1:GetFirst():IsOnField() then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local mg3=g2:FilterSelect(tp,Card.IsOnField,1,1,nil)
mg1:Merge(mg3)
g2:Sub(mg3)
offset=true
offset=-1
end
if offset and (maxc-1<1 or minc-1<1 and not Duel.SelectYesNo(tp,93)) then return end
if offset~=0 and (maxc-1<1 or minc-1<1 and not Duel.SelectYesNo(tp,93)) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local mg2=g2:Select(tp,minc-1,maxc-1,nil)
local mg2=g2:Select(tp,minc+offset,maxc+offset,nil)
mg1:Merge(mg2)
Duel.SetFusionMaterial(mg1)
end
......@@ -1071,12 +1071,12 @@ function Auxiliary.FConditionFilterFFR(c,f1,f2,mg,minc)
return f1(c) and mg:IsExists(f2,minc,c)
end
function Auxiliary.FConditionFunFunRep(f1,f2,minc,maxc,insf)
return function(e,g,gc,chkf)
if g==nil then return insf end
local mg=g:Filter(Card.IsCanBeFusionMaterial,nil,e:GetHandler())
if gc then return f1(gc) and mg:IsExists(f2,minc,gc) end
local mg1=mg:Filter(aux.FConditionFilterFFR,nil,f1,f2,mg,minc)
local mg2=mg:Filter(f2,nil,minc)
return function(e,eg,gc,chkf)
if eg==nil then return insf end
local g=eg:Filter(Card.IsCanBeFusionMaterial,nil,e:GetHandler())
if gc then return f1(gc) and g:IsExists(f2,minc,gc) end
local mg1=g:Filter(aux.FConditionFilterFFR,nil,f1,f2,g,minc)
local mg2=g:Filter(f2,nil)
if chkf~=PLAYER_NONE then return mg1:GetCount()>=1
and mg1:FilterCount(Card.IsOnField,nil)+mg2:FilterCount(Card.IsOnField,nil)~=0
else return mg1:GetCount()>=1 end
......@@ -1093,17 +1093,17 @@ function Auxiliary.FOperationFunFunRep(f1,f2,minc,maxc,insf)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local mg1=eg:FilterSelect(tp,aux.FConditionFilterFFR,1,1,nil,f1,f2,eg,minc)
local g2=eg:Filter(f2,mg1:GetFirst())
local offset=false
local offset=0
if chkf~=PLAYER_NONE and not mg1:GetFirst():IsOnField() then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local mg3=g2:FilterSelect(tp,Card.IsOnField,1,1,nil)
mg1:Merge(mg3)
g2:Sub(mg3)
offset=true
offset=-1
end
if offset and (maxc-1<1 or minc-1<1 and not Duel.SelectYesNo(tp,93)) then return end
if offset~=0 and (maxc-1<1 or minc-1<1 and not Duel.SelectYesNo(tp,93)) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local mg2=g2:Select(tp,minc-1,maxc-1,nil)
local mg2=g2:Select(tp,minc+offset,maxc+offset,nil)
mg1:Merge(mg2)
Duel.SetFusionMaterial(mg1)
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