name: Spring
card_text: Once per turn: You can choose any number of your unused Main Monster Zones, and if you do, place that number of Season Counters on this card, also those zones cannot be used while this card is on the field. Monsters you control gain 400 ATK for each Season Counter on this card. Once per turn, during your opponent's End Phase: You can take 1 Field Spell from your Deck that you can place a Season Counter on, and place it face-up on your field (but neither player can activate its effects this turn), and if you do, place all Season Counters on this card on that card.
external_ids: local COUNTER_ID_0 = 0x6e --Season
  
lua: local COUNTER_ID_0 = 0x6e --Season
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x6e)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--counter
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.destg)
  	e2:SetOperation(s.desop)
  	c:RegisterEffect(e2)
  	--atk up
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetRange(LOCATION_FZONE)
  	e3:SetTargetRange(LOCATION_MZONE, 0)
  	e3:SetValue(s.val)
  	c:RegisterEffect(e3)
  	--set
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetCode(EVENT_PHASE + PHASE_END)
  	e4:SetCondition(s.setcon)
  	e4:SetTarget(s.settg)
  	e4:SetOperation(s.setop)
  	c:RegisterEffect(e4)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0) > 0
  	end
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0)
  	if ct == 0 then
  		return
  	end
  	if ct > 4 then
  		ct = 5
  	end
  	local t = {}
  	for i = 1, ct do
  		t[i] = ct - i + 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 2))
  	local dsc = Duel.AnnounceNumber(tp, table.unpack(t))
  	local dis = Duel.SelectDisableField(tp, dsc, LOCATION_MZONE, 0, 0xe000e0)
  	e:SetLabel(dis)
  	Duel.Hint(HINT_ZONE, tp, dis)
  	if tp == 1 then
  		dis = ((dis & 0xffff) << 16) | ((dis >> 16) & 0xffff)
  	end
  	--disable field
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetCode(EFFECT_DISABLE_FIELD)
  	e2:SetValue(dis)
  	e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e2)
  	c:AddCounter(COUNTER_ID_0, dsc)
  end
  function s.val(e, c)
  	return e:GetHandler():GetCounter(COUNTER_ID_0) * 400
  end
  function s.setcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.stfilter(c, tp)
  	return c:IsCanHaveCounter(COUNTER_ID_0) and c:IsType(TYPE_FIELD) and not c:IsForbidden() and c:CheckUniqueOnField(tp)
  end
  function s.settg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.stfilter, tp, LOCATION_DECK, 0, 1, nil, tp)
  	end
  end
  function s.setop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local tc = Duel.SelectMatchingCard(tp, s.stfilter, tp, LOCATION_DECK, 0, 1, 1, nil, tp):GetFirst()
  	if tc then
  		local fc = Duel.GetFieldCard(tp, LOCATION_SZONE, 5)
  		local ct = 0
  		if fc then
  			if fc == e:GetHandler() and fc:GetCounter(COUNTER_ID_0) > 0 then
  				ct = fc:GetCounter(COUNTER_ID_0)
  			end
  			Duel.SendtoGrave(fc, REASON_RULE)
  			Duel.BreakEffect()
  		end
  		Duel.MoveToField(tc, tp, tp, LOCATION_FZONE, POS_FACEUP, true)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CANNOT_TRIGGER)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1, true)
  		if ct > 0 and tc:IsCanAddCounter(COUNTER_ID_0, ct) then
  			tc:AddCounter(COUNTER_ID_0, ct)
  		end
  	end
  end
  
  
source_text: Spring
  Once per turn: You can choose any number of your unused Main Monster Zones, and if you do, place that number of Season Counters on this card, also those zones cannot be used while this card is on the field. Monsters you control gain 400 ATK for each Season Counter on this card. Once per turn, during your opponent's End Phase: You can take 1 Field Spell from your Deck that you can place a Season Counter on, and place it face-up on your field (but neither player can activate its effects this turn), and if you do, place all Season Counters on this card on that card.
target_text: -- Spring
  local COUNTER_ID_0 = 0x6e --Season
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x6e)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--counter
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.destg)
  	e2:SetOperation(s.desop)
  	c:RegisterEffect(e2)
  	--atk up
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetRange(LOCATION_FZONE)
  	e3:SetTargetRange(LOCATION_MZONE, 0)
  	e3:SetValue(s.val)
  	c:RegisterEffect(e3)
  	--set
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetCode(EVENT_PHASE + PHASE_END)
  	e4:SetCondition(s.setcon)
  	e4:SetTarget(s.settg)
  	e4:SetOperation(s.setop)
  	c:RegisterEffect(e4)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0) > 0
  	end
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0)
  	if ct == 0 then
  		return
  	end
  	if ct > 4 then
  		ct = 5
  	end
  	local t = {}
  	for i = 1, ct do
  		t[i] = ct - i + 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 2))
  	local dsc = Duel.AnnounceNumber(tp, table.unpack(t))
  	local dis = Duel.SelectDisableField(tp, dsc, LOCATION_MZONE, 0, 0xe000e0)
  	e:SetLabel(dis)
  	Duel.Hint(HINT_ZONE, tp, dis)
  	if tp == 1 then
  		dis = ((dis & 0xffff) << 16) | ((dis >> 16) & 0xffff)
  	end
  	--disable field
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetCode(EFFECT_DISABLE_FIELD)
  	e2:SetValue(dis)
  	e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e2)
  	c:AddCounter(COUNTER_ID_0, dsc)
  end
  function s.val(e, c)
  	return e:GetHandler():GetCounter(COUNTER_ID_0) * 400
  end
  function s.setcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.stfilter(c, tp)
  	return c:IsCanHaveCounter(COUNTER_ID_0) and c:IsType(TYPE_FIELD) and not c:IsForbidden() and c:CheckUniqueOnField(tp)
  end
  function s.settg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.stfilter, tp, LOCATION_DECK, 0, 1, nil, tp)
  	end
  end
  function s.setop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local tc = Duel.SelectMatchingCard(tp, s.stfilter, tp, LOCATION_DECK, 0, 1, 1, nil, tp):GetFirst()
  	if tc then
  		local fc = Duel.GetFieldCard(tp, LOCATION_SZONE, 5)
  		local ct = 0
  		if fc then
  			if fc == e:GetHandler() and fc:GetCounter(COUNTER_ID_0) > 0 then
  				ct = fc:GetCounter(COUNTER_ID_0)
  			end
  			Duel.SendtoGrave(fc, REASON_RULE)
  			Duel.BreakEffect()
  		end
  		Duel.MoveToField(tc, tp, tp, LOCATION_FZONE, POS_FACEUP, true)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CANNOT_TRIGGER)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1, true)
  		if ct > 0 and tc:IsCanAddCounter(COUNTER_ID_0, ct) then
  			tc:AddCounter(COUNTER_ID_0, ct)
  		end
  	end
  end
  
  