name: Centur-Ion
card_text: 1 Tuner + 1+ non-Tuner monsters
  Face-up cards in your Spell & Trap Zone cannot be destroyed by card effects. You can only use each of the following effects of "Centur-Ion Auxila" once per turn. If this card is Special Summoned: You can add 1 "Centur-Ion" card from your Deck to your hand. During the End Phase: You can place 1 of your non-Synchro "Centur-Ion" monsters that is banished or in your GY, in your Spell & Trap Zone as a face-up Continuous Trap.
external_ids: local SETCARD_ID_0 = 0x1a2 --Centur-Ion
  
lua: local SETCARD_ID_0 = 0x1a2 --Centur-Ion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(LOCATION_SZONE, 0)
  	e2:SetTarget(aux.TargetBoolFunction(aux.AND(aux.NOT(Card.IsType), Card.IsFaceup), TYPE_FIELD))
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_PHASE + PHASE_END)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1, id + o)
  	e3:SetTarget(s.settg)
  	e3:SetOperation(s.setop)
  	c:RegisterEffect(e3)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(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.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(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 > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and not c:IsForbidden() and not c:IsType(TYPE_SYNCHRO)
  end
  function s.settg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 1, nil) and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0
  	end
  end
  function s.setop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter), tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc then
  		Duel.MoveToField(tc, tp, tp, LOCATION_SZONE, POS_FACEUP, true)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetCode(EFFECT_CHANGE_TYPE)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET)
  		e1:SetValue(TYPE_TRAP + TYPE_CONTINUOUS)
  		tc:RegisterEffect(e1)
  	end
  end
  
  
source_text: Centur-Ion
  1 Tuner + 1+ non-Tuner monsters
  Face-up cards in your Spell & Trap Zone cannot be destroyed by card effects. You can only use each of the following effects of "Centur-Ion Auxila" once per turn. If this card is Special Summoned: You can add 1 "Centur-Ion" card from your Deck to your hand. During the End Phase: You can place 1 of your non-Synchro "Centur-Ion" monsters that is banished or in your GY, in your Spell & Trap Zone as a face-up Continuous Trap.
target_text: -- Centur-Ion
  local SETCARD_ID_0 = 0x1a2 --Centur-Ion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(LOCATION_SZONE, 0)
  	e2:SetTarget(aux.TargetBoolFunction(aux.AND(aux.NOT(Card.IsType), Card.IsFaceup), TYPE_FIELD))
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_PHASE + PHASE_END)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1, id + o)
  	e3:SetTarget(s.settg)
  	e3:SetOperation(s.setop)
  	c:RegisterEffect(e3)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(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.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(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 > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and not c:IsForbidden() and not c:IsType(TYPE_SYNCHRO)
  end
  function s.settg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 1, nil) and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0
  	end
  end
  function s.setop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter), tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc then
  		Duel.MoveToField(tc, tp, tp, LOCATION_SZONE, POS_FACEUP, true)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetCode(EFFECT_CHANGE_TYPE)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET)
  		e1:SetValue(TYPE_TRAP + TYPE_CONTINUOUS)
  		tc:RegisterEffect(e1)
  	end
  end
  
  