--Anbionic Gearsenal local s,id,o=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddOrigBigbangType(c) aux.AddBigbangProc(c,s.matfilter,2,s.matcheck) c:EnableCounterPermit(0x157) c:SetCounterLimit(0x157,2) --Tokens you control cannot be banished by card effects. local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_REMOVE) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE) e1:SetTargetRange(1,1) e1:SetTarget(s.efilter) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(s.eftg) e2:SetLabelObject(e1) c:RegisterEffect(e2) --Each time a monster(s) is Normal or Special Summoned to your opponent's field, place 1 Charge Counter on this card (max. 2). local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.ctcon) e3:SetOperation(s.ctop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) --Once per turn (Quick Effect): You can remove 2 Charge Counters from your field; destroy 1 card on the field. local e5=Effect.CreateEffect(c) e5:SetCategory(CATEGORY_DESTROY) e5:SetType(EFFECT_TYPE_QUICK_O) e5:SetCode(EVENT_FREE_CHAIN) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1) e5:SetCost(s.descost) e5:SetTarget(s.destg) e5:SetOperation(s.desop) c:RegisterEffect(e5) --If this card is destroyed by battle or card effect: You can Special Summon 1 "Anbionic" monster from your Deck. local e6=Effect.CreateEffect(c) e6:SetCategory(CATEGORY_SPECIAL_SUMMON) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e6:SetProperty(EFFECT_FLAG_DELAY) e6:SetCode(EVENT_DESTROYED) e6:SetCountLimit(1,{id,0}) e6:SetCondition(s.spcon) e6:SetTarget(s.sptg) e6:SetOperation(s.spop) c:RegisterEffect(e6) end function s.matfilter(c) return s.matfilter1(c) or s.matfilter2(c) end function s.matfilter1(c) return c:IsPositive() and c:IsAttribute(ATTRIBUTE_LIGHT) end function s.matfilter2(c) return (c:IsPositive() or c:IsNegative()) and c:IsType(TYPE_TOKEN) end function s.matfilter3(c) return s.matfilter1(c) and not c:IsType(TYPE_TOKEN) end function s.matcheck(g,c,tp) return g:IsExists(s.matfilter1,1,nil) and g:IsExists(s.matfilter2,1,nil) and not g:IsExists(s.matfilter3,2,nil) end function s.efilter(e,c,rp,r,re) return c==e:GetHandler() and r&REASON_EFFECT>0 end function s.eftg(e,c) return c:IsType(TYPE_TOKEN) and c:IsFaceup() end function s.ctcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsControler,1,nil,1-tp) end function s.ctop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():AddCounter(0x157,1) end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,0x157,2,REASON_COST) end Duel.RemoveCounter(tp,1,0,0x157,2,REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) if chk==0 then return g:GetCount()>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if g:GetCount()>0 then Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return bit.band(r,REASON_EFFECT+REASON_BATTLE)~=0 end function s.spfilter(c,e,tp) return c:IsSetCard(0xe57) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end