name: Barrier
card_text: While you control "Lo, the Prayers of the Voiceless Voice" and a LIGHT Ritual Monster, your opponent's monsters can only target Ritual Monsters for attacks, also your opponent cannot target LIGHT monsters you control with card effects. During your Main Phase: You can add 1 "Voiceless Voice" card or 1 "Skull Guardian" Ritual Monster from your Deck to your hand, except "Barrier of the Voiceless Voice". You can only use this effect of "Barrier of the Voiceless Voice" once per turn.
external_ids: local CARD_ID_0 = 25801745 --Lo, the Prayers of the Voiceless Voice
  local SETCARD_ID_0 = 0x1a6 --Voiceless
  
lua: local CARD_ID_0 = 25801745 --Lo, the Prayers of the Voiceless Voice
  local SETCARD_ID_0 = 0x1a6 --Voiceless
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_ACTIVATE)
  	e0:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e0)
  	--limit attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  	e1:SetRange(LOCATION_SZONE)
  	e1:SetTargetRange(0, LOCATION_MZONE)
  	e1:SetCondition(s.condition)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  	e2:SetValue(s.alimit)
  	c:RegisterEffect(e2)
  	--cannot target
  	local e3 = e1:Clone()
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e3:SetTargetRange(LOCATION_MZONE, 0)
  	e3:SetTarget(aux.TargetBoolFunction(Card.IsAttribute, ATTRIBUTE_LIGHT))
  	e3:SetValue(aux.tgoval)
  	c:RegisterEffect(e3)
  	--to hand
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetCountLimit(1, id)
  	e4:SetTarget(s.thtg)
  	e4:SetOperation(s.thop)
  	c:RegisterEffect(e4)
  end
  function s.cfilter1(c, tp)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0) and Duel.IsExistingMatchingCard(s.cfilter2, tp, LOCATION_MZONE, 0, 1, c)
  end
  function s.cfilter2(c)
  	return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsType(TYPE_RITUAL)
  end
  function s.condition(e)
  	local tp = e:GetHandlerPlayer()
  	return Duel.IsExistingMatchingCard(s.cfilter1, tp, LOCATION_ONFIELD, 0, 1, nil, tp)
  end
  function s.alimit(e, c)
  	return c:IsFacedown() or not c:IsType(TYPE_RITUAL)
  end
  function s.filter(c)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsSetCard(0x2052) and c:GetType() & 0x81 == 0x81) and c:IsAbleToHand() and not c:IsCode(id)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	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.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if #g > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  
source_text: Barrier
  While you control "Lo, the Prayers of the Voiceless Voice" and a LIGHT Ritual Monster, your opponent's monsters can only target Ritual Monsters for attacks, also your opponent cannot target LIGHT monsters you control with card effects. During your Main Phase: You can add 1 "Voiceless Voice" card or 1 "Skull Guardian" Ritual Monster from your Deck to your hand, except "Barrier of the Voiceless Voice". You can only use this effect of "Barrier of the Voiceless Voice" once per turn.
target_text: -- Barrier
  local CARD_ID_0 = 25801745 --Lo, the Prayers of the Voiceless Voice
  local SETCARD_ID_0 = 0x1a6 --Voiceless
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_ACTIVATE)
  	e0:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e0)
  	--limit attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  	e1:SetRange(LOCATION_SZONE)
  	e1:SetTargetRange(0, LOCATION_MZONE)
  	e1:SetCondition(s.condition)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  	e2:SetValue(s.alimit)
  	c:RegisterEffect(e2)
  	--cannot target
  	local e3 = e1:Clone()
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e3:SetTargetRange(LOCATION_MZONE, 0)
  	e3:SetTarget(aux.TargetBoolFunction(Card.IsAttribute, ATTRIBUTE_LIGHT))
  	e3:SetValue(aux.tgoval)
  	c:RegisterEffect(e3)
  	--to hand
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetCountLimit(1, id)
  	e4:SetTarget(s.thtg)
  	e4:SetOperation(s.thop)
  	c:RegisterEffect(e4)
  end
  function s.cfilter1(c, tp)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0) and Duel.IsExistingMatchingCard(s.cfilter2, tp, LOCATION_MZONE, 0, 1, c)
  end
  function s.cfilter2(c)
  	return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsType(TYPE_RITUAL)
  end
  function s.condition(e)
  	local tp = e:GetHandlerPlayer()
  	return Duel.IsExistingMatchingCard(s.cfilter1, tp, LOCATION_ONFIELD, 0, 1, nil, tp)
  end
  function s.alimit(e, c)
  	return c:IsFacedown() or not c:IsType(TYPE_RITUAL)
  end
  function s.filter(c)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsSetCard(0x2052) and c:GetType() & 0x81 == 0x81) and c:IsAbleToHand() and not c:IsCode(id)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	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.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if #g > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  