name: Raidraptor's
card_text: When a monster effect is activated: Detach 1 material from your DARK Xyz Monster; negate the activation, and if you do, destroy that card, then if the detached material was a "The Phantom Knights", "Raidraptor", or "Xyz Dragon" card, 1 "Raidraptor" Xyz Monster you control gains ATK equal to that destroyed monster's original ATK. You can only activate 1 "Raidraptor's Phantom Knights Claw" per turn.
external_ids: local SETCARD_ID_0 = 0xba --Raidraptor
  
lua: local SETCARD_ID_0 = 0xba --Raidraptor
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return re:IsActiveType(TYPE_MONSTER) and Duel.IsChainNegatable(ev)
  end
  function s.cfilter(c, tp)
  	return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_DARK) and c:IsType(TYPE_XYZ) and c:CheckRemoveOverlayCard(tp, 1, REASON_COST)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DEATTACHFROM)
  	local c = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, tp):GetFirst()
  	c:RemoveOverlayCard(tp, 1, 1, REASON_COST)
  	local tc = Duel.GetOperatedGroup():GetFirst()
  	if tc:IsSetCard(SETCARD_ID_0, 0x10db, 0x2073) then
  		e:SetLabel(1)
  	else
  		e:SetLabel(0)
  	end
  end
  function s.target(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)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.tgfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_XYZ)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg, REASON_EFFECT) > 0 and e:GetLabel() == 1 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELF)
  		local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  		local tc = g:GetFirst()
  		if tc then
  			Duel.HintSelection(g)
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e1:SetValue(eg:GetFirst():GetBaseAttack())
  			tc:RegisterEffect(e1)
  		end
  	end
  end
  
  
source_text: Raidraptor's
  When a monster effect is activated: Detach 1 material from your DARK Xyz Monster; negate the activation, and if you do, destroy that card, then if the detached material was a "The Phantom Knights", "Raidraptor", or "Xyz Dragon" card, 1 "Raidraptor" Xyz Monster you control gains ATK equal to that destroyed monster's original ATK. You can only activate 1 "Raidraptor's Phantom Knights Claw" per turn.
target_text: -- Raidraptor's
  local SETCARD_ID_0 = 0xba --Raidraptor
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return re:IsActiveType(TYPE_MONSTER) and Duel.IsChainNegatable(ev)
  end
  function s.cfilter(c, tp)
  	return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_DARK) and c:IsType(TYPE_XYZ) and c:CheckRemoveOverlayCard(tp, 1, REASON_COST)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DEATTACHFROM)
  	local c = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, tp):GetFirst()
  	c:RemoveOverlayCard(tp, 1, 1, REASON_COST)
  	local tc = Duel.GetOperatedGroup():GetFirst()
  	if tc:IsSetCard(SETCARD_ID_0, 0x10db, 0x2073) then
  		e:SetLabel(1)
  	else
  		e:SetLabel(0)
  	end
  end
  function s.target(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)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.tgfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_XYZ)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg, REASON_EFFECT) > 0 and e:GetLabel() == 1 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELF)
  		local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  		local tc = g:GetFirst()
  		if tc then
  			Duel.HintSelection(g)
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e1:SetValue(eg:GetFirst():GetBaseAttack())
  			tc:RegisterEffect(e1)
  		end
  	end
  end
  
  