name: Skull
card_text: You can Ritual Summon this card with "Prayers of the Voiceless Voice". Gains 2050 ATK while you have "Lo, the Prayers of the Voiceless Voice" on your field or in your GY. You can only use each of the following effects of "Skull Guardian, Protector of the Voiceless Voice" once per turn. If this card is Ritual Summoned: You can add 1 "Voiceless Voice" monster, or 1 Ritual Monster (Warrior or Dragon), from your Deck to your hand. When your opponent activates a card or effect while you control "Lo, the Prayers of the Voiceless Voice" (Quick Effect): You can negate the activation, and if you do, destroy that card.
external_ids: local CARD_ID_0 = 52472775 --Prayers of the Voiceless Voice
  local CARD_ID_1 = 25801745 --Lo, the Prayers of the Voiceless Voice
  local SETCARD_ID_0 = 0x1a6 --Voiceless
  
lua: local CARD_ID_0 = 52472775 --Prayers of the Voiceless Voice
  local CARD_ID_1 = 25801745 --Lo, the Prayers of the Voiceless Voice
  local SETCARD_ID_0 = 0x1a6 --Voiceless
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0, CARD_ID_1)
  	c:EnableReviveLimit()
  	--search
  	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:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--negate
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetCountLimit(1, id + o)
  	e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCondition(s.discon)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  	--atk
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCondition(s.atkcon)
  	e3:SetValue(2050)
  	c:RegisterEffect(e3)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_RITUAL)
  end
  function s.thfilter(c)
  	return (c:IsSetCard(SETCARD_ID_0) or (c:IsRace(RACE_DRAGON + RACE_WARRIOR) and c:IsType(TYPE_RITUAL))) and c:IsType(TYPE_MONSTER) 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.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.cfilter(c)
  	return c:IsFaceupEx() and c:IsCode(CARD_ID_1)
  end
  function s.discon(e, tp, eg, ep, ev, re, r, rp)
  	return rp == 1 - tp and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_NEGATE, eg, 1, 0, 0)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  function s.atkcon(e)
  	return Duel.IsExistingMatchingCard(s.cfilter, e:GetHandlerPlayer(), LOCATION_GRAVE + LOCATION_ONFIELD, 0, 1, nil)
  end
  
  
source_text: Skull
  You can Ritual Summon this card with "Prayers of the Voiceless Voice". Gains 2050 ATK while you have "Lo, the Prayers of the Voiceless Voice" on your field or in your GY. You can only use each of the following effects of "Skull Guardian, Protector of the Voiceless Voice" once per turn. If this card is Ritual Summoned: You can add 1 "Voiceless Voice" monster, or 1 Ritual Monster (Warrior or Dragon), from your Deck to your hand. When your opponent activates a card or effect while you control "Lo, the Prayers of the Voiceless Voice" (Quick Effect): You can negate the activation, and if you do, destroy that card.
target_text: -- Skull
  local CARD_ID_0 = 52472775 --Prayers of the Voiceless Voice
  local CARD_ID_1 = 25801745 --Lo, the Prayers of the Voiceless Voice
  local SETCARD_ID_0 = 0x1a6 --Voiceless
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0, CARD_ID_1)
  	c:EnableReviveLimit()
  	--search
  	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:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--negate
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetCountLimit(1, id + o)
  	e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCondition(s.discon)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  	--atk
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCondition(s.atkcon)
  	e3:SetValue(2050)
  	c:RegisterEffect(e3)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_RITUAL)
  end
  function s.thfilter(c)
  	return (c:IsSetCard(SETCARD_ID_0) or (c:IsRace(RACE_DRAGON + RACE_WARRIOR) and c:IsType(TYPE_RITUAL))) and c:IsType(TYPE_MONSTER) 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.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.cfilter(c)
  	return c:IsFaceupEx() and c:IsCode(CARD_ID_1)
  end
  function s.discon(e, tp, eg, ep, ev, re, r, rp)
  	return rp == 1 - tp and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_NEGATE, eg, 1, 0, 0)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  function s.atkcon(e)
  	return Duel.IsExistingMatchingCard(s.cfilter, e:GetHandlerPlayer(), LOCATION_GRAVE + LOCATION_ONFIELD, 0, 1, nil)
  end
  
  