Commit fb4df35e authored by Chrono-Genex's avatar Chrono-Genex Committed by GitHub

fix Spell Gear (#1752)

parent 5f77dc4f
...@@ -15,40 +15,14 @@ function c313513.cfilter(c) ...@@ -15,40 +15,14 @@ function c313513.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x7) and c:IsAbleToGraveAsCost() return c:IsFaceup() and c:IsSetCard(0x7) and c:IsAbleToGraveAsCost()
end end
function c313513.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c313513.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ct=-ft+1
local tg=Duel.GetMatchingGroup(c313513.cfilter,tp,LOCATION_ONFIELD,0,nil) local tg=Duel.GetMatchingGroup(c313513.cfilter,tp,LOCATION_ONFIELD,0,nil)
if chk==0 then if chk==0 then
e:SetLabel(1) e:SetLabel(1)
return ct<=3 and tg:GetCount()>=3 return tg:CheckSubGroup(aux.mzctcheck,3,3,tp)
and (ct<=0 or tg:IsExists(Card.IsLocation,ct,nil,LOCATION_MZONE))
end
local g=nil
if ct>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
g=tg:FilterSelect(tp,Card.IsLocation,ct,ct,nil,LOCATION_MZONE)
if ct<3 then
tg:Sub(g)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g2=tg:Select(tp,3-ct,3-ct,nil)
g:Merge(g2)
end
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
g=tg:Select(tp,3,3,nil)
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=tg:SelectSubGroup(tp,aux.mzctcheck,false,3,3,tp)
Duel.SendtoGrave(g,REASON_COST) Duel.SendtoGrave(g,REASON_COST)
if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetReset(RESET_SELF_TURN+RESET_PHASE+PHASE_END,2)
e1:SetTargetRange(1,0)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_MSET)
Duel.RegisterEffect(e2,tp)
end end
function c313513.filter(c,e,tp) function c313513.filter(c,e,tp)
return c:IsCode(83104731) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) return c:IsCode(83104731) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
...@@ -64,28 +38,32 @@ end ...@@ -64,28 +38,32 @@ end
function c313513.dfilter(c) function c313513.dfilter(c)
return c:IsFacedown() or not c:IsCode(83104731) return c:IsFacedown() or not c:IsCode(83104731)
end end
function c313513.fselect(g)
return g:GetClassCount(Card.GetLocation)==g:GetCount()
end
function c313513.activate(e,tp,eg,ep,ev,re,r,rp) function c313513.activate(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local ft=math.min((Duel.GetLocationCount(tp,LOCATION_MZONE)),2)
if ft<=0 then return end local g=Duel.GetMatchingGroup(c313513.filter,tp,LOCATION_HAND+LOCATION_DECK,0,nil,e,tp)
local ct=0 if ft>0 and g:GetCount()>0 then
if ft==1 then if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c313513.filter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp) local sg=g:SelectSubGroup(tp,c313513.fselect,false,1,ft)
ct=Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) if sg and Duel.SpecialSummon(sg,0,tp,tp,true,false,POS_FACEUP)>0 then
else local dg=Duel.GetMatchingGroup(c313513.dfilter,tp,LOCATION_MZONE,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) if dg:GetCount()>0 then
local g1=Duel.SelectMatchingCard(tp,c313513.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp) Duel.BreakEffect()
if g1:GetCount()>0 and Duel.SpecialSummonStep(g1:GetFirst(),0,tp,tp,true,false,POS_FACEUP) then ct=ct+1 end Duel.Destroy(dg,REASON_EFFECT)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) end
local g2=Duel.SelectMatchingCard(tp,c313513.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g2:GetCount()>0 and Duel.SpecialSummonStep(g2:GetFirst(),0,tp,tp,true,false,POS_FACEUP) then ct=ct+1 end
Duel.SpecialSummonComplete()
end
if ct>0 then
local dg=Duel.GetMatchingGroup(c313513.dfilter,tp,LOCATION_MZONE,0,nil)
if dg:GetCount()>0 then
Duel.BreakEffect()
Duel.Destroy(dg,REASON_EFFECT)
end end
end end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetReset(RESET_SELF_TURN+RESET_PHASE+PHASE_END,2)
e1:SetTargetRange(1,0)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_MSET)
Duel.RegisterEffect(e2,tp)
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