--Insector Battle Beatle local s,id=GetID() function s.initial_effect(c) aux.AddOrigTimeleapType(c,false) aux.AddTimeleapProc(c,5,s.sumcon,s.tlfilter) c:EnableReviveLimit() aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_DESTROY) ge1:SetLabel(id) ge1:SetCondition(s.regcon) ge1:SetOperation(s.regop) Duel.RegisterEffect(ge1,0) end) --This card must attack, if able. local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_MUST_ATTACK) c:RegisterEffect(e1) --If this card battles, neither player can activate cards or effects until the end of the Damage Step. local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_CANNOT_ACTIVATE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(1,1) e2:SetValue(1) e2:SetCondition(s.actcon) c:RegisterEffect(e2) --Monsters that were destroyed by battle cannot activate their effects in the GY. local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_ACTIVATE) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(1,1) e3:SetValue(s.aclimit) c:RegisterEffect(e3) --Once per turn, during your Main Phase 2: You can banish 1 monster from your GY; inflict damage to your opponent equal to that monster's Level/Rank/Link Rating/Future x100. local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_DAMAGE+CATEGORY_REMOVE) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.damcon) e4:SetTarget(s.damtg) e4:SetOperation(s.damop) c:RegisterEffect(e4) end function s.sumcon(e,c) return Duel.GetFlagEffect(e:GetHandlerPlayer(),id)>0 end function s.tlfilter(c,e,mg) local tp=c:GetControler() local ef=e:GetHandler():GetFuture() return c:IsLevelBelow(ef-1) and c:IsType(TYPE_EFFECT) end function s.regfilter(c,r) return c:IsType(TYPE_MONSTER) end function s.regcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.regfilter,1,nil,r) end function s.regop(e,tp,eg,ep,ev,re,r,rp) Duel.RegisterFlagEffect(tp,id,RESET_PHASE+PHASE_END,0,1) Duel.RegisterFlagEffect(1-tp,id,RESET_PHASE+PHASE_END,0,1) end function s.actcon(e,re,tp) return Duel.GetAttacker()==e:GetHandler() or Duel.GetAttackTarget()==e:GetHandler() end function s.aclimit(e,re,tp) if not re or not re:GetHandler() then return false end local rc=re:GetHandler() return rc:IsLocation(LOCATION_GRAVE) and rc:IsReason(REASON_BATTLE) and re:IsActiveType(TYPE_MONSTER) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentPhase()==PHASE_MAIN2 end function s.damfilter(c) return c:IsMonster() and c:IsAbleToRemoveAsCost() and (c:HasLevel() or c:IsType(TYPE_XYZ+TYPE_LINK+TYPE_TIMELEAP)) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.damfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.damfilter,tp,LOCATION_GRAVE,0,1,1,nil) local tc=g:GetFirst() Duel.Remove(tc,POS_FACEUP,REASON_COST) local dam=0 if tc:IsType(TYPE_XYZ) then dam=tc:GetRank()*100 elseif tc:IsType(TYPE_LINK) then dam=tc:GetLink()*100 elseif tc:IsType(TYPE_TIMELEAP) then dam=tc:GetFuture()*100 else dam=tc:GetLevel()*100 end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end