name: Linkbelt
card_text: Cannot be Normal Summoned/Set. Must be Special Summoned by its own effect. When you Link Summon: You can Special Summon this card from your hand, and if you do, place 2 counters on it. If a monster is Link Summoned: Remove 2 of these counters from this card (or all, if less than 2). Once per turn, during each Standby Phase: Place 1 of these counters on this card. No monster can be Link Summoned unless this card has at least as many of these counters as that monster's Link Rating. Monsters cannot attack, except Link Monsters.
external_ids: local COUNTER_ID_0 = 0x44 --Counter(Beltlink
  
lua: local COUNTER_ID_0 = 0x44 --Counter(Beltlink
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x44)
  	c:EnableReviveLimit()
  	--connot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_COUNTER)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  	--cannot link summon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetTargetRange(1, 1)
  	e3:SetTarget(s.splimit)
  	c:RegisterEffect(e3)
  	--cannot attack
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_CANNOT_ATTACK)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e4:SetTarget(s.atktg)
  	c:RegisterEffect(e4)
  	--counter
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 1))
  	e5:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e5:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e5:SetRange(LOCATION_MZONE)
  	e5:SetCondition(s.ctcon1)
  	e5:SetOperation(s.ctop1)
  	c:RegisterEffect(e5)
  	--counter
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 2))
  	e6:SetCategory(CATEGORY_COUNTER)
  	e6:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e6:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e6:SetCountLimit(1)
  	e6:SetRange(LOCATION_MZONE)
  	e6:SetOperation(s.ctop2)
  	c:RegisterEffect(e6)
  end
  function s.cfilter(c, tp)
  	return c:IsFaceup() and c:IsSummonPlayer(tp) and c:IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp)
  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, true, false) and Duel.IsCanAddCounter(tp, COUNTER_ID_0, 1, e:GetHandler())
  	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 c:IsRelateToEffect(e) and Duel.SpecialSummon(c, 0, tp, tp, true, false, POS_FACEUP) ~= 0 then
  		c:AddCounter(COUNTER_ID_0, 2)
  		c:CompleteProcedure()
  	end
  end
  function s.splimit(e, c, tp, sumtp, sumpos)
  	return c:GetLink() > e:GetHandler():GetCounter(COUNTER_ID_0) and bit.band(sumtp, SUMMON_TYPE_LINK) == SUMMON_TYPE_LINK
  end
  function s.atktg(e, c)
  	return not c:IsType(TYPE_LINK)
  end
  function s.ctcon1(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(Card.IsSummonType, 1, nil, SUMMON_TYPE_LINK)
  end
  function s.ctop1(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		c:RemoveCounter(tp, COUNTER_ID_0, 2, REASON_EFFECT)
  	end
  end
  function s.ctop2(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		c:AddCounter(COUNTER_ID_0, 1)
  	end
  end
  
  
source_text: Linkbelt
  Cannot be Normal Summoned/Set. Must be Special Summoned by its own effect. When you Link Summon: You can Special Summon this card from your hand, and if you do, place 2 counters on it. If a monster is Link Summoned: Remove 2 of these counters from this card (or all, if less than 2). Once per turn, during each Standby Phase: Place 1 of these counters on this card. No monster can be Link Summoned unless this card has at least as many of these counters as that monster's Link Rating. Monsters cannot attack, except Link Monsters.
target_text: -- Linkbelt
  local COUNTER_ID_0 = 0x44 --Counter(Beltlink
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x44)
  	c:EnableReviveLimit()
  	--connot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_COUNTER)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  	--cannot link summon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetTargetRange(1, 1)
  	e3:SetTarget(s.splimit)
  	c:RegisterEffect(e3)
  	--cannot attack
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_CANNOT_ATTACK)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e4:SetTarget(s.atktg)
  	c:RegisterEffect(e4)
  	--counter
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 1))
  	e5:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e5:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e5:SetRange(LOCATION_MZONE)
  	e5:SetCondition(s.ctcon1)
  	e5:SetOperation(s.ctop1)
  	c:RegisterEffect(e5)
  	--counter
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 2))
  	e6:SetCategory(CATEGORY_COUNTER)
  	e6:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e6:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e6:SetCountLimit(1)
  	e6:SetRange(LOCATION_MZONE)
  	e6:SetOperation(s.ctop2)
  	c:RegisterEffect(e6)
  end
  function s.cfilter(c, tp)
  	return c:IsFaceup() and c:IsSummonPlayer(tp) and c:IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp)
  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, true, false) and Duel.IsCanAddCounter(tp, COUNTER_ID_0, 1, e:GetHandler())
  	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 c:IsRelateToEffect(e) and Duel.SpecialSummon(c, 0, tp, tp, true, false, POS_FACEUP) ~= 0 then
  		c:AddCounter(COUNTER_ID_0, 2)
  		c:CompleteProcedure()
  	end
  end
  function s.splimit(e, c, tp, sumtp, sumpos)
  	return c:GetLink() > e:GetHandler():GetCounter(COUNTER_ID_0) and bit.band(sumtp, SUMMON_TYPE_LINK) == SUMMON_TYPE_LINK
  end
  function s.atktg(e, c)
  	return not c:IsType(TYPE_LINK)
  end
  function s.ctcon1(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(Card.IsSummonType, 1, nil, SUMMON_TYPE_LINK)
  end
  function s.ctop1(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		c:RemoveCounter(tp, COUNTER_ID_0, 2, REASON_EFFECT)
  	end
  end
  function s.ctop2(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		c:AddCounter(COUNTER_ID_0, 1)
  	end
  end
  
  