Commit a9c2d540 authored by 聖園ミカ's avatar 聖園ミカ 🐟

vme50

parent 4beb12a9
--四季轮回
function c50221310.initial_effect(c)
--Activate
local e1=aux.AddRitualProcEqual2(c,c50221310.mfilter,LOCATION_HAND+LOCATION_DECK,nil,c50221310.mfilter)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,50221310)
e1:SetTarget(c50221310.target)
e1:SetOperation(c50221310.activate)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TOHAND)
......@@ -14,8 +20,68 @@ function c50221310.initial_effect(c)
e2:SetOperation(c50221310.thop)
c:RegisterEffect(e2)
end
function c50221310.mfilter(c)
return c:IsSetCard(0xcb3)
function c50221310.filter(c,e,tp,chk)
local mg=Duel.GetRitualMaterial(tp)
mg=mg:Filter(Card.IsCanBeRitualMaterial,c,c)
return c:IsSetCard(0xcb3) and (not chk or c~=e:GetHandler())
and (not c:IsLocation(LOCATION_EXTRA) and Duel.GetMZoneCount(tp,mg,tp)>0
or c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,mg,c)>0)
end
function c50221310.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_equal,chk)
if bit.band(c:GetType(),0x81)~=0x81 or (filter and not filter(c,e,tp,chk)) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true,POS_FACEUP) 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,c,tp)
else
mg:RemoveCard(c)
end
local lv=level_function(c)
aux.GCheckAdditional=aux.RitualCheckAdditional(c,lv,greater_or_equal)
local res=mg:CheckSubGroup(aux.RitualCheck,1,lv,tp,c,lv,greater_or_equal)
aux.GCheckAdditional=nil
return res
end
function c50221310.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local mg1=Duel.GetRitualMaterial(tp)
return Duel.IsExistingMatchingCard(c50221310.RitualUltimateFilter,tp,0x72,0,1,nil,c50221310.filter,e,tp,mg1,nil,Card.GetLevel,"Greater")
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0x72)
end
function c50221310.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(c50221310.RitualUltimateFilter),tp,0x72,0,1,1,nil,c50221310.filter,e,tp,mg1,nil,Card.GetLevel,"Greater")
local tc=g:GetFirst()
if tc then
local mg=mg1:Filter(Card.IsCanBeRitualMaterial,tc,tc)
if tc.mat_filter then
mg=mg:Filter(tc.mat_filter,tc,tp)
else
mg:RemoveCard(tc)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Greater")
local mat=mg:SelectSubGroup(tp,c50221310.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Greater")
aux.GCheckAdditional=nil
if not mat then goto cancel 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
function c50221310.RitualCheck(g,tp,c,lv,greater_or_equal)
return Auxiliary["RitualCheck"..greater_or_equal](g,c,lv)
and (not c:IsLocation(LOCATION_EXTRA) and Duel.GetMZoneCount(tp,g,tp)>0
or c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,g,c)>0)
and (not c.mat_group_check or c.mat_group_check(g,tp))
and (not Auxiliary.RCheckAdditional or Auxiliary.RCheckAdditional(tp,g,c))
end
function c50221310.thcfilter(c)
return bit.band(c:GetType(),0x81)==0x81 and c:IsSetCard(0xcb3) and c:IsLocation(LOCATION_HAND)
......@@ -36,4 +102,4 @@ function c50221310.thop(e,tp,eg,ep,ev,re,r,rp)
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
end
end
end
\ No newline at end of file
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