name: The
card_text: This card's name becomes "The Sanctuary in the Sky" while on the field or in the GY. Fairy monsters on the field gain 300 ATK/DEF. Set Spells/Traps cannot be destroyed by card effects, also neither player can target them with card effects. Once per turn: You can target a total of 3 Fairy monsters and/or Counter Traps with different names in your GY; place them on top of your Deck in any order.
external_ids: local CARD_ID_0 = 56433456 --The Sanctuary in the Sky
  
lua: local CARD_ID_0 = 56433456 --The Sanctuary in the Sky
  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)
  	--change
  	aux.EnableChangeCode(c, CARD_ID_0, LOCATION_SZONE + LOCATION_GRAVE)
  	--atk/def
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e3:SetTarget(aux.TargetBoolFunction(Card.IsRace, RACE_FAIRY))
  	e3:SetValue(300)
  	c:RegisterEffect(e3)
  	local e4 = e3:Clone()
  	e4:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e4)
  	--cannot be target/indestructable
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_FIELD)
  	e5:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
  	e5:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e5:SetRange(LOCATION_SZONE)
  	e5:SetTargetRange(LOCATION_SZONE, LOCATION_SZONE)
  	e5:SetTarget(aux.TargetBoolFunction(Card.IsPosition, POS_FACEDOWN))
  	e5:SetValue(1)
  	c:RegisterEffect(e5)
  	local e6 = e5:Clone()
  	e6:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e6:SetProperty(EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_IGNORE_IMMUNE)
  	c:RegisterEffect(e6)
  	--to deck
  	local e7 = Effect.CreateEffect(c)
  	e7:SetCategory(CATEGORY_TODECK)
  	e7:SetType(EFFECT_TYPE_IGNITION)
  	e7:SetRange(LOCATION_SZONE)
  	e7:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e7:SetCountLimit(1)
  	e7:SetTarget(s.tdtg)
  	e7:SetOperation(s.tdop)
  	c:RegisterEffect(e7)
  end
  function s.tdfilter(c, e)
  	return (c:IsRace(RACE_FAIRY) or c:IsType(TYPE_COUNTER)) and c:IsAbleToDeck() and (not e or c:IsCanBeEffectTarget(e))
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.tdfilter, tp, LOCATION_GRAVE, 0, nil, e)
  	if chk == 0 then
  		return g:GetClassCount(Card.GetCode) >= 3
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local tg = g:SelectSubGroup(tp, aux.dncheck, false, 3, 3)
  	Duel.SetTargetCard(tg)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, tg, tg:GetCount(), 0, 0)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if tg:GetCount() == 0 then
  		return
  	end
  	if Duel.SendtoDeck(tg, nil, SEQ_DECKTOP, REASON_EFFECT) == 0 then
  		return
  	end
  	local ct = Duel.GetOperatedGroup():FilterCount(Card.IsLocation, nil, LOCATION_DECK)
  	if ct > 0 then
  		Duel.SortDecktop(tp, tp, ct)
  	end
  end
  
  
source_text: The
  This card's name becomes "The Sanctuary in the Sky" while on the field or in the GY. Fairy monsters on the field gain 300 ATK/DEF. Set Spells/Traps cannot be destroyed by card effects, also neither player can target them with card effects. Once per turn: You can target a total of 3 Fairy monsters and/or Counter Traps with different names in your GY; place them on top of your Deck in any order.
target_text: -- The
  local CARD_ID_0 = 56433456 --The Sanctuary in the Sky
  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)
  	--change
  	aux.EnableChangeCode(c, CARD_ID_0, LOCATION_SZONE + LOCATION_GRAVE)
  	--atk/def
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e3:SetTarget(aux.TargetBoolFunction(Card.IsRace, RACE_FAIRY))
  	e3:SetValue(300)
  	c:RegisterEffect(e3)
  	local e4 = e3:Clone()
  	e4:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e4)
  	--cannot be target/indestructable
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_FIELD)
  	e5:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
  	e5:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e5:SetRange(LOCATION_SZONE)
  	e5:SetTargetRange(LOCATION_SZONE, LOCATION_SZONE)
  	e5:SetTarget(aux.TargetBoolFunction(Card.IsPosition, POS_FACEDOWN))
  	e5:SetValue(1)
  	c:RegisterEffect(e5)
  	local e6 = e5:Clone()
  	e6:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e6:SetProperty(EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_IGNORE_IMMUNE)
  	c:RegisterEffect(e6)
  	--to deck
  	local e7 = Effect.CreateEffect(c)
  	e7:SetCategory(CATEGORY_TODECK)
  	e7:SetType(EFFECT_TYPE_IGNITION)
  	e7:SetRange(LOCATION_SZONE)
  	e7:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e7:SetCountLimit(1)
  	e7:SetTarget(s.tdtg)
  	e7:SetOperation(s.tdop)
  	c:RegisterEffect(e7)
  end
  function s.tdfilter(c, e)
  	return (c:IsRace(RACE_FAIRY) or c:IsType(TYPE_COUNTER)) and c:IsAbleToDeck() and (not e or c:IsCanBeEffectTarget(e))
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.tdfilter, tp, LOCATION_GRAVE, 0, nil, e)
  	if chk == 0 then
  		return g:GetClassCount(Card.GetCode) >= 3
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local tg = g:SelectSubGroup(tp, aux.dncheck, false, 3, 3)
  	Duel.SetTargetCard(tg)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, tg, tg:GetCount(), 0, 0)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if tg:GetCount() == 0 then
  		return
  	end
  	if Duel.SendtoDeck(tg, nil, SEQ_DECKTOP, REASON_EFFECT) == 0 then
  		return
  	end
  	local ct = Duel.GetOperatedGroup():FilterCount(Card.IsLocation, nil, LOCATION_DECK)
  	if ct > 0 then
  		Duel.SortDecktop(tp, tp, ct)
  	end
  end
  
  