--Daddou, Mage of Magnificent Vine function c16000892.initial_effect(c) aux.EnablePendulumAttribute(c) --end battle phase local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(16000892,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_PHASE+PHASE_STANDBY) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,16000892+EFFECT_COUNT_CODE_DUEL) e1:SetCondition(c16000892.condition) -- e1:SetCost(c16000892.cost) e1:SetOperation(c16000892.operation) c:RegisterEffect(e1) --Search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(16000892,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_PZONE) e2:SetCountLimit(1,16000892) e2:SetCost(c16000892.descon1) e2:SetTarget(c16000892.destg1) e2:SetOperation(c16000892.desop1) c:RegisterEffect(e2) --spsummon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(16000892,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetCountLimit(1,16000893) e3:SetTarget(c16000892.sumtg) e3:SetOperation(c16000892.sumop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) local e5=e3:Clone() e5:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e5) local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(16000892,3)) e6:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e6:SetType(EFFECT_TYPE_IGNITION) e6:SetProperty(EFFECT_FLAG_CARD_TARGET) e6:SetRange(LOCATION_EXTRA) e6:SetCost(c16000892.cost2) e6:SetTarget(c16000892.target2) e6:SetOperation(c16000892.operation2) c:RegisterEffect(e6) end function c16000892.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()~=tp end function c16000892.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.Destroy(c,REASON_EFFECT)==0 then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e1:SetTargetRange(0,1) e1:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN,1) Duel.RegisterEffect(e1,tp) end function c16000892.descon1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c16000892.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,c16000892.cfilter,1,1,REASON_COST+REASON_DISCARD) end function c16000892.cfilter(c) return c:IsSetCard(0x285a) and c:IsType(TYPE_MONSTER) and c:IsDiscardable() end function c16000892.xfilter(c) return c:IsSetCard(0x285a) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c16000892.destg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsExistingMatchingCard(c16000892.xfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c16000892.desop1(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if c:IsFaceup() then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tg=Duel.SelectMatchingCard(tp,c16000892.xfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if tg then Duel.SendtoHand(tg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tg) end end end function c16000892.filter(c,e,tp) return c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c16000892.sumtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsPosition(POS_FACEUP_ATTACK) and c:IsCanChangePosition() and Duel.IsExistingMatchingCard(c16000892.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function c16000892.sumop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c16000892.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end if c:IsRelateToEffect(e) and c:IsPosition(POS_FACEUP_ATTACK) then Duel.BreakEffect() Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end end function c16000892.cost2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() and e:GetHandler():IsFaceup() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function c16000892.filter2(c) return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsSetCard(0x285a) and c:IsAbleToDeck() end function c16000892.sfilter(c,tp) return c:IsLocation(LOCATION_DECK) and c:IsControler(tp) end function c16000892.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c16000892.filter2(chkc) end if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(c16000892.filter2,tp,LOCATION_REMOVED,0,3,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,c16000892.filter2,tp,LOCATION_REMOVED,0,3,3,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c16000892.operation2(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if not tg or tg:FilterCount(Card.IsRelateToEffect,nil,e)~=3 then return end Duel.SendtoDeck(tg,nil,0,REASON_EFFECT) local g=Duel.GetOperatedGroup() if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA) if ct==3 then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end