--created & coded by Swag --Slumber, Deep in the Dreary Forest's Cradle local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:HOPT() e1:SetRelevantTimings() e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:Desc(1) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:HOPT() e1:SetRelevantTimings() e2:SetCost(aux.bfgcost) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_TRAP_ACT_IN_HAND) e3:SetCondition(s.handcon) c:RegisterEffect(e3) if not s.global_check then s.global_check=true local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_TRANSFORMED) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) aux.AddPreTransformationCheck(c,ge1,s.tfcon,true) end end function s.checkop(e,tp,eg,ep,ev,re,r,rp) for p=0,1 do if aux.PreTransformationGlobalCheckSuccess(e,p) then Duel.RegisterFlagEffect(p,id,RESET_PHASE|PHASE_END,0,1) end end end function s.tffilter(c,tp) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(ARCHE_DREAMY_FOREST,ARCHE_DREARY_FOREST) end function s.tfcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.tffilter,1,nil,tp) end function s.confilter(c,tp) return c:IsFaceup() and c:IsSetCard(ARCHE_DREARY_FOREST) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()==1-tp and Duel.IsExistingMatchingCard(s.confilter,tp,LOCATION_MZONE,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,3,nil) Duel.SetCardOperationInfo(g,CATEGORY_REMOVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards() if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end function s.setfilter(c,mc,tp) return c:IsSetCard(ARCHE_DREARY_FOREST) and c:IsType(TYPE_TRAP) and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_HAND,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_HAND,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.SSetAndFastActivation(tp,tc,e) end end function s.handcon(e,tp,eg,ep,ev,re,r,rp) return Duel.PlayerHasFlagEffect(tp,id) end