Commit a6d417bd authored by nanahira's avatar nanahira

merge all common ritual procs

parent 4d3dd59a
--影霊衣の降魔鏡 --影霊衣の降魔鏡
function c14735698.initial_effect(c) function c14735698.initial_effect(c)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=aux.AddRitualProcEqual2(c,c14735698.filter,nil,c14735698.filter)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,14735698) e1:SetCountLimit(1,14735698)
e1:SetTarget(c14735698.target)
e1:SetOperation(c14735698.activate)
c:RegisterEffect(e1)
--search --search
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
...@@ -20,77 +14,8 @@ function c14735698.initial_effect(c) ...@@ -20,77 +14,8 @@ function c14735698.initial_effect(c)
e2:SetOperation(c14735698.thop) e2:SetOperation(c14735698.thop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function c14735698.filter(c,e,tp,m1,m2,ft) function c14735698.filter(c)
if not c:IsSetCard(0xb4) or bit.band(c:GetType(),0x81)~=0x81 return c:IsSetCard(0xb4)
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c)
mg:Merge(m2)
if c:IsCode(21105106) then return c:ritual_custom_condition(mg,ft) end
if c.mat_filter then
mg=mg:Filter(c.mat_filter,nil)
end
if ft>0 then
return mg:CheckWithSumEqual(Card.GetRitualLevel,c:GetLevel(),1,99,c)
else
return ft>-1 and mg:IsExists(c14735698.mfilterf,1,nil,tp,mg,c)
end
end
function c14735698.mfilterf(c,tp,mg,rc)
if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5 then
Duel.SetSelectedCard(c)
return mg:CheckWithSumEqual(Card.GetRitualLevel,rc:GetLevel(),0,99,rc)
else return false end
end
function c14735698.mfilter(c)
return c:GetLevel()>0 and c:IsSetCard(0xb4) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemove()
end
function c14735698.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetMatchingGroup(c14735698.mfilter,tp,LOCATION_GRAVE,0,nil)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return Duel.IsExistingMatchingCard(c14735698.filter,tp,LOCATION_HAND,0,1,nil,e,tp,mg1,mg2,ft)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_GRAVE)
end
function c14735698.activate(e,tp,eg,ep,ev,re,r,rp)
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetMatchingGroup(c14735698.mfilter,tp,LOCATION_GRAVE,0,nil)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,c14735698.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp,mg1,mg2,ft)
local tc=tg:GetFirst()
if tc then
local mg=mg1:Filter(Card.IsCanBeRitualMaterial,tc,tc)
mg:Merge(mg2)
if tc:IsCode(21105106) then
tc:ritual_custom_operation(mg)
local mat=tc:GetMaterial()
Duel.ReleaseRitualMaterial(mat)
else
if tc.mat_filter then
mg=mg:Filter(tc.mat_filter,nil)
end
local mat=nil
if ft>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),1,99,tc)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:FilterSelect(tp,c14735698.mfilterf,1,1,nil,tp,mg,tc)
Duel.SetSelectedCard(mat)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat2=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc)
mat:Merge(mat2)
end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
end
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
end
end end
function c14735698.thcon(e,tp,eg,ep,ev,re,r,rp) function c14735698.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0
......
...@@ -31,8 +31,8 @@ end ...@@ -31,8 +31,8 @@ end
function c21105106.splimit(e,se,sp,st) function c21105106.splimit(e,se,sp,st)
return e:GetHandler():IsLocation(LOCATION_HAND) and bit.band(st,SUMMON_TYPE_RITUAL)==SUMMON_TYPE_RITUAL return e:GetHandler():IsLocation(LOCATION_HAND) and bit.band(st,SUMMON_TYPE_RITUAL)==SUMMON_TYPE_RITUAL
end end
function c21105106.mat_filter(c) function c21105106.mat_filter(c,tp)
return false return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp)
end end
function c21105106.discon(e,tp,eg,ep,ev,re,r,rp) function c21105106.discon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 return Duel.GetCurrentPhase()==PHASE_MAIN1
...@@ -90,41 +90,6 @@ function c21105106.rmop(e,tp,eg,ep,ev,re,r,rp) ...@@ -90,41 +90,6 @@ function c21105106.rmop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE,aux.ExceptThisCard(e)) local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD+LOCATION_GRAVE,LOCATION_ONFIELD+LOCATION_GRAVE,aux.ExceptThisCard(e))
Duel.Remove(g,POS_FACEUP,REASON_EFFECT) Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end end
function c21105106.filter(c,tp) function c21105106.mat_group_check(g)
return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) return g:GetClassCount(Card.GetRace)==3
end
function c21105106.ritual_custom_condition(c,mg,ft,greater)
--ft is kept for compatablity
local tp=c:GetControler()
local g=mg:Filter(c21105106.filter,c,tp)
local sg=Group.CreateGroup()
return g:IsExists(c21105106.rselect,1,nil,tp,sg,g,c,greater)
end
function c21105106.rselect(c,tp,sg,mg,rc,greater)
sg:AddCard(c)
local res=#sg==3 and c21105106.rgoal(tp,sg,rc,greater)
or #sg<3 and mg:IsExists(c21105106.rselect,1,sg,tp,sg,mg,rc,greater)
sg:RemoveCard(c)
return res
end
function c21105106.rgoal(tp,sg,rc,greater)
if not (#sg==3 and Duel.GetMZoneCount(tp,sg,tp)>0 and sg:GetClassCount(Card.GetRace)==3) then return false end
if greater then
Duel.SetSelectedCard(sg)
return sg:CheckWithSumGreater(Card.GetRitualLevel,rc:GetLevel(),rc)
else
return sg:CheckWithSumEqual(Card.GetRitualLevel,rc:GetLevel(),3,3,rc)
end
end
function c21105106.ritual_custom_operation(c,mg1,greater)
local tp=c:GetControler()
local lv=c:GetLevel()
local mg=mg1:Filter(c21105106.filter,c,tp)
local sg=Group.CreateGroup()
while #sg<3 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=mg:FilterSelect(tp,c21105106.rselect,1,1,sg,tp,sg,mg,c,greater)
sg:Merge(g)
end
c:SetMaterial(sg)
end end
--レッドアイズ・トランスマイグレーション --レッドアイズ・トランスマイグレーション
function c45410988.initial_effect(c) function c45410988.initial_effect(c)
--activate aux.AddRitualProcGreaterCode(c,19025379,nil,c45410988.mfilter)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c45410988.target)
e1:SetOperation(c45410988.activate)
c:RegisterEffect(e1)
end
c45410988.fit_monster={19025379}
function c45410988.filter(c,e,tp,m1,m2,ft)
if not c:IsCode(19025379) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c)
mg:Merge(m2)
if ft>0 then
return mg:CheckWithSumGreater(Card.GetRitualLevel,8,c)
else
return mg:IsExists(c45410988.mfilterf,1,nil,tp,mg,c)
end
end
function c45410988.mfilterf(c,tp,mg,rc)
if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5 then
Duel.SetSelectedCard(c)
return mg:CheckWithSumGreater(Card.GetRitualLevel,8,rc)
else return false end
end end
function c45410988.mfilter(c) function c45410988.mfilter(c)
return c:GetLevel()>0 and c:IsSetCard(0x3b) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemove() return c:IsSetCard(0x3b)
end
function c45410988.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetMatchingGroup(c45410988.mfilter,tp,LOCATION_GRAVE,0,nil)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return ft>-1 and Duel.IsExistingMatchingCard(c45410988.filter,tp,LOCATION_HAND,0,1,nil,e,tp,mg1,mg2,ft)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_GRAVE)
end
function c45410988.activate(e,tp,eg,ep,ev,re,r,rp)
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetMatchingGroup(c45410988.mfilter,tp,LOCATION_GRAVE,0,nil)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c45410988.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp,mg1,mg2,ft)
local tc=g:GetFirst()
if tc then
local mg=mg1:Filter(Card.IsCanBeRitualMaterial,tc,tc)
mg:Merge(mg2)
local mat=nil
if ft>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:SelectWithSumGreater(tp,Card.GetRitualLevel,8,tc)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:FilterSelect(tp,c45410988.mfilterf,1,1,nil,tp,mg,tc)
Duel.SetSelectedCard(mat)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat2=mg:SelectWithSumGreater(tp,Card.GetRitualLevel,8,tc)
mat:Merge(mat2)
end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
end
end end
--霊魂の降神 --霊魂の降神
function c73055622.initial_effect(c) function c73055622.initial_effect(c)
--Activate aux.AddRitualProcUltimate(c,c73055622.filter,Card.GetLevel,"Greater",nil,c73055622.mfilter)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c73055622.target)
e1:SetOperation(c73055622.activate)
c:RegisterEffect(e1)
end end
c73055622.fit_monster={25415052,52900000} c73055622.fit_monster={25415052,52900000}
function c73055622.filter(c,e,tp,m1,m2,ft) function c73055622.filter(c)
if not c:IsCode(25415052,52900000) or bit.band(c:GetType(),0x81)~=0x81 return c:IsCode(25415052,52900000)
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c)
mg:Merge(m2)
if ft>0 then
return mg:CheckWithSumGreater(Card.GetRitualLevel,c:GetLevel(),c)
else
return mg:IsExists(c73055622.mfilterf,1,nil,tp,mg,c)
end
end
function c73055622.mfilterf(c,tp,mg,rc)
if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5 then
Duel.SetSelectedCard(c)
return mg:CheckWithSumGreater(Card.GetRitualLevel,rc:GetLevel(),rc)
else return false end
end end
function c73055622.mfilter(c) function c73055622.mfilter(c)
return c:GetLevel()>0 and c:IsType(TYPE_SPIRIT) and c:IsAbleToRemove() return c:IsType(TYPE_SPIRIT)
end
function c73055622.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetMatchingGroup(c73055622.mfilter,tp,LOCATION_GRAVE,0,nil)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return ft>-1 and Duel.IsExistingMatchingCard(c73055622.filter,tp,LOCATION_HAND,0,1,nil,e,tp,mg1,mg2,ft)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_GRAVE)
end
function c73055622.activate(e,tp,eg,ep,ev,re,r,rp)
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetMatchingGroup(c73055622.mfilter,tp,LOCATION_GRAVE,0,nil)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,c73055622.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp,mg1,mg2,ft)
local tc=tg:GetFirst()
if tc then
local mg=mg1:Filter(Card.IsCanBeRitualMaterial,tc,tc)
mg:Merge(mg2)
local mat=nil
if ft>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:SelectWithSumGreater(tp,Card.GetRitualLevel,tc:GetLevel(),tc)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:FilterSelect(tp,c73055622.mfilterf,1,1,nil,tp,mg,tc)
Duel.SetSelectedCard(mat)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat2=mg:SelectWithSumGreater(tp,Card.GetRitualLevel,tc:GetLevel(),tc)
mat:Merge(mat2)
end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
end
end end
--リヴェンデット・ボーン --リヴェンデット・ボーン
function c94666032.initial_effect(c) function c94666032.initial_effect(c)
--activate aux.AddRitualProcUltimate(c,c94666032.filter,Card.GetLevel,"Greater",nil,c94666032.mfilter)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c94666032.target)
e1:SetOperation(c94666032.activate)
c:RegisterEffect(e1)
--destroy replace --destroy replace
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
...@@ -19,69 +12,11 @@ function c94666032.initial_effect(c) ...@@ -19,69 +12,11 @@ function c94666032.initial_effect(c)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
c94666032.card_code_list={4388680} c94666032.card_code_list={4388680}
function c94666032.filter(c,e,tp,m1,m2,ft) function c94666032.filter(c)
if not c:IsSetCard(0x106) or bit.band(c:GetType(),0x81)~=0x81 return c:IsSetCard(0x106)
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c)
mg:Merge(m2)
if c.mat_filter then
mg=mg:Filter(c.mat_filter,nil)
end
if mg:IsContains(c) then mg:RemoveCard(c) end
if ft>0 then
return mg:CheckWithSumGreater(Card.GetRitualLevel,c:GetLevel(),c)
else
return mg:IsExists(c94666032.mfilterf,1,nil,tp,mg,c)
end
end
function c94666032.mfilterf(c,tp,mg,rc)
if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5 then
Duel.SetSelectedCard(c)
return mg:CheckWithSumGreater(Card.GetRitualLevel,rc:GetLevel(),rc)
else return false end
end end
function c94666032.mfilter(c) function c94666032.mfilter(c)
return c:GetLevel()>0 and c:IsRace(RACE_ZOMBIE) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemove() return c:IsRace(RACE_ZOMBIE)
end
function c94666032.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetMatchingGroup(c94666032.mfilter,tp,LOCATION_GRAVE,0,nil)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return ft>-1 and Duel.IsExistingMatchingCard(c94666032.filter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp,mg1,mg2,ft)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_GRAVE)
end
function c94666032.activate(e,tp,eg,ep,ev,re,r,rp)
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetMatchingGroup(c94666032.mfilter,tp,LOCATION_GRAVE,0,nil)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c94666032.filter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp,mg1,mg2,ft)
local tc=g:GetFirst()
if tc then
local mg=mg1:Filter(Card.IsCanBeRitualMaterial,tc,tc)
mg:Merge(mg2)
if mg:IsContains(tc) then mg:RemoveCard(tc) end
local mat=nil
if ft>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:SelectWithSumGreater(tp,Card.GetRitualLevel,tc:GetLevel(),tc)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:FilterSelect(tp,c94666032.mfilterf,1,1,nil,tp,mg,tc)
Duel.SetSelectedCard(mat)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat2=mg:SelectWithSumGreater(tp,Card.GetRitualLevel,tc:GetLevel(),tc)
mat:Merge(mat2)
end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
end
end end
function c94666032.repfilter(c,tp) function c94666032.repfilter(c,tp)
return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsCode(4388680) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsCode(4388680)
......
--影霊衣の反魂術 --影霊衣の反魂術
function c97211663.initial_effect(c) function c97211663.initial_effect(c)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=aux.AddRitualProcEqual2(c,c97211663.filter,LOCATION_HAND+LOCATION_GRAVE)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,97211663) e1:SetCountLimit(1,97211663)
e1:SetTarget(c97211663.target)
e1:SetOperation(c97211663.activate)
c:RegisterEffect(e1)
--search --search
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
...@@ -20,69 +14,8 @@ function c97211663.initial_effect(c) ...@@ -20,69 +14,8 @@ function c97211663.initial_effect(c)
e2:SetOperation(c97211663.thop) e2:SetOperation(c97211663.thop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function c97211663.filter(c,e,tp,m,ft) function c97211663.filter(c)
if not c:IsSetCard(0xb4) or bit.band(c:GetType(),0x81)~=0x81 return c:IsSetCard(0xb4)
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m:Filter(Card.IsCanBeRitualMaterial,c,c)
if c:IsCode(21105106) then return c:ritual_custom_condition(mg,ft) end
if c.mat_filter then
mg=mg:Filter(c.mat_filter,nil)
end
if ft>0 then
return mg:CheckWithSumEqual(Card.GetRitualLevel,c:GetLevel(),1,99,c)
else
return ft>-1 and mg:IsExists(c97211663.mfilterf,1,nil,tp,mg,c)
end
end
function c97211663.mfilterf(c,tp,mg,rc)
if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5 then
Duel.SetSelectedCard(c)
return mg:CheckWithSumEqual(Card.GetRitualLevel,rc:GetLevel(),0,99,rc)
else return false end
end
function c97211663.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local mg=Duel.GetRitualMaterial(tp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return Duel.IsExistingMatchingCard(c97211663.filter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp,mg,ft)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function c97211663.activate(e,tp,eg,ep,ev,re,r,rp)
local mg=Duel.GetRitualMaterial(tp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c97211663.filter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp,mg,ft)
local tc=tg:GetFirst()
if tc then
mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc)
if tc:IsCode(21105106) then
tc:ritual_custom_operation(mg)
local mat=tc:GetMaterial()
Duel.ReleaseRitualMaterial(mat)
else
if tc.mat_filter then
mg=mg:Filter(tc.mat_filter,nil)
end
local mat=nil
if ft>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),1,99,tc)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
mat=mg:FilterSelect(tp,c97211663.mfilterf,1,1,nil,tp,mg,tc)
Duel.SetSelectedCard(mat)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat2=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc)
mat:Merge(mat2)
end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
end
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
end
end end
function c97211663.thcon(e,tp,eg,ep,ev,re,r,rp) function c97211663.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0
......
...@@ -1379,46 +1379,74 @@ function Auxiliary.FShaddollOperation(attr) ...@@ -1379,46 +1379,74 @@ function Auxiliary.FShaddollOperation(attr)
Duel.SetFusionMaterial(g) Duel.SetFusionMaterial(g)
end end
end end
function Auxiliary.AddRitualProcUltimate(c,filter,level_function,greater_or_equal) function Auxiliary.AddRitualProcUltimate(c,filter,level_function,greater_or_equal,summon_location,grave_filter)
summon_location=summon_location or LOCATION_HAND
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(Auxiliary.RitualUltimateTarget(filter,level_function,greater_or_equal)) e1:SetTarget(Auxiliary.RitualUltimateTarget(filter,level_function,greater_or_equal,summon_location,grave_filter))
e1:SetOperation(Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equal)) e1:SetOperation(Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equal,summon_location,grave_filter))
c:RegisterEffect(e1) c:RegisterEffect(e1)
return e1
end end
function Auxiliary.RitualGreaterCheck(g,tp,c,lv) function Auxiliary.RitualCheckGreater(g,c,lv)
Duel.SetSelectedCard(g) Duel.SetSelectedCard(g)
return g:CheckWithSumGreater(Card.GetRitualLevel,lv,c) and Duel.GetMZoneCount(tp,g,tp)>0 return g:CheckWithSumGreater(Card.GetRitualLevel,lv,c)
end end
function Auxiliary.RitualEqualCheck(g,tp,c,lv) function Auxiliary.RitualCheckEqual(g,c,lv)
return g:CheckWithSumEqual(Card.GetRitualLevel,lv,#g,#g,c) and Duel.GetMZoneCount(tp,g,tp)>0 return g:CheckWithSumEqual(Card.GetRitualLevel,lv,#g,#g,c)
end end
function Auxiliary.RitualUltimateFilter(c,filter,e,tp,m,level_function,greater_or_equal) function Auxiliary.RitualCheck(g,tp,c,lv,greater_or_equal)
if (filter and not filter(c)) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end return Auxiliary["RitualCheck"..greater_or_equal](g,c,lv) and Duel.GetMZoneCount(tp,g,tp)>0 and (not c.mat_group_check or c.mat_group_check(g,tp))
local mg=m:Filter(Card.IsCanBeRitualMaterial,c,c)
return mg:CheckSubGroup(Auxiliary["Ritual"..greater_or_equal.."Check"],1,63,tp,c,level_function(c))
end end
function Auxiliary.RitualUltimateTarget(filter,level_function,greater_or_equal) function Auxiliary.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_equal)
if bit.band(c:GetType(),0x81)~=0x81 or (filter and not filter(c)) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c)
if m2 then
mg:Merge(m2)
end
if c.mat_filter then
mg=mg:Filter(c.mat_filter,nil)
end
return mg:CheckSubGroup(Auxiliary.RitualCheck,1,63,tp,c,level_function(c),greater_or_equal)
end
function Auxiliary.RitualExtraFilter(c,f)
return c:GetLevel()>0 and f(c) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemove()
end
function Auxiliary.RitualUltimateTarget(filter,level_function,greater_or_equal,summon_location,grave_filter)
return function(e,tp,eg,ep,ev,re,r,rp,chk) return function(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)
return Duel.IsExistingMatchingCard(Auxiliary.RitualUltimateFilter,tp,LOCATION_HAND,0,1,nil,filter,e,tp,mg,level_function,greater_or_equal) local exg=nil
if grave_filter then
exg=Duel.GetMatchingGroup(Auxiliary.RitualExtraFilter,tp,LOCATION_GRAVE,0,nil,grave_filter)
end
return Duel.IsExistingMatchingCard(Auxiliary.RitualUltimateFilter,tp,summon_location,0,1,nil,filter,e,tp,mg,exg,level_function,greater_or_equal)
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,summon_location)
end end
end end
function Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equal) function Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equal,summon_location,grave_filter)
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
local mg=Duel.GetRitualMaterial(tp) local mg=Duel.GetRitualMaterial(tp)
local exg=nil
if grave_filter then
exg=Duel.GetMatchingGroup(Auxiliary.RitualExtraFilter,tp,LOCATION_GRAVE,0,nil,grave_filter)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,Auxiliary.RitualUltimateFilter,tp,LOCATION_HAND,0,1,1,nil,filter,e,tp,mg,level_function,greater_or_equal) local tg=Duel.SelectMatchingCard(tp,Auxiliary.NecroValleyFilter(Auxiliary.RitualUltimateFilter),tp,summon_location,0,1,1,nil,filter,e,tp,mg,exg,level_function,greater_or_equal)
local tc=tg:GetFirst() local tc=tg:GetFirst()
if tc then if tc then
mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc) mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc)
if exg then
mg:Merge(exg)
end
if tc.mat_filter then
mg=mg:Filter(tc.mat_filter,nil)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat=mg:SelectSubGroup(tp,Auxiliary["Ritual"..greater_or_equal.."Check"],false,1,63,tp,tc,level_function(tc)) local mat=mg:SelectSubGroup(tp,Auxiliary.RitualCheck,false,1,63,tp,tc,level_function(tc),greater_or_equal)
tc:SetMaterial(mat) tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat) Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect() Duel.BreakEffect()
...@@ -1428,44 +1456,44 @@ function Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equa ...@@ -1428,44 +1456,44 @@ function Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equa
end end
end end
--Ritual Summon, geq fixed lv --Ritual Summon, geq fixed lv
function Auxiliary.AddRitualProcGreater(c,filter) function Auxiliary.AddRitualProcGreater(c,filter,summon_location,grave_filter)
Auxiliary.AddRitualProcUltimate(c,filter,Card.GetOriginalLevel,"Greater") return Auxiliary.AddRitualProcUltimate(c,filter,Card.GetOriginalLevel,"Greater",summon_location,grave_filter)
end end
function Auxiliary.AddRitualProcGreaterCode(c,code1) function Auxiliary.AddRitualProcGreaterCode(c,code1,summon_location,grave_filter)
if not c:IsStatus(STATUS_COPYING_EFFECT) and c.fit_monster==nil then if not c:IsStatus(STATUS_COPYING_EFFECT) and c.fit_monster==nil then
local mt=getmetatable(c) local mt=getmetatable(c)
mt.fit_monster={code1} mt.fit_monster={code1}
end end
Auxiliary.AddRitualProcGreater(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1)) return Auxiliary.AddRitualProcGreater(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1),summon_location,grave_filter)
end end
--Ritual Summon, equal to fixed lv --Ritual Summon, equal to fixed lv
function Auxiliary.AddRitualProcEqual(c,filter) function Auxiliary.AddRitualProcEqual(c,filter,summon_location,grave_filter)
Auxiliary.AddRitualProcUltimate(c,filter,Card.GetOriginalLevel,"Equal") return Auxiliary.AddRitualProcUltimate(c,filter,Card.GetOriginalLevel,"Equal",summon_location,grave_filter)
end end
function Auxiliary.AddRitualProcEqualCode(c,code1) function Auxiliary.AddRitualProcEqualCode(c,code1,summon_location,grave_filter)
if not c:IsStatus(STATUS_COPYING_EFFECT) and c.fit_monster==nil then if not c:IsStatus(STATUS_COPYING_EFFECT) and c.fit_monster==nil then
local mt=getmetatable(c) local mt=getmetatable(c)
mt.fit_monster={code1} mt.fit_monster={code1}
end end
Auxiliary.AddRitualProcEqual(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1)) return Auxiliary.AddRitualProcEqual(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1),summon_location,grave_filter)
end end
--Ritual Summon, equal to monster lv --Ritual Summon, equal to monster lv
function Auxiliary.AddRitualProcEqual2(c,filter) function Auxiliary.AddRitualProcEqual2(c,filter,summon_location,grave_filter)
Auxiliary.AddRitualProcUltimate(c,filter,Card.GetLevel,"Equal") return Auxiliary.AddRitualProcUltimate(c,filter,Card.GetLevel,"Equal",summon_location,grave_filter)
end end
function Auxiliary.AddRitualProcEqual2Code(c,code1) function Auxiliary.AddRitualProcEqual2Code(c,code1,summon_location,grave_filter)
if not c:IsStatus(STATUS_COPYING_EFFECT) and c.fit_monster==nil then if not c:IsStatus(STATUS_COPYING_EFFECT) and c.fit_monster==nil then
local mt=getmetatable(c) local mt=getmetatable(c)
mt.fit_monster={code1} mt.fit_monster={code1}
end end
Auxiliary.AddRitualProcEqual2(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1)) return Auxiliary.AddRitualProcEqual2(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1),summon_location,grave_filter)
end end
function Auxiliary.AddRitualProcEqual2Code2(c,code1,code2) function Auxiliary.AddRitualProcEqual2Code2(c,code1,code2,summon_location,grave_filter)
if not c:IsStatus(STATUS_COPYING_EFFECT) and c.fit_monster==nil then if not c:IsStatus(STATUS_COPYING_EFFECT) and c.fit_monster==nil then
local mt=getmetatable(c) local mt=getmetatable(c)
mt.fit_monster={code1,code2} mt.fit_monster={code1,code2}
end end
Auxiliary.AddRitualProcEqual2(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1,code2)) return Auxiliary.AddRitualProcEqual2(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1,code2),summon_location,grave_filter)
end end
--add procedure to Pendulum monster, also allows registeration of activation effect --add procedure to Pendulum monster, also allows registeration of activation effect
function Auxiliary.EnablePendulumAttribute(c,reg) function Auxiliary.EnablePendulumAttribute(c,reg)
......
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