name: F.A.
card_text: If you control a "F.A." monster, this card cannot be destroyed by your opponent's card effects. When your "F.A." monster whose Level is at least 5 higher than its original Level battles an opponent's monster and inflicts battle damage to them: You can banish 1 card from your hand, field, or GY. You can only activate this effect of "F.A. Winners" once per turn. If 3 of your "F.A." Field Spells with different names are currently banished, and were all banished by the effect of "F.A. Winners", you win the Duel.
external_ids: local SETCARD_ID_0 = 0x107 --F.A.
  
lua: local SETCARD_ID_0 = 0x107 --F.A.
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCondition(s.indcon)
  	e2:SetValue(aux.indoval)
  	c:RegisterEffect(e2)
  	--banish
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_REMOVE)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_BATTLE_DAMAGE)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.rmcon)
  	e3:SetTarget(s.rmtg)
  	e3:SetOperation(s.rmop)
  	c:RegisterEffect(e3)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.indcon(e)
  	return Duel.IsExistingMatchingCard(s.cfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, nil)
  end
  function s.rmcon(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	local d = a:GetBattleTarget()
  	if not d then
  		return false
  	end
  	if not a:IsControler(tp) then
  		a, d = d, a
  	end
  	return a:IsControler(tp) and a:IsSetCard(SETCARD_ID_0) and a:GetLevel() - a:GetOriginalLevel() >= 5 and ep ~= tp
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsAbleToRemove, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, nil, 1, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, Card.IsAbleToRemove, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc and Duel.Remove(tc, POS_FACEUP, REASON_EFFECT) ~= 0 and tc:IsSetCard(SETCARD_ID_0) and tc:IsType(TYPE_FIELD) then
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 0)
  		local wg = Duel.GetMatchingGroup(s.winfilter, tp, LOCATION_REMOVED, 0, nil)
  		if wg:GetClassCount(Card.GetCode) == 3 then
  			local WIN_REASON_FA_WINNERS = 0x1d
  			Duel.Win(tp, WIN_REASON_FA_WINNERS)
  		end
  	end
  end
  function s.winfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_FIELD) and c:GetFlagEffect(id) ~= 0
  end
  
  
source_text: F.A.
  If you control a "F.A." monster, this card cannot be destroyed by your opponent's card effects. When your "F.A." monster whose Level is at least 5 higher than its original Level battles an opponent's monster and inflicts battle damage to them: You can banish 1 card from your hand, field, or GY. You can only activate this effect of "F.A. Winners" once per turn. If 3 of your "F.A." Field Spells with different names are currently banished, and were all banished by the effect of "F.A. Winners", you win the Duel.
target_text: -- F.A.
  local SETCARD_ID_0 = 0x107 --F.A.
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCondition(s.indcon)
  	e2:SetValue(aux.indoval)
  	c:RegisterEffect(e2)
  	--banish
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_REMOVE)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_BATTLE_DAMAGE)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.rmcon)
  	e3:SetTarget(s.rmtg)
  	e3:SetOperation(s.rmop)
  	c:RegisterEffect(e3)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.indcon(e)
  	return Duel.IsExistingMatchingCard(s.cfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, nil)
  end
  function s.rmcon(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	local d = a:GetBattleTarget()
  	if not d then
  		return false
  	end
  	if not a:IsControler(tp) then
  		a, d = d, a
  	end
  	return a:IsControler(tp) and a:IsSetCard(SETCARD_ID_0) and a:GetLevel() - a:GetOriginalLevel() >= 5 and ep ~= tp
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsAbleToRemove, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, nil, 1, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, Card.IsAbleToRemove, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc and Duel.Remove(tc, POS_FACEUP, REASON_EFFECT) ~= 0 and tc:IsSetCard(SETCARD_ID_0) and tc:IsType(TYPE_FIELD) then
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 0)
  		local wg = Duel.GetMatchingGroup(s.winfilter, tp, LOCATION_REMOVED, 0, nil)
  		if wg:GetClassCount(Card.GetCode) == 3 then
  			local WIN_REASON_FA_WINNERS = 0x1d
  			Duel.Win(tp, WIN_REASON_FA_WINNERS)
  		end
  	end
  end
  function s.winfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_FIELD) and c:GetFlagEffect(id) ~= 0
  end
  
  