--Spiritualist Sacred Tree function c84607231.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,84607231) c:RegisterEffect(e1) --cannot be target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetRange(LOCATION_FZONE) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetTargetRange(LOCATION_ONFIELD,0) e2:SetTarget(c84607231.tgtg) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --search local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(84607231,0)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1) e3:SetTarget(c84607231.thtg) e3:SetOperation(c84607231.thop) c:RegisterEffect(e3) --atk/def up local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_UPDATE_ATTACK) e4:SetRange(LOCATION_FZONE) e4:SetTargetRange(LOCATION_MZONE,0) e4:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x7ce)) e4:SetValue(500) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e5) --sent to grave search local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(84607231,0)) e6:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e6:SetCode(EVENT_TO_GRAVE) e6:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e6:SetCountLimit(1,84607331) e6:SetTarget(c84607231.thtg1) e6:SetOperation(c84607231.tgop1) c:RegisterEffect(e6) end function c84607231.tgtg(e,c) return c:IsSetCard(0x7ce) and c~=e:GetHandler() end function c84607231.thfilter(c) return c:IsFaceup() and c:IsSetCard(0x7ce) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c84607231.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c84607231.thfilter,tp,LOCATION_EXTRA+LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA+LOCATION_GRAVE) end function c84607231.thop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c84607231.thfilter,tp,LOCATION_EXTRA+LOCATION_GRAVE,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function c84607231.thfilter1(c) return c:IsSetCard(0x7ce) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c84607231.thtg1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local g=Duel.GetMatchingGroup(c84607231.thfilter1,tp,LOCATION_DECK+LOCATION_EXTRA+LOCATION_GRAVE,0,nil) return g:GetClassCount(Card.GetCode)>=2 end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK+LOCATION_EXTRA+LOCATION_GRAVE) end function c84607231.tgop1(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c84607231.thfilter1,tp,LOCATION_DECK+LOCATION_EXTRA+LOCATION_GRAVE,0,nil) if g:GetClassCount(Card.GetCode)>=2 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g1=g:Select(tp,1,1,nil) g:Remove(Card.IsCode,nil,g1:GetFirst():GetCode()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g2=g:Select(tp,1,1,nil) g1:Merge(g2) Duel.SendtoHand(g1,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g1) end end