name: "A"
card_text: Select 1 face-up "Alien" monster you control. Destroy it and distribute new A-Counters equal to its Level among your opponent's face-up monsters.
external_ids: local SETCARD_ID_0 = 0xc --Alien
  local COUNTER_ID_0 = 0x100e --A-Counter
  
lua: local SETCARD_ID_0 = 0xc --Alien
  local COUNTER_ID_0 = 0x100e --A-Counter
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--counter
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_COUNTER + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  s.counter_add_list = { 0x100e }
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:GetLevel() > 0
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(Card.IsCanAddCounter, tp, 0, LOCATION_MZONE, 1, nil, 0x100e, 1)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local lv = tc:GetLevel()
  		if Duel.Destroy(tc, REASON_EFFECT) == 0 then
  			return
  		end
  		local g = Duel.GetMatchingGroup(Card.IsCanAddCounter, tp, 0, LOCATION_MZONE, nil, 0x100e, 1)
  		if g:GetCount() == 0 then
  			return
  		end
  		for i = 1, lv do
  			local sg = g:Select(tp, 1, 1, nil)
  			sg:GetFirst():AddCounter(COUNTER_ID_0, 1)
  		end
  	end
  end
  
  
source_text: "A"
  Select 1 face-up "Alien" monster you control. Destroy it and distribute new A-Counters equal to its Level among your opponent's face-up monsters.
target_text: -- "A"
  local SETCARD_ID_0 = 0xc --Alien
  local COUNTER_ID_0 = 0x100e --A-Counter
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--counter
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_COUNTER + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  s.counter_add_list = { 0x100e }
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:GetLevel() > 0
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(Card.IsCanAddCounter, tp, 0, LOCATION_MZONE, 1, nil, 0x100e, 1)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local lv = tc:GetLevel()
  		if Duel.Destroy(tc, REASON_EFFECT) == 0 then
  			return
  		end
  		local g = Duel.GetMatchingGroup(Card.IsCanAddCounter, tp, 0, LOCATION_MZONE, nil, 0x100e, 1)
  		if g:GetCount() == 0 then
  			return
  		end
  		for i = 1, lv do
  			local sg = g:Select(tp, 1, 1, nil)
  			sg:GetFirst():AddCounter(COUNTER_ID_0, 1)
  		end
  	end
  end
  
  