--created by Walrus, coded by Lyris, art from Shadowverse's "Bone Blast" local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(function(e,tp,eg) return eg:IsExists(s.cfilter,1,nil,tp) end) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_EVENT_PLAYER) e2:SetCode(EVENT_BE_MATERIAL) e2:SetCondition(s.mtcon) e2:SetOperation(s.mtop) c:RegisterEffect(e2) end function s.cfilter(c,tp) return c:IsFaceup() and c:GetSummonPlayer()==tp and c:IsSummonType(SUMMON_TYPE_RITUAL) and c:IsSetCard(0x106) and c:IsType(TYPE_RITUAL) end function s.filter(c,e,tp) return c:IsFaceup() and not c:IsType(TYPE_RITUAL) and c:IsSetCard(0x106) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,2,tp,LOCATION_REMOVED) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<2 or Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) if c:IsCanBeSpecialSummoned(e,0,tp,false,false) and #g>0 then Duel.SpecialSummon(g+c,0,tp,tp,false,false,POS_FACEUP) end end function s.mtcon(e,tp,eg,ep,ev,re,r,rp) return r==REASON_RITUAL and e:GetHandler():IsPreviousLocation(LOCATION_MZONE) and eg:IsExists(Card.IsSetCard,1,nil,0x106) end function s.mtop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=eg:Filter(Card.IsSetCard,nil,0x106):GetFirst() if not rc then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetCondition(function() return Duel.GetMatchingGroup(s.ifilter,tp,LOCATION_GRAVE,0,nil):GetClassCount(Card.GetCode)>2 end) e1:SetValue(s.efilter) e1:SetReset(RESET_EVENT+RESETS_STANDARD) rc:RegisterEffect(e1,true) if not rc:IsType(TYPE_EFFECT) then local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_ADD_TYPE) e3:SetValue(TYPE_EFFECT) e3:SetReset(RESET_EVENT+RESETS_STANDARD) rc:RegisterEffect(e3,true) end rc:RegisterFlagEffect(0,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,0)) end function s.ifilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x106) end function s.efilter(e,re) return e:GetOwnerPlayer()~=re:GetOwnerPlayer() end