--Shadowed Goghi of Magnificent Vine function c50031421.initial_effect(c) aux.AddXyzProcedure(c,aux.FilterBoolFunction(c50031421.xyzfilter),2,2) c:EnableReviveLimit() --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(50031421,3)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,50031421) e1:SetCost(c50031421.spcost) e1:SetTarget(c50031421.sptg) e1:SetOperation(c50031421.spop) c:RegisterEffect(e1) --flip local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(50031421,4)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCountLimit(1,50031421) e2:SetCost(c50031421.cost) e2:SetTarget(c50031421.target) e2:SetOperation(c50031421.operation) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(50031421,5)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,50031421) e3:SetCondition(c50031421.descon) e3:SetCost(c50031421.cost) e3:SetTarget(c50031421.destg) e3:SetOperation(c50031421.desop) c:RegisterEffect(e3) local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(50031421,0)) e0:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM) e0:SetType(EFFECT_TYPE_FIELD) e0:SetCode(EFFECT_SPSUMMON_PROC) e0:SetRange(LOCATION_EXTRA) e0:SetTargetRange(POS_FACEDOWN_DEFENSE,0) e0:SetCondition(c50031421.xyzcon) e0:SetOperation(c50031421.xyzop) e0:SetValue(SUMMON_TYPE_XYZ) c:RegisterEffect(e0) end function c50031421.xyzfilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x285a) or c:IsRace(RACE_WINDBEAST) end function c50031421.spfilter(c,e,tp) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x285a) and c:GetLevel()>0 and c:IsLevelAbove(5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c50031421.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) end function c50031421.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp)end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c50031421.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function c50031421.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if not e:GetHandler():IsRelateToEffect(e) or e:GetHandler():IsFacedown() then return end local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c50031421.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) if g:GetCount()>0 then local tc=g:GetFirst() while tc do Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e2) tc=g:GetNext() end end end function c50031421.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) end function c50031421.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function c50031421.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end function c50031421.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_EFFECT) end function c50031421.filter(c) return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable() end function c50031421.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and c50031421.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c50031421.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c50031421.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c50031421.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function c50031421.mfilter(c,xyzc) return c:IsFaceup() and not c:IsType(TYPE_XYZ) and c:GetLevel()==2 and c:IsCanBeXyzMaterial(xyzc) and c:IsSetCard(0x285a) or c:IsRace(RACE_WINDBEAST) end function c50031421.xyzfilter1(c,g) return g:IsExists(c50031421.xyzfilter2,1,c,c:GetLevel()) end function c50031421.xyzfilter2(c,rk) return c:GetLevel()==rk end function c50031421.xyzcon(e,c,og,min,max) if c==nil then return true end local tp=c:GetControler() local mg=nil if og then mg=og:Filter(c50031421.mfilter,nil,c) else mg=Duel.GetMatchingGroup(c50031421.mfilter,tp,LOCATION_MZONE,0,nil,c) end return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and (not min or min<=2 and max>=2) and mg:IsExists(c50031421.xyzfilter1,1,nil,mg) end function c50031421.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max) local g=nil local sg=Group.CreateGroup() if og and not min then g=og local tc=og:GetFirst() while tc do sg:Merge(tc:GetOverlayGroup()) tc=og:GetNext() end else local mg=nil if og then mg=og:Filter(c50031421.mfilter,nil,c) else mg=Duel.GetMatchingGroup(c50031421.mfilter,tp,LOCATION_MZONE,0,nil,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) g=mg:FilterSelect(tp,c50031421.xyzfilter1,1,1,nil,mg) local tc1=g:GetFirst() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local g2=mg:FilterSelect(tp,c50031421.xyzfilter2,1,1,tc1,tc1:GetLevel()) local tc2=g2:GetFirst() g:Merge(g2) sg:Merge(tc1:GetOverlayGroup()) sg:Merge(tc2:GetOverlayGroup()) end Duel.SendtoGrave(sg,REASON_RULE) c:SetMaterial(g) Duel.Overlay(c,g) end