--Spiritualist Thalia function c84607234.initial_effect(c) c:SetSPSummonOnce(84607234) aux.EnablePendulumAttribute(c) c:EnableReviveLimit() --Ritual Summon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetDescription(aux.Stringid(84607234,1)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_PZONE) e1:SetTarget(c84607234.target) e1:SetOperation(c84607234.operation) c:RegisterEffect(e1) --pierce local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_PIERCE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x7ce)) c:RegisterEffect(e2) --atk/def up local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(84607234,1)) e3:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCondition(c84607234.thcon) e3:SetTarget(c84607234.adtg) e3:SetOperation(c84607234.adop) c:RegisterEffect(e3) end function c84607234.filter(c,e,tp,m1) if not c:IsSetCard(0x7ce) or not (c:IsLocation(LOCATION_HAND) or (c:IsLocation(LOCATION_EXTRA) and c:IsFaceup() and bit.band(c:GetType(),0x1000081)==0x1000081)) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if c:IsLocation(LOCATION_EXTRA) then ft=Duel.GetLocationCountFromEx(tp) end if ft>0 then return mg:CheckWithSumGreater(Card.GetRitualLevel,c:GetLevel(),c) else return ft>-1 and mg:IsExists(c84607234.mfilterf,1,nil,tp,mg,c) end end function c84607234.mfilterf(c,tp,mg,rc) if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and ((rc:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,c)>0) or (rc:IsLocation(LOCATION_HAND))) then Duel.SetSelectedCard(c) return mg:CheckWithSumGreater(Card.GetRitualLevel,rc:GetLevel(),rc) else return false end end function c84607234.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local mg1=Duel.GetRitualMaterial(tp) return Duel.IsExistingMatchingCard(c84607234.filter,tp,LOCATION_HAND+LOCATION_EXTRA,0,1,nil,e,tp,mg1) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_EXTRA) end function c84607234.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local mg1=Duel.GetRitualMaterial(tp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c84607234.filter,tp,LOCATION_HAND+LOCATION_EXTRA,0,1,1,nil,e,tp,mg1) local tc=g:GetFirst() if tc then local mg=mg1:Filter(Card.IsCanBeRitualMaterial,tc,tc) local mat=nil if tc:IsLocation(LOCATION_EXTRA) then ft=Duel.GetLocationCountFromEx(tp) end if ft>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) mat=mg:SelectWithSumGreater(tp,Card.GetRitualLevel,tc:GetLevel(),tc) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) mat=mg:FilterSelect(tp,c84607234.mfilterf,1,1,nil,tp,mg,tc) Duel.SetSelectedCard(mat) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local mat2=mg:SelectWithSumGreater(tp,Card.GetRitualLevel,tc:GetLevel(),tc) mat:Merge(mat2) end tc:SetMaterial(mat) Duel.ReleaseRitualMaterial(mat) Duel.BreakEffect() Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP) tc:CompleteProcedure() end end function c84607234.thcon(e,tp,eg,ep,ev,re,r,rp) return bit.band(e:GetHandler():GetSummonType(),SUMMON_TYPE_RITUAL)==SUMMON_TYPE_RITUAL end function c84607234.adfilter(c) return c:IsFaceup() and c:IsSetCard(0x7ce) end function c84607234.adtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c84607234.adfilter,tp,LOCATION_MZONE+LOCATION_PZONE+LOCATION_FZONE+LOCATION_SZONE,0,1,nil) end end function c84607234.adop(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(c84607234.adfilter,tp,LOCATION_MZONE+LOCATION_PZONE+LOCATION_FZONE+LOCATION_SZONE,0,nil) local atk=sg:GetCount()*100 local c=e:GetHandler() local tc=sg:GetFirst() while tc do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(atk) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) tc=sg:GetNext() end end