Commit 72dfd4ce authored by Clara Grace Paulsen's avatar Clara Grace Paulsen Committed by GitHub

implement cancelable Ritual Summoning (#2049)

parent 55efae7c
......@@ -25,6 +25,7 @@ function c11398951.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,0,tp,LOCATION_GRAVE)
end
function c11398951.activate(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetMatchingGroup(aux.NecroValleyFilter(c11398951.mfilter),tp,LOCATION_GRAVE,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......@@ -40,9 +41,9 @@ function c11398951.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
local mat2=mat:Filter(Card.IsLocation,nil,LOCATION_GRAVE):Filter(Card.IsRace,nil,RACE_WARRIOR+RACE_FAIRY)
mat:Sub(mat2)
......
......@@ -64,6 +64,7 @@ function c13386407.activate(e,tp,eg,ep,ev,re,r,rp)
local sc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c13386407.spfilter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst()
if sc and Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)>0 then
Duel.ConfirmCards(1-tp,sc)
::cancel::
local mg=Duel.GetRitualMaterial(tp):Filter(Card.IsLocation,nil,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c13386407.RitualUltimateFilter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,c13386407.filter,e,tp,mg,nil,Card.GetLevel,"Greater",true,sc)
......@@ -80,8 +81,9 @@ function c13386407.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local lv=Card.GetLevel(tc)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,lv,"Greater")
mat=mg:SelectSubGroup(tp,c13386407.rcheck,false,1,lv,tp,tc,lv,"Greater",sc)
mat=mg:SelectSubGroup(tp,c13386407.rcheck,true,1,lv,tp,tc,lv,"Greater",sc)
aux.GCheckAdditional=nil
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
......
......@@ -28,6 +28,7 @@ function c16494704.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function c16494704.operation(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg=Duel.GetRitualMaterial(tp):Filter(Card.IsType,nil,TYPE_PENDULUM)
local sg=nil
if Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 and Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>1 then
......@@ -48,9 +49,9 @@ function c16494704.operation(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
local mat2=mat:Filter(Card.IsLocation,nil,LOCATION_EXTRA)
mat:Sub(mat2)
......
......@@ -34,6 +34,7 @@ function c17888577.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c17888577.activate(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg=Duel.GetRitualMaterial(tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,aux.RitualUltimateFilter,tp,LOCATION_HAND,0,1,1,nil,c17888577.filter,e,tp,mg,nil,Card.GetLevel,"Greater")
......@@ -47,9 +48,9 @@ function c17888577.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
local lv=mat:GetSum(Card.GetLevel)
Duel.ReleaseRitualMaterial(mat)
......
......@@ -30,6 +30,7 @@ function c20071842.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,0,tp,LOCATION_HAND+LOCATION_MZONE)
end
function c20071842.activate(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetMatchingGroup(c20071842.mfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,e)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......@@ -45,9 +46,9 @@ function c20071842.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(20071842,1))
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,8,"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,8,tp,tc,8,"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,8,tp,tc,8,"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
local ct1=mat:FilterCount(aux.IsInGroup,nil,mg1)
local ct2=mat:FilterCount(aux.IsInGroup,nil,mg2)
......
......@@ -55,6 +55,7 @@ function c22398665.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function c22398665.operation(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg=Duel.GetRitualMaterialEx(tp):Filter(Card.IsRace,nil,RACE_MACHINE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c22398665.RitualUltimateFilter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,nil,e,tp,mg,nil,aux.GetCappedAttack,"Greater")
......@@ -71,9 +72,9 @@ function c22398665.operation(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=c22398665.RitualCheckAdditional(tc,tc:GetAttack(),"Greater")
local mat=mg:SelectSubGroup(tp,c22398665.RitualCheck,false,1,#mg,tp,tc,tc:GetAttack(),"Greater")
local mat=mg:SelectSubGroup(tp,c22398665.RitualCheck,true,1,#mg,tp,tc,tc:GetAttack(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
......
......@@ -37,6 +37,7 @@ function c28429121.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c28429121.activate(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg1=Duel.GetRitualMaterial(tp)
mg1:Remove(Card.IsLocation,nil,LOCATION_HAND)
local mg2=Duel.GetMatchingGroup(c28429121.mfilter,tp,0,LOCATION_MZONE,nil,e)
......@@ -53,9 +54,9 @@ function c28429121.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
......
......@@ -37,6 +37,7 @@ function c31002402.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c31002402.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
::cancel::
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetMatchingGroup(c31002402.mfilter,tp,LOCATION_EXTRA,0,nil)
local g1=Duel.GetMatchingGroup(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,nil,c31002402.filter,e,tp,mg1,nil,Card.GetLevel,"Equal")
......@@ -54,13 +55,16 @@ function c31002402.activate(e,tp,eg,ep,ev,re,r,rp)
if g1:IsContains(tc) and (not g2:IsContains(tc) or not Duel.SelectYesNo(tp,aux.Stringid(31002402,0))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
aux.GCheckAdditional=nil
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local mat=mg2:FilterSelect(tp,Card.IsLevel,1,1,nil,tc:GetLevel())
local matc=mg2:Filter(Card.IsLevel,nil,tc:GetLevel()):SelectUnselect(nil,tp,false,true,1,1)
if not matc then goto cancel end
local mat=Group.FromCards(matc)
tc:SetMaterial(mat)
Duel.SendtoGrave(mat,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL)
end
......
......@@ -21,6 +21,7 @@ function c36350300.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c36350300.activate(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg=Duel.GetRitualMaterial(tp):Filter(c36350300.matfilter,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.RitualUltimateFilter,tp,LOCATION_DECK,0,1,1,nil,nil,e,tp,mg,nil,Card.GetLevel,"Equal")
......@@ -34,9 +35,9 @@ function c36350300.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
......
......@@ -67,6 +67,7 @@ function c36849933.rstg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c36849933.rsop(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local c=e:GetHandler()
local mg=Duel.GetRitualMaterial(tp)
if c:IsControler(1-tp) or not c:IsRelateToEffect(e) or not mg:IsContains(c) then return end
......@@ -85,11 +86,11 @@ function c36849933.rsop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
Duel.SetSelectedCard(c)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then
if not mat then
aux.RCheckAdditional=nil
return
goto cancel
end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
......
......@@ -39,6 +39,7 @@ function c36982581.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c36982581.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
::cancel::
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetReleaseGroup(1-tp):Filter(c36982581.cfilter,nil,e,1-tp)
local g1=Duel.GetMatchingGroup(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,nil,c36982581.rfilter1,e,tp,mg1,nil,Card.GetLevel,"Equal")
......@@ -60,13 +61,16 @@ function c36982581.activate(e,tp,eg,ep,ev,re,r,rp)
if g1:IsContains(tc) and (not g2 or (g2:IsContains(tc) and not Duel.SelectYesNo(tp,aux.Stringid(36982581,0)))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
aux.GCheckAdditional=nil
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat=mg2:Select(tp,1,1,nil)
local matc=mg2:SelectUnselect(nil,tp,false,true,1,1)
if not matc then goto cancel end
local mat=Group.FromCards(matc)
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
end
......
......@@ -42,6 +42,7 @@ function c38784726.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,0,tp,LOCATION_GRAVE)
end
function c38784726.activate(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg=Duel.GetRitualMaterial(tp)
local mg2=nil
if Duel.IsExistingMatchingCard(c38784726.cfilter,tp,LOCATION_MZONE,0,1,nil) then
......@@ -62,9 +63,9 @@ function c38784726.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
local mat2=mat:Filter(Card.IsLocation,nil,LOCATION_GRAVE)
mat:Sub(mat2)
......
......@@ -38,6 +38,7 @@ function c42158279.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end
function c42158279.activate(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg=Duel.GetRitualMaterial(tp):Filter(c42158279.matfilter,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.RitualUltimateFilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,c42158279.filter,e,tp,mg,nil,Card.GetLevel,"Equal")
......@@ -51,9 +52,9 @@ function c42158279.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
......
......@@ -30,18 +30,23 @@ function c45948430.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function c45948430.check(g)
return aux.dabcheck(g) and g:GetClassCount(Card.GetLocation)==#g and g:GetSum(Card.GetLevel)==8
end
function c45948430.mfilter(c,rc)
return c:IsLevelBelow(7) and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK) and c:IsAbleToGrave() and c:IsCanBeRitualMaterial(rc)
end
function c45948430.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
::cancel::
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local rg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c45948430.filter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp)
local rc=rg:GetFirst()
if rc then
local mg=Duel.GetMatchingGroup(c45948430.mfilter,tp,LOCATION_DECK+LOCATION_HAND,0,nil,rc)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local mat=Duel.SelectMatchingCard(tp,c45948430.matfilter1,tp,LOCATION_HAND,0,1,1,rc,tp,rc)
local mc=mat:GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local mat2=Duel.SelectMatchingCard(tp,c45948430.matfilter2,tp,LOCATION_DECK,0,1,1,nil,mc:GetLevel(),mc:GetAttribute(),rc)
mat:Merge(mat2)
local mat=mg:SelectSubGroup(tp,c45948430.check,true,2,2)
if not mat then goto cancel end
rc:SetMaterial(mat)
Duel.SendtoGrave(mat,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL)
Duel.BreakEffect()
......
......@@ -30,6 +30,7 @@ function c46052429.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c46052429.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
::cancel::
local mg=Duel.GetMatchingGroup(c46052429.matfilter,tp,LOCATION_DECK,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,c46052429.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp,mg)
......@@ -38,8 +39,12 @@ function c46052429.activate(e,tp,eg,ep,ev,re,r,rp)
if tc.mat_filter then
mg=mg:Filter(tc.mat_filter,nil,tp)
end
local lv=tc:GetLevel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),1,99,tc)
aux.GCheckAdditional=function(sg) return sg:GetSum(Card.GetRitualLevel,tc)<=lv end
local mat=mg:SelectSubGroup(tp,aux.RitualCheckEqual,true,1,99,tc,lv)
aux.GCheckAdditional=nil
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.SendtoGrave(mat,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL)
Duel.BreakEffect()
......
......@@ -59,9 +59,18 @@ function c51124303.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c51124303.RitualCheck(g,lv)
return g:GetSum(Card.GetLevel)==lv
end
function c51124303.RitualCheckAdditional(lv)
return function(g)
return g:GetSum(Card.GetLevel)<=lv
end
end
function c51124303.activate(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<0 then return end
::cancel::
local mg=Duel.GetRitualMaterial(tp)
if ft>0 then
local mg2=Duel.GetMatchingGroup(c51124303.mfilter,tp,LOCATION_EXTRA,0,nil)
......@@ -80,8 +89,8 @@ function c51124303.activate(e,tp,eg,ep,ev,re,r,rp)
local b2=sg:CheckWithSumEqual(Card.GetLevel,mc:GetLevel(),1,ft)
if b1 and (not b2 or Duel.SelectYesNo(tp,aux.Stringid(51124303,0))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:FilterSelect(tp,c51124303.rfilter,1,1,nil,mc)
local tc=tg:GetFirst()
local tc=sg:Filter(c51124303.rfilter,nil,mc):SelectUnselect(nil,tp,false,true,1,1)
if not tc then goto cancel end
tc:SetMaterial(mat)
if not mc:IsLocation(LOCATION_EXTRA) then
Duel.ReleaseRitualMaterial(mat)
......@@ -92,8 +101,12 @@ function c51124303.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
else
local lv=mc:GetLevel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:SelectWithSumEqual(tp,Card.GetLevel,mc:GetLevel(),1,ft)
aux.GCheckAdditional=c51124303.RitualCheckAdditional(lv)
local tg=sg:SelectSubGroup(tp,c51124303.RitualCheck,true,1,ft,lv)
aux.GCheckAdditional=nil
if not tg then goto cancel end
local tc=tg:GetFirst()
while tc do
tc:SetMaterial(mat)
......
......@@ -85,6 +85,7 @@ function c51510279.activate(e,tp,eg,ep,ev,re,r,rp)
end
tc:CompleteProcedure()
elseif opval[op]==2 then
::rcancel::
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=rsg:Select(tp,1,1,nil):GetFirst()
......@@ -96,9 +97,9 @@ function c51510279.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=rmg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=rmg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto rcancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
......
......@@ -100,6 +100,7 @@ function c59514116.activate(e,tp,eg,ep,ev,re,r,rp)
end
aux.FCheckAdditional=nil
elseif e:GetLabel()==1 then
::rcancel::
local mg=Duel.GetRitualMaterial(tp)
aux.RCheckAdditional=c59514116.rcheck
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......@@ -114,11 +115,11 @@ function c59514116.activate(e,tp,eg,ep,ev,re,r,rp)
end
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then
if not mat then
aux.RCheckAdditional=nil
return
goto rcancel
end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
......
......@@ -59,6 +59,7 @@ function c63056220.rstg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c63056220.rsop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
::cancel::
local mg=Duel.GetRitualMaterial(tp)
if c:IsControler(1-tp) or not c:IsRelateToEffect(e) or not mg:IsContains(c) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......@@ -76,11 +77,11 @@ function c63056220.rsop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
Duel.SetSelectedCard(c)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then
if not mat then
aux.RCheckAdditional=nil
return
goto cancel
end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
......
......@@ -71,6 +71,7 @@ function c69003792.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c69003792.spop(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg=Duel.GetRitualMaterial(tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,c69003792.RitualUltimateFilter,tp,LOCATION_DECK,0,1,1,nil,c69003792.rfilter,e,tp,mg,nil,Card.GetLevel,"Equal")
......@@ -87,9 +88,9 @@ function c69003792.spop(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel()*2,"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel()*2,tp,tc,tc:GetLevel()*2,"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel()*2,tp,tc,tc:GetLevel()*2,"Equal")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
......
......@@ -36,6 +36,7 @@ function c7986397.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function c7986397.activate(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local m=Duel.GetRitualMaterial(tp)
local dg=Duel.GetMatchingGroup(c7986397.dfilter,tp,LOCATION_DECK,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......@@ -53,12 +54,12 @@ function c7986397.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then
if not mat then
aux.RCheckAdditional=nil
aux.RGCheckAdditional=nil
return
goto cancel
end
tc:SetMaterial(mat)
local dmat=mat:Filter(Card.IsLocation,nil,LOCATION_DECK)
......
......@@ -50,6 +50,7 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg1=Duel.GetRitualMaterial(tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.RitualUltimateFilter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,s.filter,e,tp,mg1,nil,Card.GetLevel,"Greater")
......@@ -63,9 +64,9 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
......
......@@ -36,6 +36,7 @@ function c85327820.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
end
function c85327820.activate(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg=Duel.GetRitualMaterial(tp):Filter(Card.IsSetCard,nil,0x135)
local mg2=nil
if e:GetLabel()==1 then
......@@ -56,9 +57,9 @@ function c85327820.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
......
......@@ -59,6 +59,7 @@ function c90444325.rstg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c90444325.rsop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
::cancel::
local mg=Duel.GetRitualMaterial(tp)
if c:IsControler(1-tp) or not c:IsRelateToEffect(e) or not mg:IsContains(c) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......@@ -76,11 +77,11 @@ function c90444325.rsop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
Duel.SetSelectedCard(c)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then
if not mat then
aux.RCheckAdditional=nil
return
goto cancel
end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
......
......@@ -25,6 +25,7 @@ function c93754402.filter(c,e,tp)
return c:IsRace(RACE_BEASTWARRIOR)
end
function c93754402.activate(e,tp,eg,ep,ev,re,r,rp)
::cancel::
local mg=Duel.GetRitualMaterial(tp)
local g=Duel.GetMatchingGroup(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,nil,c93754402.filter,e,tp,mg,nil,Card.GetLevel,"Greater")
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(93754402,1)) then
......@@ -38,9 +39,9 @@ function c93754402.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
......
......@@ -112,6 +112,8 @@ function c99426088.activate(e,tp,eg,ep,ev,re,r,rp)
aux.RCheckAdditional=c99426088.frcheck
aux.RGCheckAdditional=c99426088.rgcheck
local rsg=Duel.GetMatchingGroup(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,nil,c99426088.rfilter,e,tp,rmg1,rmg2,Card.GetLevel,"Greater")
aux.RCheckAdditional=nil
aux.RGCheckAdditional=nil
local off=1
local ops={}
local opval={}
......@@ -152,6 +154,7 @@ function c99426088.activate(e,tp,eg,ep,ev,re,r,rp)
end
tc:CompleteProcedure()
else
::rcancel::
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=rsg:Select(tp,1,1,nil):GetFirst()
aux.RCheckAdditional=c99426088.frcheck
......@@ -165,12 +168,12 @@ function c99426088.activate(e,tp,eg,ep,ev,re,r,rp)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=rmg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
local mat=rmg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then
if not mat then
aux.RCheckAdditional=nil
aux.RGCheckAdditional=nil
return
goto rcancel
end
tc:SetMaterial(mat)
local dmat=mat:Filter(Card.IsLocation,nil,LOCATION_DECK)
......
......@@ -1740,6 +1740,7 @@ function Auxiliary.RitualUltimateTarget(filter,level_function,greater_or_equal,s
end
function Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equal,summon_location,grave_filter,mat_filter,extra_operation)
return function(e,tp,eg,ep,ev,re,r,rp)
::RitualUltimateSelectStart::
local mg=Duel.GetRitualMaterial(tp)
if mat_filter then mg=mg:Filter(mat_filter,nil,e,tp) end
local exg=nil
......@@ -1763,8 +1764,9 @@ function Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equa
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local lv=level_function(tc)
Auxiliary.GCheckAdditional=Auxiliary.RitualCheckAdditional(tc,lv,greater_or_equal)
mat=mg:SelectSubGroup(tp,Auxiliary.RitualCheck,false,1,lv,tp,tc,lv,greater_or_equal)
mat=mg:SelectSubGroup(tp,Auxiliary.RitualCheck,true,1,lv,tp,tc,lv,greater_or_equal)
Auxiliary.GCheckAdditional=nil
if not mat then goto RitualUltimateSelectStart end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
......
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