--created & coded by Swag --The Wonders of the Dreamy Forest local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND) e1:SetRelevantTimings() e1:HOPT() e1:SetCondition(aux.TurnPlayerCond(0)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local GYChk=aux.AddThisCardInGraveAlreadyCheck(c) local e2=Effect.CreateEffect(c) e2:Desc(1) e2:SetCategory(CATEGORY_LEAVE_GRAVE) e2:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetRange(LOCATION_GRAVE) e2:SetProperty(EFFECT_FLAG_DELAY|EFFECT_FLAG_DAMAGE_STEP) e2:SHOPT() e2:SetLabelObject(GYChk) e2:SetCondition(s.setcon) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) end function s.ssfilter(c,e,tp) return c:IsSetCard(ARCHE_LEYLAH) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.ssfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,1-tp,LOCATION_MZONE) end function s.cfilter(c,lv) return c:IsFaceup() and c:IsSetCard(ARCHE_DREAMY_FOREST,ARCHE_DREARY_FOREST) and c:IsLevelAbove(lv) end function s.thfilter(c,atk) return c:IsFaceup() and c:IsAttackAbove(atk) and c:IsAbleToHand() end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.ssfilter),tp,LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 then local tc=g:GetFirst() if not tc:IsFaceup() then return end Duel.AdjustInstantly(tc) Duel.AdjustAll() local lv,atk=tc:GetLevel(),tc:GetAttack() if Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil,lv+1) and Duel.IsExistingMatchingCard(s.thfilter,tp,0,LOCATION_MZONE,1,nil,atk+1) and Duel.SelectYesNo(tp,STRING_ASK_TO_HAND) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local sg=Duel.SelectMatchingCard(tp,s.thfilter,tp,0,LOCATION_MZONE,1,1,nil,atk) if #sg>0 then Duel.HintSelection(sg) Duel.BreakEffect() Duel.SendtoHand(sg,nil,REASON_EFFECT) end end end end function s.setfilter(c,tp,se) return c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousSetCard(ARCHE_DREAMY_FOREST,ARCHE_DREARY_FOREST) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:GetReasonPlayer()==1-tp and (se==nil or c:GetReasonEffect()~=se) end function s.setcon(e,tp,eg,ep,ev,re,r,rp) local se=e:GetLabelObject():GetLabelObject() return eg:IsExists(s.setfilter,1,nil,tp,se) end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsSSetable() end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,0,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToChain() and c:IsSSetable() then Duel.SSetAndRedirect(tp,c,e) end end