name: Meteor
card_text: During the Battle Phase, if 5 or more attacks have been declared this turn (Quick Effect): You can Special Summon this card from your hand. You can only use this effect of "Meteor Rush - Monochroid" once per turn. If this card battles, it gains 1000 ATK for each attack declared this turn, during the Damage Step only.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetHintTiming(0, TIMING_BATTLE_END)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetCondition(s.atkcon)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	--
  	if not s.global_check then
  		s.global_check = true
  		local ge1 = Effect.CreateEffect(c)
  		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge1:SetCode(EVENT_ATTACK_ANNOUNCE)
  		ge1:SetOperation(s.checkop)
  		Duel.RegisterEffect(ge1, 0)
  	end
  end
  function s.checkop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.RegisterFlagEffect(Duel.GetAttacker():GetControler(), id, RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	local ph = Duel.GetCurrentPhase()
  	return ph >= PHASE_BATTLE_START and ph <= PHASE_BATTLE and (Duel.GetFlagEffect(0, id) + Duel.GetFlagEffect(1, id)) >= 5
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  end
  function s.atkcon(e)
  	local ph = Duel.GetCurrentPhase()
  	return (ph == PHASE_DAMAGE or ph == PHASE_DAMAGE_CAL) and (Duel.GetAttacker() == e:GetHandler() or Duel.GetAttackTarget() == e:GetHandler())
  end
  function s.atkval(e, c, tp)
  	return Duel.GetFlagEffect(Duel.GetTurnPlayer(), id) * 1000
  end
  
  
source_text: Meteor
  During the Battle Phase, if 5 or more attacks have been declared this turn (Quick Effect): You can Special Summon this card from your hand. You can only use this effect of "Meteor Rush - Monochroid" once per turn. If this card battles, it gains 1000 ATK for each attack declared this turn, during the Damage Step only.
target_text: -- Meteor
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetHintTiming(0, TIMING_BATTLE_END)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetCondition(s.atkcon)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	--
  	if not s.global_check then
  		s.global_check = true
  		local ge1 = Effect.CreateEffect(c)
  		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge1:SetCode(EVENT_ATTACK_ANNOUNCE)
  		ge1:SetOperation(s.checkop)
  		Duel.RegisterEffect(ge1, 0)
  	end
  end
  function s.checkop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.RegisterFlagEffect(Duel.GetAttacker():GetControler(), id, RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	local ph = Duel.GetCurrentPhase()
  	return ph >= PHASE_BATTLE_START and ph <= PHASE_BATTLE and (Duel.GetFlagEffect(0, id) + Duel.GetFlagEffect(1, id)) >= 5
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  end
  function s.atkcon(e)
  	local ph = Duel.GetCurrentPhase()
  	return (ph == PHASE_DAMAGE or ph == PHASE_DAMAGE_CAL) and (Duel.GetAttacker() == e:GetHandler() or Duel.GetAttackTarget() == e:GetHandler())
  end
  function s.atkval(e, c, tp)
  	return Duel.GetFlagEffect(Duel.GetTurnPlayer(), id) * 1000
  end
  
  