name: "A"
card_text: Each time an A-Counter(s) is removed from play by a card effect, place 1 A-Counter on this card. When this card is destroyed, distribute the A-Counters on this card among face-up monsters.
external_ids: local COUNTER_ID_0 = 0x100e --A-Counter
  
lua: local COUNTER_ID_0 = 0x100e --A-Counter
  local s, id, o = GetID()
  function s.initial_effect(c)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--counter1
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_REMOVE_COUNTER + 0x100e)
  	e2:SetOperation(s.ctop1)
  	c:RegisterEffect(e2)
  	--counter2
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e0:SetCode(EVENT_LEAVE_FIELD_P)
  	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e0:SetOperation(s.regop)
  	c:RegisterEffect(e0)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_COUNTER)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_DESTROYED)
  	e3:SetCondition(s.ctcon2)
  	e3:SetOperation(s.ctop2)
  	e3:SetLabelObject(e0)
  	c:RegisterEffect(e3)
  end
  s.counter_add_list = { 0x100e }
  function s.ctop1(e, tp, eg, ep, ev, re, r, rp)
  	e:GetHandler():AddCounter(COUNTER_ID_0, 1)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetHandler():GetCounter(COUNTER_ID_0)
  	e:SetLabel(ct)
  end
  function s.ctcon2(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabelObject():GetLabel()
  	e:SetLabel(ct)
  	return ct > 0
  end
  function s.ctop2(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabel()
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	if g:GetCount() == 0 then
  		return
  	end
  	for i = 1, ct do
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_COUNTER)
  		local sg = g:Select(tp, 1, 1, nil)
  		sg:GetFirst():AddCounter(COUNTER_ID_0, 1)
  	end
  end
  
  
source_text: "A"
  Each time an A-Counter(s) is removed from play by a card effect, place 1 A-Counter on this card. When this card is destroyed, distribute the A-Counters on this card among face-up monsters.
target_text: -- "A"
  local COUNTER_ID_0 = 0x100e --A-Counter
  local s, id, o = GetID()
  function s.initial_effect(c)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--counter1
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_REMOVE_COUNTER + 0x100e)
  	e2:SetOperation(s.ctop1)
  	c:RegisterEffect(e2)
  	--counter2
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e0:SetCode(EVENT_LEAVE_FIELD_P)
  	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e0:SetOperation(s.regop)
  	c:RegisterEffect(e0)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_COUNTER)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_DESTROYED)
  	e3:SetCondition(s.ctcon2)
  	e3:SetOperation(s.ctop2)
  	e3:SetLabelObject(e0)
  	c:RegisterEffect(e3)
  end
  s.counter_add_list = { 0x100e }
  function s.ctop1(e, tp, eg, ep, ev, re, r, rp)
  	e:GetHandler():AddCounter(COUNTER_ID_0, 1)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetHandler():GetCounter(COUNTER_ID_0)
  	e:SetLabel(ct)
  end
  function s.ctcon2(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabelObject():GetLabel()
  	e:SetLabel(ct)
  	return ct > 0
  end
  function s.ctop2(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabel()
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	if g:GetCount() == 0 then
  		return
  	end
  	for i = 1, ct do
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_COUNTER)
  		local sg = g:Select(tp, 1, 1, nil)
  		sg:GetFirst():AddCounter(COUNTER_ID_0, 1)
  	end
  end
  
  