--Oniritron Lord of the Infinite Light local s,id=GetID() function s.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,nil,10,3) c:EnableReviveLimit() --gain atk x material 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) --Special Summon by using Rank 1 "Oniritron" Xyz Monsters local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_SPSUMMON_PROC) e3:SetRange(LOCATION_EXTRA) e3:SetCountLimit(1,id) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetCondition(s.xyzcon) e3:SetTarget(s.xyztg) e3:SetOperation(s.xyzop) c:RegisterEffect(e3) --Negate the activation of spell/trap, attch it local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_NEGATE) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_CHAINING) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.discon) e4:SetCost(s.discost) e4:SetTarget(s.distg) e4:SetOperation(s.disop) c:RegisterEffect(e4) end function s.atkval(e,c) return c:GetOverlayCount()*1000 end function s.xyzfilter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsSetCard(0x721) and c:GetRank()==1 end function s.xyzcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetMatchingGroupCount(s.xyzfilter,tp,LOCATION_MZONE,0,nil,nil)>1 end function s.xyztg(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() local g=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_MZONE,0,nil) local mat=aux.SelectUnselectGroup(g,e,tp,2,2,nil,1,tp,HINTMSG_SELECT,nil,nil,true) mat:KeepAlive() e:SetLabelObject(mat) if #mat<2 then return false end return true end function s.xyzop(e,tp,eg,ep,ev,re,r,rp,c) local mat=e:GetLabelObject() if not mat then return end local mat1=mat:GetFirst():GetOverlayGroup() local mat2=mat:GetNext():GetOverlayGroup() mat1:AddCard(mat2) local mg=mat1 if mg:GetCount()~=0 then Duel.Overlay(c,mg) end c:SetMaterial(Group.FromCards(mat)) Duel.Overlay(c,Group.FromCards(mat)) end function s.discon(e,tp,eg,ep,ev,re,r,rp) return ep~=tp and re:IsActiveType(TYPE_SPELL+TYPE_TRAP) and Duel.IsChainNegatable(ev) end function s.discost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:CheckRemoveOverlayCard(tp,2,REASON_COST) end c:RemoveOverlayCard(tp,2,2,REASON_COST) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) local rc=re:GetHandler() end function s.disop(e,tp,eg,ep,ev,re,r,rp) local rc=re:GetHandler() if Duel.NegateActivation(ev) and rc:IsRelateToEffect(re) and rc:IsAbleToChangeControler() then rc:CancelToGrave() Duel.Overlay(e:GetHandler(),rc) end end