Commit ed952af1 authored by Tachibana's avatar Tachibana

ndyd

parent 1b7bf044
...@@ -21,84 +21,56 @@ end ...@@ -21,84 +21,56 @@ end
function cm.dfilter(c) function cm.dfilter(c)
return c:IsAttack(1550) and c:IsDefense(1050) and c:IsLevelAbove(1) and c:IsAbleToGrave() return c:IsAttack(1550) and c:IsDefense(1050) and c:IsLevelAbove(1) and c:IsAbleToGrave()
end end
function cm.filter(c,e,tp,m,ft) function cm.filter(c,e,tp)
if not c:IsType(TYPE_PENDULUM) or bit.band(c:GetType(),0x81)~=0x81 return c:IsType(TYPE_PENDULUM)
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m:Filter(Card.IsCanBeRitualMaterial,c,c)
local dg=Duel.GetMatchingGroup(cm.dfilter,tp,LOCATION_DECK,0,nil)
if ft>0 then
return mg:CheckWithSumEqual(Card.GetRitualLevel,c:GetLevel(),1,99,c)
or dg:IsExists(cm.dlvfilter,1,nil,tp,mg,c)
else
return ft>-1 and mg:IsExists(cm.mfilterf,1,nil,tp,mg,dg,c)
end
end end
function cm.mfilterf(c,tp,mg,dg,rc) function cm.rcheck(tp,g,c)
if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5 then return g:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=1
Duel.SetSelectedCard(c)
return mg:CheckWithSumEqual(Card.GetRitualLevel,rc:GetLevel(),0,99,rc)
or dg:IsExists(cm.dlvfilter,1,nil,tp,mg,rc,c)
else return false end
end end
function cm.dlvfilter(c,tp,mg,rc,mc) function cm.rgcheck(g)
Duel.SetSelectedCard(Group.FromCards(c,mc)) return g:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=1
return mg:CheckWithSumEqual(Card.GetRitualLevel,rc:GetLevel(),0,99,rc)
end end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local mg=Duel.GetRitualMaterial(tp) local mg=Duel.GetRitualMaterial(tp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local dg=Duel.GetMatchingGroup(cm.dfilter,tp,LOCATION_DECK,0,nil)
return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp,mg,ft) aux.RCheckAdditional=cm.rcheck
aux.RGCheckAdditional=cm.rgcheck
local res=Duel.IsExistingMatchingCard(aux.RitualUltimateFilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,cm.filter,e,tp,mg,dg,Card.GetLevel,"Equal")
aux.RCheckAdditional=nil
aux.RGCheckAdditional=nil
return res
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end end
function cm.activate(e,tp,eg,ep,ev,re,r,rp) function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local m=Duel.GetRitualMaterial(tp) local m=Duel.GetRitualMaterial(tp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local dg=Duel.GetMatchingGroup(cm.dfilter,tp,LOCATION_DECK,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.filter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp,m,ft) aux.RCheckAdditional=cm.rcheck
aux.RGCheckAdditional=cm.rgcheck
local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(aux.RitualUltimateFilter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,cm.filter,e,tp,m,dg,Card.GetLevel,"Equal")
local tc=tg:GetFirst() local tc=tg:GetFirst()
if tc then if tc then
local mat,dmat
local mg=m:Filter(Card.IsCanBeRitualMaterial,tc,tc) local mg=m:Filter(Card.IsCanBeRitualMaterial,tc,tc)
local dg=Duel.GetMatchingGroup(cm.dfilter,tp,LOCATION_DECK,0,nil) mg:Merge(dg)
if ft>0 then if tc.mat_filter then
local b1=dg:IsExists(cm.dlvfilter,1,nil,tp,mg,tc) mg=mg:Filter(tc.mat_filter,tc,tp)
local b2=mg:CheckWithSumEqual(Card.GetRitualLevel,tc:GetLevel(),1,99,tc)
if b1 and (not b2 or Duel.SelectYesNo(tp,aux.Stringid(m,0))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
dmat=dg:FilterSelect(tp,cm.dlvfilter,1,1,nil,tp,mg,tc)
Duel.SetSelectedCard(dmat)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc)
mat:Merge(dmat)
else else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) mg:RemoveCard(tc)
mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),1,99,tc)
end end
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:FilterSelect(tp,cm.mfilterf,1,1,nil,tp,mg,dg,tc)
local b1=dg:IsExists(cm.dlvfilter,1,nil,tp,mg,tc,mat:GetFirst())
Duel.SetSelectedCard(mat)
local b2=mg:CheckWithSumEqual(Card.GetRitualLevel,tc:GetLevel(),0,99,tc)
if b1 and (not b2 or Duel.SelectYesNo(tp,aux.Stringid(m,0))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
dmat=dg:FilterSelect(tp,cm.dlvfilter,1,1,nil,tp,mg,tc,mat:GetFirst())
mat:Merge(dmat)
Duel.SetSelectedCard(mat)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat2=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc) aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Equal")
mat:Merge(mat2) local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
else aux.GCheckAdditional=nil
Duel.SetSelectedCard(mat) if not mat or mat:GetCount()==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) aux.RCheckAdditional=nil
local mat2=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc) aux.RGCheckAdditional=nil
mat:Merge(mat2) return
end
end end
tc:SetMaterial(mat) tc:SetMaterial(mat)
if dmat then local dmat=mat:Filter(Card.IsLocation,nil,LOCATION_DECK)
if dmat:GetCount()>0 then
mat:Sub(dmat) mat:Sub(dmat)
Duel.SendtoGrave(dmat,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL) Duel.SendtoGrave(dmat,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL)
end end
...@@ -111,13 +83,15 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -111,13 +83,15 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1) tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(e:GetHandler()) local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE) e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_REDIRECT) e2:SetReset(RESET_EVENT+RESETS_REDIRECT)
e2:SetValue(LOCATION_REMOVED) e2:SetValue(LOCATION_REMOVED)
tc:RegisterEffect(e2) tc:RegisterEffect(e2,true)
end end
aux.RCheckAdditional=nil
aux.RGCheckAdditional=nil
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