name: Blackwing
card_text: During damage calculation, you can send this card from your hand to the Graveyard to prevent a "Blackwing" monster you control from being destroyed by this battle.
external_ids: local SETCARD_ID_0 = 0x33 --Blackwing
  
lua: local SETCARD_ID_0 = 0x33 --Blackwing
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.condition)
  	e2:SetCost(s.cost)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	local d = Duel.GetAttackTarget()
  	if not d then
  		return false
  	end
  	return (a:IsControler(tp) and a:IsSetCard(SETCARD_ID_0)) or (d:IsControler(tp) and d:IsSetCard(SETCARD_ID_0))
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToGraveAsCost()
  	end
  	Duel.SendtoGrave(e:GetHandler(), REASON_COST)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	if Duel.GetTurnPlayer() ~= tp then
  		a = Duel.GetAttackTarget()
  	end
  	if not a:IsRelateToBattle() then
  		return
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL)
  	e1:SetValue(1)
  	a:RegisterEffect(e1)
  end
  
  
source_text: Blackwing
  During damage calculation, you can send this card from your hand to the Graveyard to prevent a "Blackwing" monster you control from being destroyed by this battle.
target_text: -- Blackwing
  local SETCARD_ID_0 = 0x33 --Blackwing
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.condition)
  	e2:SetCost(s.cost)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	local d = Duel.GetAttackTarget()
  	if not d then
  		return false
  	end
  	return (a:IsControler(tp) and a:IsSetCard(SETCARD_ID_0)) or (d:IsControler(tp) and d:IsSetCard(SETCARD_ID_0))
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToGraveAsCost()
  	end
  	Duel.SendtoGrave(e:GetHandler(), REASON_COST)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	if Duel.GetTurnPlayer() ~= tp then
  		a = Duel.GetAttackTarget()
  	end
  	if not a:IsRelateToBattle() then
  		return
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL)
  	e1:SetValue(1)
  	a:RegisterEffect(e1)
  end
  
  