--CX.VIATRIX: Comandante Caos --Script by XGlitchy30 function c1020097.initial_effect(c) --link procedure c:EnableReviveLimit() aux.AddLinkProcedure(c,c1020097.matfilter,2) --boost local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(1020097,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,1020097) e1:SetCondition(c1020097.lkcon) e1:SetOperation(c1020097.lkop) c:RegisterEffect(e1) --banish local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(1020097,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,1120097) e2:SetCost(c1020097.rmcost) e2:SetTarget(c1020097.rmtg) e2:SetOperation(c1020097.rmop) c:RegisterEffect(e2) --spsummon LINK local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(1020097,2)) 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,1220097) e3:SetCondition(c1020097.spcon) e3:SetTarget(c1020097.sptg) e3:SetOperation(c1020097.spop) c:RegisterEffect(e3) end --filters function c1020097.matfilter(c) return c:IsLinkRace(RACE_CYBERSE) and c:IsLinkType(TYPE_LINK) end function c1020097.atkfilter(c) return c:IsFaceup() and c:IsRace(RACE_CYBERSE) and c:IsType(TYPE_MONSTER) end function c1020097.costfilter(c) return c:IsFaceup() and c:IsSetCard(0x39c) and c:IsType(TYPE_MONSTER) end function c1020097.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(1020097) end --spsummon function c1020097.lkcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) end function c1020097.lkop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c1020097.atkfilter,tp,LOCATION_MZONE,0,nil) local gval=Duel.GetMatchingGroup(c1020097.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler()) local atk=gval:GetCount()*400 if atk<=0 then return end local tc=g:GetFirst() while tc do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetValue(atk) tc:RegisterEffect(e1) tc=g:GetNext() end end --negate function c1020097.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetAttackAnnouncedCount()==0 and Duel.CheckReleaseGroup(tp,c1020097.costfilter,1,e:GetHandler()) end local cg=Duel.SelectReleaseGroup(tp,c1020097.costfilter,1,1,e:GetHandler()) Duel.Release(cg,REASON_COST) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e:GetHandler():RegisterEffect(e1) end function c1020097.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function c1020097.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end --spsummon LINK function c1020097.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_MZONE) and e:GetHandler():GetPreviousSequence()>4 end function c1020097.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCountFromEx(tp)>0 and Duel.IsExistingMatchingCard(c1020097.lkfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function c1020097.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,c1020097.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