Black
When an opponent's monster declares an attack on a "Blackwing" monster you control: Banish all face-up Attack Position monsters your opponent controls. If you control exactly 3 "Blackwing" monsters (and no other monsters), you can activate this card from your hand.
local SETCARD_ID_0 = 0x33 --Blackwing

local SETCARD_ID_0 = 0x33 --Blackwing
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_REMOVE)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
	e1:SetCondition(s.condition)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
	--act in hand
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetType(EFFECT_TYPE_SINGLE)
	e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
	e2:SetCondition(s.handcon)
	c:RegisterEffect(e2)
end
function s.cfilter(c)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
end
function s.handcon(e)
	local g = Duel.GetFieldGroup(e:GetHandlerPlayer(), LOCATION_MZONE, 0)
	return g:GetCount() == 3 and g:IsExists(s.cfilter, 3, nil)
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetAttackTarget()
	return tc and tc:IsFaceup() and tc:IsControler(tp) and tc:IsSetCard(SETCARD_ID_0)
end
function s.filter(c)
	return c:IsPosition(POS_FACEUP_ATTACK) and c:IsAbleToRemove()
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
	end
	local g = Duel.GetMatchingGroup(s.filter, tp, 0, LOCATION_MZONE, nil)
	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, g:GetCount(), 0, 0)
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local g = Duel.GetMatchingGroup(s.filter, tp, 0, LOCATION_MZONE, nil)
	if g:GetCount() > 0 then
		Duel.Remove(g, POS_FACEUP, REASON_EFFECT)
	end
end


Black
When an opponent's monster declares an attack on a "Blackwing" monster you control: Banish all face-up Attack Position monsters your opponent controls. If you control exactly 3 "Blackwing" monsters (and no other monsters), you can activate this card from your hand.
-- Black
local SETCARD_ID_0 = 0x33 --Blackwing
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_REMOVE)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
	e1:SetCondition(s.condition)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
	--act in hand
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetType(EFFECT_TYPE_SINGLE)
	e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
	e2:SetCondition(s.handcon)
	c:RegisterEffect(e2)
end
function s.cfilter(c)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
end
function s.handcon(e)
	local g = Duel.GetFieldGroup(e:GetHandlerPlayer(), LOCATION_MZONE, 0)
	return g:GetCount() == 3 and g:IsExists(s.cfilter, 3, nil)
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetAttackTarget()
	return tc and tc:IsFaceup() and tc:IsControler(tp) and tc:IsSetCard(SETCARD_ID_0)
end
function s.filter(c)
	return c:IsPosition(POS_FACEUP_ATTACK) and c:IsAbleToRemove()
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
	end
	local g = Duel.GetMatchingGroup(s.filter, tp, 0, LOCATION_MZONE, nil)
	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, g:GetCount(), 0, 0)
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local g = Duel.GetMatchingGroup(s.filter, tp, 0, LOCATION_MZONE, nil)
	if g:GetCount() > 0 then
		Duel.Remove(g, POS_FACEUP, REASON_EFFECT)
	end
end

