name: Squirt
card_text: Once per turn, when this card is targeted for an attack by an opponent's monster: You can move this card you control to another of your Main Monster Zones, then, Special Summon 1 "Squid Ink Token" (Aqua/WATER/Level 2/ATK ?/DEF 0). This Token's ATK becomes that opponent's monster's ATK. While this card is in your leftmost or rightmost Main Monster Zone, your opponent's monsters with ATK less than or equal to this card's DEF cannot target it for attacks.
external_ids: local CARD_ID_0 = 65500516 --Squid Ink Token
  
lua: local CARD_ID_0 = 65500516 --Squid Ink Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--move
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOKEN + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_BE_BATTLE_TARGET)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.seqtg)
  	e1:SetOperation(s.seqop)
  	c:RegisterEffect(e1)
  	--cannot be battle target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCondition(s.atcon)
  	e2:SetValue(s.atlimit)
  	c:RegisterEffect(e2)
  end
  function s.seqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local a = Duel.GetAttacker()
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0) > 0
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, a:GetAttack(), 0, 2, RACE_AQUA, ATTRIBUTE_WATER)
  	end
  	Duel.SetTargetCard(a)
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.seqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) or c:IsControler(1 - tp) or c:IsImmuneToEffect(e) or Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOZONE)
  	local s = Duel.SelectDisableField(tp, 1, LOCATION_MZONE, 0, 0)
  	local nseq = math.log(s, 2)
  	Duel.MoveSequence(c, nseq)
  	local a = Duel.GetAttacker()
  	local atk = a:IsRelateToEffect(e) and a:GetAttack() or 0
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 or not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, atk, 0, 2, RACE_AQUA, ATTRIBUTE_WATER) then
  		return
  	end
  	Duel.BreakEffect()
  	local token = Duel.CreateToken(tp, id + 1)
  	if Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK)
  		e1:SetValue(atk)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		token:RegisterEffect(e1, true)
  	end
  	Duel.SpecialSummonComplete()
  end
  function s.atcon(e)
  	local seq = e:GetHandler():GetSequence()
  	return seq == 0 or seq == 4
  end
  function s.atlimit(e, c)
  	local tp = e:GetHandlerPlayer()
  	return c:IsControler(1 - tp) and c:IsAttackBelow(e:GetHandler():GetDefense()) and not c:IsImmuneToEffect(e)
  end
  
  
source_text: Squirt
  Once per turn, when this card is targeted for an attack by an opponent's monster: You can move this card you control to another of your Main Monster Zones, then, Special Summon 1 "Squid Ink Token" (Aqua/WATER/Level 2/ATK ?/DEF 0). This Token's ATK becomes that opponent's monster's ATK. While this card is in your leftmost or rightmost Main Monster Zone, your opponent's monsters with ATK less than or equal to this card's DEF cannot target it for attacks.
target_text: -- Squirt
  local CARD_ID_0 = 65500516 --Squid Ink Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--move
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOKEN + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_BE_BATTLE_TARGET)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.seqtg)
  	e1:SetOperation(s.seqop)
  	c:RegisterEffect(e1)
  	--cannot be battle target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCondition(s.atcon)
  	e2:SetValue(s.atlimit)
  	c:RegisterEffect(e2)
  end
  function s.seqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local a = Duel.GetAttacker()
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0) > 0
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, a:GetAttack(), 0, 2, RACE_AQUA, ATTRIBUTE_WATER)
  	end
  	Duel.SetTargetCard(a)
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.seqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) or c:IsControler(1 - tp) or c:IsImmuneToEffect(e) or Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOZONE)
  	local s = Duel.SelectDisableField(tp, 1, LOCATION_MZONE, 0, 0)
  	local nseq = math.log(s, 2)
  	Duel.MoveSequence(c, nseq)
  	local a = Duel.GetAttacker()
  	local atk = a:IsRelateToEffect(e) and a:GetAttack() or 0
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 or not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, atk, 0, 2, RACE_AQUA, ATTRIBUTE_WATER) then
  		return
  	end
  	Duel.BreakEffect()
  	local token = Duel.CreateToken(tp, id + 1)
  	if Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK)
  		e1:SetValue(atk)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		token:RegisterEffect(e1, true)
  	end
  	Duel.SpecialSummonComplete()
  end
  function s.atcon(e)
  	local seq = e:GetHandler():GetSequence()
  	return seq == 0 or seq == 4
  end
  function s.atlimit(e, c)
  	local tp = e:GetHandlerPlayer()
  	return c:IsControler(1 - tp) and c:IsAttackBelow(e:GetHandler():GetDefense()) and not c:IsImmuneToEffect(e)
  end
  
  