name: F.A.
card_text: If only your opponent controls a monster: Special Summon 1 "F.A." monster from your hand, and if you do, increase its Level by 3 until the end of this turn. If this card is in the GY and you control no cards in your Field Zone: You can banish this card from the GY; activate 1 "F.A." Field Spell directly from your hand or GY. You can only use this effect of "F.A. Overheat" once per turn.
external_ids: local CARD_ID_0 = 4179255 --Ancient Pixie Dragon
  local SETCARD_ID_0 = 0x107 --F.A.
  
lua: local CARD_ID_0 = 4179255 --Ancient Pixie Dragon
  local SETCARD_ID_0 = 0x107 --F.A.
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--activate Spell
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.condition2)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.target2)
  	e2:SetOperation(s.activate2)
  	c:RegisterEffect(e2)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) == 0 and Duel.GetFieldGroupCount(tp, 0, LOCATION_MZONE) > 0
  end
  function s.filter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp)
  	local tc = g:GetFirst()
  	if tc then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_LEVEL)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e1:SetValue(3)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.condition2(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFieldCard(tp, LOCATION_FZONE, 0) == nil
  end
  function s.filter2(c, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_FIELD) and c:GetActivateEffect():IsActivatable(tp, true, true)
  end
  function s.target2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, nil, tp)
  	end
  end
  function s.activate2(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local tc = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter2), tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, 1, nil, tp):GetFirst()
  	if tc then
  		local fc = Duel.GetFieldCard(tp, LOCATION_FZONE, 0)
  		if fc then
  			Duel.SendtoGrave(fc, REASON_RULE)
  			Duel.BreakEffect()
  		end
  		Duel.MoveToField(tc, tp, tp, LOCATION_FZONE, POS_FACEUP, true)
  		local te = tc:GetActivateEffect()
  		te:UseCountLimit(tp, 1, true)
  		local tep = tc:GetControler()
  		local cost = te:GetCost()
  		if cost then
  			cost(te, tep, eg, ep, ev, re, r, rp, 1)
  		end
  		Duel.RaiseEvent(tc, CARD_ID_0, te, 0, tp, tp, Duel.GetCurrentChain())
  	end
  end
  
  
source_text: F.A.
  If only your opponent controls a monster: Special Summon 1 "F.A." monster from your hand, and if you do, increase its Level by 3 until the end of this turn. If this card is in the GY and you control no cards in your Field Zone: You can banish this card from the GY; activate 1 "F.A." Field Spell directly from your hand or GY. You can only use this effect of "F.A. Overheat" once per turn.
target_text: -- F.A.
  local CARD_ID_0 = 4179255 --Ancient Pixie Dragon
  local SETCARD_ID_0 = 0x107 --F.A.
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--activate Spell
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.condition2)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.target2)
  	e2:SetOperation(s.activate2)
  	c:RegisterEffect(e2)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) == 0 and Duel.GetFieldGroupCount(tp, 0, LOCATION_MZONE) > 0
  end
  function s.filter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp)
  	local tc = g:GetFirst()
  	if tc then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_LEVEL)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e1:SetValue(3)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.condition2(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFieldCard(tp, LOCATION_FZONE, 0) == nil
  end
  function s.filter2(c, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_FIELD) and c:GetActivateEffect():IsActivatable(tp, true, true)
  end
  function s.target2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, nil, tp)
  	end
  end
  function s.activate2(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local tc = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter2), tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, 1, nil, tp):GetFirst()
  	if tc then
  		local fc = Duel.GetFieldCard(tp, LOCATION_FZONE, 0)
  		if fc then
  			Duel.SendtoGrave(fc, REASON_RULE)
  			Duel.BreakEffect()
  		end
  		Duel.MoveToField(tc, tp, tp, LOCATION_FZONE, POS_FACEUP, true)
  		local te = tc:GetActivateEffect()
  		te:UseCountLimit(tp, 1, true)
  		local tep = tc:GetControler()
  		local cost = te:GetCost()
  		if cost then
  			cost(te, tep, eg, ep, ev, re, r, rp, 1)
  		end
  		Duel.RaiseEvent(tc, CARD_ID_0, te, 0, tp, tp, Duel.GetCurrentChain())
  	end
  end
  
  