name: Spright
card_text: If you control a Level/Link 2 monster, you can Special Summon this card (from your hand). You can only Special Summon "Spright Red" once per turn this way. When your opponent activates a monster effect (Quick Effect): You can Tribute 1 other Level/Rank/Link 2 monster; negate that effect, then if you Tributed a Rank/Link 2 monster to activate this effect, you can destroy that monster. You can only use this effect of "Spright Red" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	c:RegisterEffect(e1)
  	--disable
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DESTROY + CATEGORY_DISABLE)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCondition(s.discon)
  	e2:SetCost(s.discost)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return (c:IsLevel(2) or c:IsLink(2)) and c:IsFaceup()
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	return Duel.GetLocationCount(c:GetControler(), LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, c:GetControler(), LOCATION_MZONE, 0, 1, nil)
  end
  function s.discon(e, tp, eg, ep, ev, re, r, rp)
  	return ep ~= tp and re:IsActiveType(TYPE_MONSTER) and Duel.IsChainDisablable(ev)
  end
  function s.cfilter(c)
  	return c:IsLevel(2) or c:IsRank(2) or c:IsLink(2)
  end
  function s.discost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.cfilter, 1, e:GetHandler())
  	end
  	local g = Duel.SelectReleaseGroup(tp, s.cfilter, 1, 1, e:GetHandler())
  	Duel.Release(g, REASON_COST)
  	local tc = Duel.GetOperatedGroup():GetFirst()
  	e:SetLabelObject(tc)
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE, eg, 1, 0, 0)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local rc = re:GetHandler()
  	if Duel.NegateEffect(ev) and rc:IsRelateToEffect(re) and rc:IsDestructable() and (e:GetLabelObject():IsRank(2) or e:GetLabelObject():IsLink(2)) and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  		Duel.BreakEffect()
  		Duel.Destroy(rc, REASON_EFFECT)
  	end
  end
  
  
source_text: Spright
  If you control a Level/Link 2 monster, you can Special Summon this card (from your hand). You can only Special Summon "Spright Red" once per turn this way. When your opponent activates a monster effect (Quick Effect): You can Tribute 1 other Level/Rank/Link 2 monster; negate that effect, then if you Tributed a Rank/Link 2 monster to activate this effect, you can destroy that monster. You can only use this effect of "Spright Red" once per turn.
target_text: -- Spright
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	c:RegisterEffect(e1)
  	--disable
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DESTROY + CATEGORY_DISABLE)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCondition(s.discon)
  	e2:SetCost(s.discost)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return (c:IsLevel(2) or c:IsLink(2)) and c:IsFaceup()
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	return Duel.GetLocationCount(c:GetControler(), LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, c:GetControler(), LOCATION_MZONE, 0, 1, nil)
  end
  function s.discon(e, tp, eg, ep, ev, re, r, rp)
  	return ep ~= tp and re:IsActiveType(TYPE_MONSTER) and Duel.IsChainDisablable(ev)
  end
  function s.cfilter(c)
  	return c:IsLevel(2) or c:IsRank(2) or c:IsLink(2)
  end
  function s.discost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.cfilter, 1, e:GetHandler())
  	end
  	local g = Duel.SelectReleaseGroup(tp, s.cfilter, 1, 1, e:GetHandler())
  	Duel.Release(g, REASON_COST)
  	local tc = Duel.GetOperatedGroup():GetFirst()
  	e:SetLabelObject(tc)
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE, eg, 1, 0, 0)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local rc = re:GetHandler()
  	if Duel.NegateEffect(ev) and rc:IsRelateToEffect(re) and rc:IsDestructable() and (e:GetLabelObject():IsRank(2) or e:GetLabelObject():IsLink(2)) and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  		Duel.BreakEffect()
  		Duel.Destroy(rc, REASON_EFFECT)
  	end
  end
  
  