--Vanguard Penguin local cid,id=GetID() function cid.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE) e1:SetCountLimit(1,id) e1:SetTarget(cid.target) e1:SetOperation(cid.activate) c:RegisterEffect(e1) --return local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DESTROYED) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCountLimit(1,id+1000) e2:SetCondition(cid.spcon) e2:SetTarget(cid.sptg) e2:SetOperation(cid.spop) c:RegisterEffect(e2) --pop and draw local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_POSITION+CATEGORY_DRAW) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,id+10000) e3:SetCost(cid.drcost) e3:SetTarget(cid.drtg) e3:SetOperation(cid.drop) c:RegisterEffect(e3) end function cid.filter(c) return c:IsFaceup() and c:IsSetCard(0x5a) and c:IsCanTurnSet() and not c:IsType(TYPE_LINK) end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.filter,tp,LOCATION_MZONE,0,1,nil) end local g=Duel.GetMatchingGroup(cid.filter,tp,LOCATION_MZONE,0,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,g:GetCount(),0,0) end function cid.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(cid.filter,tp,LOCATION_MZONE,0,nil) if g:GetCount()>0 then Duel.ChangePosition(g,POS_FACEDOWN_DEFENSE) end end function cid.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and c:IsReason(REASON_EFFECT) and c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEDOWN) end function cid.filter1(c,e,tp) return c:IsSetCard(0x5a) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if Duel.IsPlayerAffectedByEffect(tp,59822133) then return false end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return false end local g=Duel.GetMatchingGroup(cid.filter1,tp,LOCATION_DECK,0,nil,e,tp) return g:GetClassCount(Card.GetCode)>=2 end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,59822133) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end local g=Duel.GetMatchingGroup(cid.filter1,tp,LOCATION_DECK,0,nil,e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:SelectSubGroup(tp,aux.dncheck,false,2,2) if sg then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE) Duel.ConfirmCards(1-tp,sg) end end function cid.drcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToDeckAsCost() end Duel.SendtoDeck(e:GetHandler(),nil,2,REASON_COST) end function cid.posfilter(c) return c:IsFaceup() and c:IsSetCard(0x5a) and c:IsCanTurnSet() end function cid.drtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and cid.posfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(cid.posfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,cid.posfilter,tp,LOCATION_MZONE,0,1,1,nil) e:SetLabel(1) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) end function cid.drop(e,tp,eg,ep,ev,re,r,rp) --if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE) end Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end