name: Earthbound
card_text: While any Level 10 monsters are on the field, neither player can target this card with card effects, also it cannot be destroyed by card effects. You can treat 1 Synchro Monster as 2 Tributes for the Tribute Summon of an "Earthbound Immortal" monster. If a Synchro Monster(s) is Special Summoned (except during the Damage Step): You can add 1 "Earthbound Immortal" Spell/Trap from your Deck to your hand. You can only use this effect of "Earthbound Geoglyph" once per turn.
external_ids: local SETCARD_ID_0 = 0x1021 --Earthbound
  
lua: local SETCARD_ID_0 = 0x1021 --Earthbound
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--cannot be target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetCondition(s.indcon)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	c:RegisterEffect(e3)
  	--double tribute
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
  	e4:SetCode(EFFECT_DOUBLE_TRIBUTE)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e4:SetTarget(s.dttg)
  	e4:SetValue(s.dtval)
  	c:RegisterEffect(e4)
  	--search
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 0))
  	e5:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e5:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e5:SetProperty(EFFECT_FLAG_DELAY)
  	e5:SetRange(LOCATION_FZONE)
  	e5:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e5:SetCountLimit(1, id)
  	e5:SetCondition(s.condition)
  	e5:SetTarget(s.target)
  	e5:SetOperation(s.operation)
  	c:RegisterEffect(e5)
  end
  function s.indfilter(c)
  	return c:IsFaceup() and c:IsLevel(10)
  end
  function s.indcon(e)
  	return Duel.IsExistingMatchingCard(s.indfilter, 0, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  end
  function s.dttg(e, c)
  	return c:IsType(TYPE_SYNCHRO) and (c:IsFaceup() or c:IsControler(e:GetHandlerPlayer()))
  end
  function s.dtval(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsControler(e:GetHandlerPlayer())
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(Card.IsType, 1, nil, TYPE_SYNCHRO)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  
source_text: Earthbound
  While any Level 10 monsters are on the field, neither player can target this card with card effects, also it cannot be destroyed by card effects. You can treat 1 Synchro Monster as 2 Tributes for the Tribute Summon of an "Earthbound Immortal" monster. If a Synchro Monster(s) is Special Summoned (except during the Damage Step): You can add 1 "Earthbound Immortal" Spell/Trap from your Deck to your hand. You can only use this effect of "Earthbound Geoglyph" once per turn.
target_text: -- Earthbound
  local SETCARD_ID_0 = 0x1021 --Earthbound
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--cannot be target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetCondition(s.indcon)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	c:RegisterEffect(e3)
  	--double tribute
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
  	e4:SetCode(EFFECT_DOUBLE_TRIBUTE)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e4:SetTarget(s.dttg)
  	e4:SetValue(s.dtval)
  	c:RegisterEffect(e4)
  	--search
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 0))
  	e5:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e5:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e5:SetProperty(EFFECT_FLAG_DELAY)
  	e5:SetRange(LOCATION_FZONE)
  	e5:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e5:SetCountLimit(1, id)
  	e5:SetCondition(s.condition)
  	e5:SetTarget(s.target)
  	e5:SetOperation(s.operation)
  	c:RegisterEffect(e5)
  end
  function s.indfilter(c)
  	return c:IsFaceup() and c:IsLevel(10)
  end
  function s.indcon(e)
  	return Duel.IsExistingMatchingCard(s.indfilter, 0, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  end
  function s.dttg(e, c)
  	return c:IsType(TYPE_SYNCHRO) and (c:IsFaceup() or c:IsControler(e:GetHandlerPlayer()))
  end
  function s.dtval(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsControler(e:GetHandlerPlayer())
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(Card.IsType, 1, nil, TYPE_SYNCHRO)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  