name: Outburst
card_text: If you control a monster: You can Special Summon this card from your hand, then destroy all other monsters you control, also you cannot Special Summon monsters, except DARK monsters, while this card is face-up in the Monster Zone. Once per Chain, during your opponent's Main Phase, you can (Quick Effect): Immediately after this effect resolves, Link Summon 1 Dragon Link Monster using materials you control, including this card. You can only use each effect of "Outburst Dragon" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--link summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_MAIN_END)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.lkcon)
  	e2:SetTarget(s.lktg)
  	e2:SetOperation(s.lkop)
  	c:RegisterEffect(e2)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) > 0
  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 e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, 0, e:GetHandler())
  	if #g > 0 then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, #g, 0, 0)
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		local res = false
  		if Duel.SpecialSummonStep(c, 0, tp, tp, false, false, POS_FACEUP) then
  			res = true
  			local e1 = Effect.CreateEffect(c)
  			e1:SetDescription(aux.Stringid(id, 2))
  			e1:SetProperty(EFFECT_FLAG_CLIENT_HINT + EFFECT_FLAG_PLAYER_TARGET)
  			e1:SetType(EFFECT_TYPE_FIELD)
  			e1:SetRange(LOCATION_MZONE)
  			e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e1:SetAbsoluteRange(tp, 1, 0)
  			e1:SetTarget(s.splimit)
  			c:RegisterEffect(e1, true)
  		end
  		Duel.SpecialSummonComplete()
  		local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, 0, e:GetHandler())
  		if res and #g > 0 then
  			Duel.BreakEffect()
  			Duel.Destroy(g, REASON_EFFECT)
  		end
  	end
  end
  function s.splimit(e, c)
  	return not c:IsAttribute(ATTRIBUTE_DARK)
  end
  function s.lkcon(e, tp, eg, ep, ev, re, r, rp)
  	local ph = Duel.GetCurrentPhase()
  	return Duel.GetTurnPlayer() ~= tp and (ph == PHASE_MAIN1 or ph == PHASE_MAIN2)
  end
  function s.lkfilter(c, lc)
  	return c:IsRace(RACE_DRAGON) and c:IsLinkSummonable(nil, lc)
  end
  function s.lktg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.lkfilter, tp, LOCATION_EXTRA, 0, 1, nil, e:GetHandler())
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.lkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsControler(1 - tp) or not c:IsRelateToEffect(e) or c:IsFacedown() then
  		return
  	end
  	local g = Duel.GetMatchingGroup(s.lkfilter, tp, LOCATION_EXTRA, 0, nil, c)
  	if g:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = g:Select(tp, 1, 1, nil)
  		Duel.LinkSummon(tp, sg:GetFirst(), nil, c)
  	end
  end
  
  
source_text: Outburst
  If you control a monster: You can Special Summon this card from your hand, then destroy all other monsters you control, also you cannot Special Summon monsters, except DARK monsters, while this card is face-up in the Monster Zone. Once per Chain, during your opponent's Main Phase, you can (Quick Effect): Immediately after this effect resolves, Link Summon 1 Dragon Link Monster using materials you control, including this card. You can only use each effect of "Outburst Dragon" once per turn.
target_text: -- Outburst
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--link summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_MAIN_END)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.lkcon)
  	e2:SetTarget(s.lktg)
  	e2:SetOperation(s.lkop)
  	c:RegisterEffect(e2)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) > 0
  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 e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, 0, e:GetHandler())
  	if #g > 0 then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, #g, 0, 0)
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		local res = false
  		if Duel.SpecialSummonStep(c, 0, tp, tp, false, false, POS_FACEUP) then
  			res = true
  			local e1 = Effect.CreateEffect(c)
  			e1:SetDescription(aux.Stringid(id, 2))
  			e1:SetProperty(EFFECT_FLAG_CLIENT_HINT + EFFECT_FLAG_PLAYER_TARGET)
  			e1:SetType(EFFECT_TYPE_FIELD)
  			e1:SetRange(LOCATION_MZONE)
  			e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e1:SetAbsoluteRange(tp, 1, 0)
  			e1:SetTarget(s.splimit)
  			c:RegisterEffect(e1, true)
  		end
  		Duel.SpecialSummonComplete()
  		local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, 0, e:GetHandler())
  		if res and #g > 0 then
  			Duel.BreakEffect()
  			Duel.Destroy(g, REASON_EFFECT)
  		end
  	end
  end
  function s.splimit(e, c)
  	return not c:IsAttribute(ATTRIBUTE_DARK)
  end
  function s.lkcon(e, tp, eg, ep, ev, re, r, rp)
  	local ph = Duel.GetCurrentPhase()
  	return Duel.GetTurnPlayer() ~= tp and (ph == PHASE_MAIN1 or ph == PHASE_MAIN2)
  end
  function s.lkfilter(c, lc)
  	return c:IsRace(RACE_DRAGON) and c:IsLinkSummonable(nil, lc)
  end
  function s.lktg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.lkfilter, tp, LOCATION_EXTRA, 0, 1, nil, e:GetHandler())
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.lkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsControler(1 - tp) or not c:IsRelateToEffect(e) or c:IsFacedown() then
  		return
  	end
  	local g = Duel.GetMatchingGroup(s.lkfilter, tp, LOCATION_EXTRA, 0, nil, c)
  	if g:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = g:Select(tp, 1, 1, nil)
  		Duel.LinkSummon(tp, sg:GetFirst(), nil, c)
  	end
  end
  
  