--Oniritron Assimilator of Shadows local s,id=GetID() function s.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,nil,1,3) c:EnableReviveLimit() --Gains 500 ATK/DEF for each material attached to it. local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.atkval) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) --During your opponent's turn (Quick Effect): You can target 1 Set card your opponent controls; attach it to this card as material. local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetHintTiming(0,TIMING_MAIN_END+TIMINGS_CHECK_MONSTER+TIMING_END_PHASE) e3:SetCountLimit(1,{id,0}) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) --You can detach 1 material from this card; Set 1 "Oniritron" Trap directly from your Deck, except an "Oniritron Device" card. local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1,{id,1}) e4:SetCost(s.setcost) e4:SetTarget(s.settg) e4:SetOperation(s.setop) c:RegisterEffect(e4) end function s.atkval(e,c) return c:GetOverlayCount()*500 end function s.filter(c) return c:IsAbleToChangeControler() and not c:IsType(TYPE_TOKEN) and c:IsFacedown() end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()~=tp end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsControler(1-tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_ONFIELD,1,nil) and e:GetHandler():IsType(TYPE_XYZ) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_ONFIELD,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then local og=tc:GetOverlayGroup() if og:GetCount()>0 then Duel.SendtoGrave(og,REASON_RULE) end Duel.Overlay(c,Group.FromCards(tc)) end end function s.setfilter(c) return c:IsSSetable() and c:IsSetCard(0x721) and not c:IsSetCard(0x1721) and c:IsType(TYPE_TRAP) end function s.setcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SSet(tp,g) end end