--Dimenticalgia Parassita Paranoia --Script by XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --synchro summon aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0xf45),aux.NonTuner(nil),1) c:EnableReviveLimit() --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetLabel(0) e1:SetCost(cid.thcost) e1:SetTarget(cid.thtg) e1:SetOperation(cid.thop) c:RegisterEffect(e1) --synchro effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e2:SetTarget(cid.sctarg) e2:SetOperation(cid.scop) c:RegisterEffect(e2) --spsummon self local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,id+200) e3:SetCondition(cid.spcon) e3:SetCost(cid.spcost) e3:SetTarget(cid.sptg) e3:SetOperation(cid.spop) c:RegisterEffect(e3) end --filters function cid.cfilter(c,tp) return c:IsType(TYPE_MONSTER) and c:IsAbleToDeckAsCost() and c:IsSetCard(0xf45) and Duel.IsExistingMatchingCard(cid.thfilter,tp,LOCATION_DECK,0,1,c,c:GetAttack()) end function cid.thfilter(c,atk) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xf45) and c:IsAbleToHand() and c:GetAttack()<=atk end function cid.handmatfilter(tc,c,tp) if not tc:IsCanBeSynchroMaterial() then return false end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_HAND_SYNCHRO) e1:SetTarget(cid.hsyntg) c:RegisterEffect(e1) local mg=Group.FromCards(c,tc) local res=Duel.IsExistingMatchingCard(cid.synfilter,tp,LOCATION_EXTRA,0,1,nil,mg) e1:Reset() return res end function cid.synfilter(c,mg) return c:IsSynchroSummonable(nil,mg) end function cid.hsyntg(e,c,syncard) return c:IsSetCard(0xf45) and c:IsType(TYPE_MONSTER) end function cid.spcfilter(c) return c:IsFaceup() and c:IsSetCard(0xf45) and c:IsType(TYPE_MONSTER) end --search function cid.thcost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(100) return true end function cid.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()~=100 then return false end e:SetLabel(0) return Duel.IsExistingMatchingCard(cid.cfilter,tp,LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local cg=Duel.SelectMatchingCard(tp,cid.cfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp) if cg:GetCount()>0 then Duel.HintSelection(cg) if Duel.SendtoDeck(cg,nil,2,REASON_COST)~=0 and cg:IsExists(Card.IsLocation,1,nil,LOCATION_DECK+LOCATION_EXTRA) then if cg:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(cg:GetFirst():GetControler()) end cg:KeepAlive() e:SetLabelObject(cg) e:SetLabel(0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end end end function cid.thop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject():GetFirst() local atk=tc:GetAttack() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=Duel.SelectMatchingCard(tp,cid.thfilter,tp,LOCATION_DECK,0,1,1,nil,atk) if sg:GetCount()>0 then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end --synchro effect function cid.sctarg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(cid.handmatfilter,tp,LOCATION_HAND,0,1,nil,e:GetHandler(),tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function cid.scop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:GetControler()~=tp or not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local tc=Duel.SelectMatchingCard(tp,cid.handmatfilter,tp,LOCATION_HAND,0,1,1,nil,e:GetHandler(),tp):GetFirst() if tc then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_HAND_SYNCHRO) e1:SetTarget(cid.hsyntg) c:RegisterEffect(e1) local mg=Group.FromCards(c,tc) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,cid.synfilter,tp,LOCATION_EXTRA,0,1,1,nil,mg) local sc=g:GetFirst() if sc then Duel.SynchroSummon(tp,sc,nil,mg) end e1:Reset() end end --spsummon self function cid.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(cid.spcfilter,tp,LOCATION_MZONE,0,1,nil) end function cid.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,2,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,2,2,REASON_COST+REASON_DISCARD) end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if c:IsRelateToEffect(e) and Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_ADD_TYPE) e1:SetValue(TYPE_TUNER) e1:SetReset(RESET_EVENT+RESETS_STANDARD) c:RegisterEffect(e1) Duel.SpecialSummonComplete() local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetReset(RESET_EVENT+RESETS_REDIRECT) e2:SetValue(LOCATION_REMOVED) c:RegisterEffect(e2,true) end end