name: Exhausting
card_text: Remove all Spell Counters on the field.
external_ids: local COUNTER_ID_0 = 0x1 --Spell
  
lua: local COUNTER_ID_0 = 0x1 --Spell
  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)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsCanRemoveCounter(tp, 1, 1, COUNTER_ID_0, 1, REASON_EFFECT)
  	end
  end
  function s.filter(c)
  	return c:IsFaceup() and c:GetCounter(COUNTER_ID_0) ~= 0
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, nil)
  	local tc = g:GetFirst()
  	while tc do
  		local cc = tc:GetCounter(COUNTER_ID_0)
  		tc:RemoveCounter(tp, COUNTER_ID_0, cc, REASON_EFFECT)
  		tc = g:GetNext()
  	end
  end
  
  
source_text: Exhausting
  Remove all Spell Counters on the field.
target_text: -- Exhausting
  local COUNTER_ID_0 = 0x1 --Spell
  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)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsCanRemoveCounter(tp, 1, 1, COUNTER_ID_0, 1, REASON_EFFECT)
  	end
  end
  function s.filter(c)
  	return c:IsFaceup() and c:GetCounter(COUNTER_ID_0) ~= 0
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, nil)
  	local tc = g:GetFirst()
  	while tc do
  		local cc = tc:GetCounter(COUNTER_ID_0)
  		tc:RemoveCounter(tp, COUNTER_ID_0, cc, REASON_EFFECT)
  		tc = g:GetNext()
  	end
  end
  
  