name: Tellus
card_text: If this card is sent from the Monster Zone to the GY: You can Special Summon 1 "Tellus Wing Token" (Fairy/LIGHT/Level 1/ATK 0/DEF 0). While you control a "Tellus Wing Token": You can banish this card from your GY and 1 Spell from your hand; Special Summon 2 "Tellus Wing Tokens", also you cannot Special Summon for the rest of this turn, except from your hand. You can only use each effect of "Tellus the Little Angel" once per turn.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 19280590 --Tellus Wing Token
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 19280590 --Tellus Wing Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Special Summon 1 Token
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_TO_GRAVE)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.tkcon1)
  	e1:SetTarget(s.tktg1)
  	e1:SetOperation(s.tkop1)
  	c:RegisterEffect(e1)
  	--Special Summon 2 Token
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCost(s.tkcost2)
  	e2:SetCondition(s.tkcon2)
  	e2:SetTarget(s.tktg2)
  	e2:SetOperation(s.tkop2)
  	c:RegisterEffect(e2)
  end
  function s.tkcon1(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_MZONE)
  end
  function s.tktg1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FAIRY, ATTRIBUTE_LIGHT)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.tkop1(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FAIRY, ATTRIBUTE_LIGHT) then
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.tkcsfilter(c)
  	return c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost()
  end
  function s.tkcost2(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tkcsfilter, tp, LOCATION_HAND, 0, 1, c) and c:IsAbleToRemoveAsCost()
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.tkcsfilter, tp, LOCATION_HAND, 0, 1, 1, c)
  	g:AddCard(c)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.ctkfilter(c)
  	return c:IsFaceup() and c:IsCode(id + 1)
  end
  function s.tkcon2(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.ctkfilter, tp, LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.tktg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 1
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FAIRY, ATTRIBUTE_LIGHT)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 2, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, 0, 0)
  end
  function s.tkop2(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if
  		Duel.GetLocationCount(tp, LOCATION_MZONE) > 1
  		and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  		and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FAIRY, ATTRIBUTE_LIGHT)
  	then
  		for i = 1, 2 do
  			local token = Duel.CreateToken(tp, id + 1)
  			Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c)
  	return not c:IsLocation(LOCATION_HAND)
  end
  
  
source_text: Tellus
  If this card is sent from the Monster Zone to the GY: You can Special Summon 1 "Tellus Wing Token" (Fairy/LIGHT/Level 1/ATK 0/DEF 0). While you control a "Tellus Wing Token": You can banish this card from your GY and 1 Spell from your hand; Special Summon 2 "Tellus Wing Tokens", also you cannot Special Summon for the rest of this turn, except from your hand. You can only use each effect of "Tellus the Little Angel" once per turn.
target_text: -- Tellus
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 19280590 --Tellus Wing Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Special Summon 1 Token
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_TO_GRAVE)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.tkcon1)
  	e1:SetTarget(s.tktg1)
  	e1:SetOperation(s.tkop1)
  	c:RegisterEffect(e1)
  	--Special Summon 2 Token
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCost(s.tkcost2)
  	e2:SetCondition(s.tkcon2)
  	e2:SetTarget(s.tktg2)
  	e2:SetOperation(s.tkop2)
  	c:RegisterEffect(e2)
  end
  function s.tkcon1(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_MZONE)
  end
  function s.tktg1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FAIRY, ATTRIBUTE_LIGHT)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.tkop1(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FAIRY, ATTRIBUTE_LIGHT) then
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.tkcsfilter(c)
  	return c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost()
  end
  function s.tkcost2(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tkcsfilter, tp, LOCATION_HAND, 0, 1, c) and c:IsAbleToRemoveAsCost()
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.tkcsfilter, tp, LOCATION_HAND, 0, 1, 1, c)
  	g:AddCard(c)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.ctkfilter(c)
  	return c:IsFaceup() and c:IsCode(id + 1)
  end
  function s.tkcon2(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.ctkfilter, tp, LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.tktg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 1
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FAIRY, ATTRIBUTE_LIGHT)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 2, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, 0, 0)
  end
  function s.tkop2(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if
  		Duel.GetLocationCount(tp, LOCATION_MZONE) > 1
  		and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  		and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FAIRY, ATTRIBUTE_LIGHT)
  	then
  		for i = 1, 2 do
  			local token = Duel.CreateToken(tp, id + 1)
  			Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c)
  	return not c:IsLocation(LOCATION_HAND)
  end
  
  