--CX.VIATRIX: Portale Caos --Script by XGlitchy30 function c1020098.initial_effect(c) --link procedure c:EnableReviveLimit() aux.AddLinkProcedure(c,c1020098.matfilter,2) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(1020098,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c1020098.lkcon) e1:SetTarget(c1020098.lktg) e1:SetOperation(c1020098.lkop) c:RegisterEffect(e1) --cannot be target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(c1020098.untg) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --spsummon LINK local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(1020098,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetCountLimit(1,1220098) e3:SetCondition(c1020098.spcon) e3:SetTarget(c1020098.sptg) e3:SetOperation(c1020098.spop) c:RegisterEffect(e3) end --filters function c1020098.matfilter(c) return c:IsLinkRace(RACE_CYBERSE) and c:IsLinkType(TYPE_LINK) end function c1020098.spfilter(c,e,tp,zone) return c:IsRace(RACE_CYBERSE) and c:IsType(TYPE_LINK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) end function c1020098.lkfilter(c,e,tp) return c:IsRace(RACE_CYBERSE) and c:IsLinkBelow(3) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(1020098) end --spsummon function c1020098.lkcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) end function c1020098.lktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local zone=bit.band(e:GetHandler():GetLinkedZone(tp),0x1f) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c1020098.spfilter(chkc,e,tp,zone) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c1020098.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,zone) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,aux.NecroValleyFilter(c1020098.spfilter),tp,LOCATION_GRAVE,0,1,1,nil,e,tp,zone) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c1020098.lkop(e,tp,eg,ep,ev,re,r,rp) local zone=bit.band(e:GetHandler():GetLinkedZone(tp),0x1f) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP,zone) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1,true) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e2,true) Duel.SpecialSummonComplete() end end end --cannot be target function c1020098.untg(e,c) return c:IsRace(RACE_CYBERSE) and c~=e:GetHandler() end --spsummon LINK function c1020098.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_MZONE) and e:GetHandler():GetPreviousSequence()>4 end function c1020098.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCountFromEx(tp)>0 and Duel.IsExistingMatchingCard(c1020098.lkfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function c1020098.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCountFromEx(tp)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c1020098.lkfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end