--Prismatic of Endymion function c249001008.initial_effect(c) aux.AddFusionProcFunRep2(c,aux.FilterBoolFunction(Card.IsRace,RACE_SPELLCASTER),3,99,false) c:EnableCounterPermit(0x1) aux.EnablePendulumAttribute(c,false) c:EnableReviveLimit() --summon success local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(45462639,0)) e1:SetCategory(CATEGORY_COUNTER) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetTarget(c249001008.addct) e1:SetOperation(c249001008.addc) c:RegisterEffect(e1) --add counter local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EVENT_CHAINING) e0:SetRange(LOCATION_MZONE) e0:SetOperation(aux.chainreg) c:RegisterEffect(e0) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EVENT_CHAIN_SOLVED) e2:SetRange(LOCATION_MZONE) e2:SetOperation(c249001008.acop) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(71413901,2)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetTarget(c249001008.destg) e3:SetOperation(c249001008.desop) c:RegisterEffect(e3) --special summon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(76137614,0)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_PZONE) e4:SetCountLimit(1,249001008) e4:SetTarget(c249001008.sptg) e4:SetOperation(c249001008.spop) c:RegisterEffect(e4) --pendulum local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(80896940,5)) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_DESTROYED) e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_DELAY) e5:SetCondition(c249001008.pencon) e5:SetTarget(c249001008.pentg) e5:SetOperation(c249001008.penop) c:RegisterEffect(e5) end function c249001008.addct(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:GetMaterialCount() > 0 and c:IsSummonType(SUMMON_TYPE_FUSION) end Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,c:GetMaterialCount(),0,0x1) end function c249001008.addc(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then e:GetHandler():AddCounter(0x1,e:GetHandler():GetMaterialCount()) end end function c249001008.acop(e,tp,eg,ep,ev,re,r,rp) if re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and e:GetHandler():GetFlagEffect(1)>0 then e:GetHandler():AddCounter(0x1,1) end end function c249001008.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chk==0 then return c:IsCanRemoveCounter(tp,0x1,1,REASON_COST) and Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end local t={} local i=1 for i=1,c:GetCounter(0x1) do t[i]=i end local ct=Duel.AnnounceNumber(tp,table.unpack(t)) c:RemoveCounter(tp,0x1,ct,REASON_COST) e:SetLabel(ct) Duel.SetChainLimit(c249001008.chlimit) end function c249001008.chlimit(e,ep,tp) return tp==ep end function c249001008.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil) Duel.ConfirmCards(tp,g) Duel.ShuffleHand(1-tp) local g2=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,e:GetLabel(),e:GetLabel(),nil) if g2:GetCount()>0 then Duel.Destroy(g2,REASON_EFFECT) end end function c249001008.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,0x1,6,REASON_COST) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.RemoveCounter(tp,1,0,0x1,6,REASON_COST) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function c249001008.pcfilter(c) return c:IsType(TYPE_PENDULUM) and c:IsRace(RACE_SPELLCASTER) and c:IsFaceup() and not c:IsForbidden() end function c249001008.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) if not Duel.CheckLocation(tp,LOCATION_PZONE,0) and not Duel.CheckLocation(tp,LOCATION_PZONE,1) then return end if not Duel.IsExistingMatchingCard(c249001008.pcfilter,tp,LOCATION_EXTRA,0,1,nil) or not Duel.SelectYesNo(tp,1074) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local g=Duel.SelectMatchingCard(tp,c249001008.pcfilter,tp,LOCATION_EXTRA,0,1,1,nil) if g:GetCount()>0 then Duel.MoveToField(g:GetFirst(),tp,tp,LOCATION_SZONE,POS_FACEUP,true) end end function c249001008.pencon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return bit.band(r,REASON_EFFECT+REASON_BATTLE)~=0 and c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup() end function c249001008.pentg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1) end end function c249001008.penop(e,tp,eg,ep,ev,re,r,rp) if not Duel.CheckLocation(tp,LOCATION_PZONE,0) and not Duel.CheckLocation(tp,LOCATION_PZONE,1) then return false end local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) end end