--Spiritualist Calling function c84607229.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,84607229) e1:SetOperation(c84607229.activate) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x7ce)) e2:SetValue(c84607229.atkval) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) --Add from Extra local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(84607229,1)) e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_DESTROYED) e4:SetCondition(c84607229.thcon) e4:SetTarget(c84607229.thtg) e4:SetOperation(c84607229.thop) c:RegisterEffect(e4) end function c84607229.thfilter(c) return c:IsSetCard(0x7ce) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c84607229.activate(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(c84607229.thfilter,tp,LOCATION_DECK,0,nil) if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(84607229,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end function c84607229.atkfilter(c) return c:IsFaceup() and c:IsSetCard(0x7ce) and c:IsType(TYPE_PENDULUM) end function c84607229.atkval(e,c) local g=Duel.GetMatchingGroup(c84607229.atkfilter,c:GetControler(),LOCATION_EXTRA,0,nil) return g:GetClassCount(Card.GetCode)*300 end function c84607229.thcon(e,tp,eg,ep,ev,re,r,rp) return bit.band(r,REASON_EFFECT)~=0 end function c84607229.thfilter2(c) return c:IsSetCard(0x7ce) and c:IsAbleToHand() end function c84607229.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c84607229.thfilter2,tp,LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA) end function c84607229.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c84607229.thfilter2,tp,LOCATION_EXTRA,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end