name: Balloon
card_text: Put 1 counter on this card during each of your Standby Phases. When this card is destroyed, inflict damage to the controller of the card that destroyed it equal to the number of counters x 400 points.
external_ids: local COUNTER_ID_0 = 0x29 --Counter(Balloon
  
lua: local COUNTER_ID_0 = 0x29 --Counter(Balloon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x29)
  	--counter
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_COUNTER)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.addccon)
  	e1:SetTarget(s.addct)
  	e1:SetOperation(s.addc)
  	c:RegisterEffect(e1)
  	--damage
  	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 e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_DESTROYED)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCondition(s.damcon)
  	e2:SetTarget(s.damtg)
  	e2:SetOperation(s.damop)
  	e2:SetLabelObject(e0)
  	c:RegisterEffect(e2)
  end
  function s.addccon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.addct(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_COUNTER, nil, 1, 0, 0x29)
  end
  function s.addc(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) then
  		e:GetHandler():AddCounter(COUNTER_ID_0, 1)
  	end
  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.damcon(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabelObject():GetLabel()
  	e:SetLabel(ct)
  	return ct > 0
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(rp)
  	Duel.SetTargetParam(e:GetLabel() * 400)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, rp, e:GetLabel() * 400)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  
source_text: Balloon
  Put 1 counter on this card during each of your Standby Phases. When this card is destroyed, inflict damage to the controller of the card that destroyed it equal to the number of counters x 400 points.
target_text: -- Balloon
  local COUNTER_ID_0 = 0x29 --Counter(Balloon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x29)
  	--counter
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_COUNTER)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.addccon)
  	e1:SetTarget(s.addct)
  	e1:SetOperation(s.addc)
  	c:RegisterEffect(e1)
  	--damage
  	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 e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_DESTROYED)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCondition(s.damcon)
  	e2:SetTarget(s.damtg)
  	e2:SetOperation(s.damop)
  	e2:SetLabelObject(e0)
  	c:RegisterEffect(e2)
  end
  function s.addccon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.addct(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_COUNTER, nil, 1, 0, 0x29)
  end
  function s.addc(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) then
  		e:GetHandler():AddCounter(COUNTER_ID_0, 1)
  	end
  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.damcon(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabelObject():GetLabel()
  	e:SetLabel(ct)
  	return ct > 0
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(rp)
  	Duel.SetTargetParam(e:GetLabel() * 400)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, rp, e:GetLabel() * 400)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  