name: Blockman
card_text: You can Tribute this card; Special Summon in Defense Position, a number of "Block Tokens" (Rock-Type/EARTH/Level 4/ATK 1000/DEF 1500) equal to the number of your turns this card has been face-up on your field. These Tokens cannot declare an attack.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 48115278 --Block Token
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 48115278 --Block Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--check
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EVENT_PHASE_START + PHASE_DRAW)
  	e1:SetCondition(s.regcon)
  	e1:SetOperation(s.regop)
  	c:RegisterEffect(e1)
  	--token
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCost(s.spcost)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = c:GetFlagEffectLabel(id)
  	if not ct then
  		c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1, 0)
  	else
  		c:SetFlagEffectLabel(id, ct + 1)
  	end
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	local ct = e:GetHandler():GetFlagEffectLabel(id)
  	if not ct then
  		ct = 0
  	end
  	e:SetLabel(ct)
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local ct = e:GetHandler():GetFlagEffectLabel(id)
  		if not ct then
  			ct = 0
  		end
  		return (ct == 0 or not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0))
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > ct - 1
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 1000, 1500, 4, RACE_ROCK, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE)
  	end
  	local ct = e:GetLabel()
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, ct + 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, ct + 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabel()
  	if ct > 0 and Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) > ct and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 1000, 1500, 4, RACE_ROCK, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE) then
  		for i = 1, ct + 1 do
  			local token = Duel.CreateToken(tp, id + 1)
  			Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_CANNOT_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			token:RegisterEffect(e1, true)
  		end
  		Duel.SpecialSummonComplete()
  	end
  end
  
  
source_text: Blockman
  You can Tribute this card; Special Summon in Defense Position, a number of "Block Tokens" (Rock-Type/EARTH/Level 4/ATK 1000/DEF 1500) equal to the number of your turns this card has been face-up on your field. These Tokens cannot declare an attack.
target_text: -- Blockman
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 48115278 --Block Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--check
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EVENT_PHASE_START + PHASE_DRAW)
  	e1:SetCondition(s.regcon)
  	e1:SetOperation(s.regop)
  	c:RegisterEffect(e1)
  	--token
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCost(s.spcost)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = c:GetFlagEffectLabel(id)
  	if not ct then
  		c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1, 0)
  	else
  		c:SetFlagEffectLabel(id, ct + 1)
  	end
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	local ct = e:GetHandler():GetFlagEffectLabel(id)
  	if not ct then
  		ct = 0
  	end
  	e:SetLabel(ct)
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local ct = e:GetHandler():GetFlagEffectLabel(id)
  		if not ct then
  			ct = 0
  		end
  		return (ct == 0 or not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0))
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > ct - 1
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 1000, 1500, 4, RACE_ROCK, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE)
  	end
  	local ct = e:GetLabel()
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, ct + 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, ct + 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local ct = e:GetLabel()
  	if ct > 0 and Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) > ct and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 1000, 1500, 4, RACE_ROCK, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE) then
  		for i = 1, ct + 1 do
  			local token = Duel.CreateToken(tp, id + 1)
  			Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_CANNOT_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			token:RegisterEffect(e1, true)
  		end
  		Duel.SpecialSummonComplete()
  	end
  end
  
  