name: Raidraptor
card_text: 2 Level 4 Winged Beast monsters
  If this card is Xyz Summoned, and your opponent's LP is at least 3000 higher than yours: You can make this card gain 3000 ATK. When this card destroys an opponent's monster by battle: You can detach any number of materials from this card; destroy exactly that number of monsters your opponent controls.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, aux.FilterBoolFunction(Card.IsRace, RACE_WINDBEAST), 4, 2)
  	c:EnableReviveLimit()
  	--atkup
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCondition(s.atkcon)
  	e1:SetOperation(s.atkop)
  	c:RegisterEffect(e1)
  	--destroy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BATTLE_DESTROYING)
  	e2:SetCondition(aux.bdocon)
  	e2:SetCost(s.descost)
  	e2:SetTarget(s.destg)
  	e2:SetOperation(s.desop)
  	c:RegisterEffect(e2)
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetLP(tp) <= Duel.GetLP(1 - tp) - 3000 and e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(3000)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  end
  function s.descost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	local rt = Duel.GetFieldGroupCount(tp, 0, LOCATION_MZONE)
  	local ct = c:RemoveOverlayCard(tp, 1, rt, REASON_COST)
  	e:SetLabel(ct)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(aux.TRUE, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_MZONE, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, e:GetLabel(), 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabel()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, aux.TRUE, tp, 0, LOCATION_MZONE, ct, ct, nil)
  	if g:GetCount() > 0 then
  		Duel.HintSelection(g)
  		Duel.Destroy(g, REASON_EFFECT)
  	end
  end
  
  
source_text: Raidraptor
  2 Level 4 Winged Beast monsters
  If this card is Xyz Summoned, and your opponent's LP is at least 3000 higher than yours: You can make this card gain 3000 ATK. When this card destroys an opponent's monster by battle: You can detach any number of materials from this card; destroy exactly that number of monsters your opponent controls.
target_text: -- Raidraptor
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, aux.FilterBoolFunction(Card.IsRace, RACE_WINDBEAST), 4, 2)
  	c:EnableReviveLimit()
  	--atkup
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCondition(s.atkcon)
  	e1:SetOperation(s.atkop)
  	c:RegisterEffect(e1)
  	--destroy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BATTLE_DESTROYING)
  	e2:SetCondition(aux.bdocon)
  	e2:SetCost(s.descost)
  	e2:SetTarget(s.destg)
  	e2:SetOperation(s.desop)
  	c:RegisterEffect(e2)
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetLP(tp) <= Duel.GetLP(1 - tp) - 3000 and e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(3000)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  end
  function s.descost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	local rt = Duel.GetFieldGroupCount(tp, 0, LOCATION_MZONE)
  	local ct = c:RemoveOverlayCard(tp, 1, rt, REASON_COST)
  	e:SetLabel(ct)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(aux.TRUE, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_MZONE, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, e:GetLabel(), 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabel()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, aux.TRUE, tp, 0, LOCATION_MZONE, ct, ct, nil)
  	if g:GetCount() > 0 then
  		Duel.HintSelection(g)
  		Duel.Destroy(g, REASON_EFFECT)
  	end
  end
  
  