Commit 6a3fbca0 authored by fallenstardust's avatar fallenstardust

fix 重融合

parent ad19f93c
...@@ -12,9 +12,14 @@ function s.initial_effect(c) ...@@ -12,9 +12,14 @@ function s.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
s.fusion_effect=true s.fusion_effect=true
function s.fcheck(tp,sg,fc) function s.fcheck(ct)
local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE) return function(tp,sg,fc)
return #sg>=3 and sg:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA)<=ct if ct>0 and sg:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA)>ct then
return false
end
return #sg>=3
end
end end
function s.filter0(c) function s.filter0(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToRemove() return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToRemove()
...@@ -27,11 +32,14 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -27,11 +32,14 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local chkf=tp local chkf=tp
local mg=Duel.GetFusionMaterial(tp):Filter(aux.NOT(Card.IsImmuneToEffect),nil,e) local mg=Duel.GetFusionMaterial(tp):Filter(aux.NOT(Card.IsImmuneToEffect),nil,e)
local mg2=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_EXTRA,0,nil) local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)
if mg2:GetCount()>0 then if ct>0 then
mg:Merge(mg2) local mg2=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_EXTRA,0,nil)
if mg2:GetCount()>0 then
mg:Merge(mg2)
end
end end
aux.FGoalCheckAdditional=s.fcheck aux.FGoalCheckAdditional=s.fcheck(ct)
local res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg,nil,chkf) local res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg,nil,chkf)
aux.FGoalCheckAdditional=nil aux.FGoalCheckAdditional=nil
if not res then if not res then
...@@ -49,11 +57,14 @@ end ...@@ -49,11 +57,14 @@ end
function s.activate(e,tp,eg,ep,ev,re,r,rp) function s.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(aux.NOT(Card.IsImmuneToEffect),nil,e) local mg1=Duel.GetFusionMaterial(tp):Filter(aux.NOT(Card.IsImmuneToEffect),nil,e)
local mg2=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_EXTRA,0,nil) local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)
if mg2:GetCount()>0 then if ct>0 then
mg1:Merge(mg2) local mg2=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_EXTRA,0,nil)
if mg2:GetCount()>0 then
mg1:Merge(mg2)
end
end end
aux.FGoalCheckAdditional=s.fcheck aux.FGoalCheckAdditional=s.fcheck(ct)
local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
aux.FGoalCheckAdditional=nil aux.FGoalCheckAdditional=nil
local mg2=nil local mg2=nil
...@@ -81,13 +92,12 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -81,13 +92,12 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.Remove(rg,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.Remove(rg,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect() Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummonStep(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
elseif ce then elseif ce then
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf) local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
local fop=ce:GetOperation() local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2) fop(ce,e,tp,tc,mat2)
end end
tc:CompleteProcedure()
local exmat=tc:GetMaterial():Filter(Card.IsPreviousLocation,nil,LOCATION_EXTRA) local exmat=tc:GetMaterial():Filter(Card.IsPreviousLocation,nil,LOCATION_EXTRA)
if #exmat>0 then if #exmat>0 then
local dam=exmat:GetSum(Card.GetAttack) local dam=exmat:GetSum(Card.GetAttack)
...@@ -98,4 +108,6 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -98,4 +108,6 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.SetLP(tp,0) Duel.SetLP(tp,0)
end end
end end
Duel.SpecialSummonComplete()
tc:CompleteProcedure()
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