name: Evigishki
card_text: You can Ritual Summon this card with any "Gishki" Ritual Spell Card. Once per turn: You can declare 1 card type (Monster, Spell, or Trap); your opponent can discard 1 card to negate this card's effect, otherwise both players send 1 card of the declared type from their Main Deck to the Graveyard.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--send to grave
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOGRAVE)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) > 0 and Duel.GetFieldGroupCount(tp, 0, LOCATION_DECK) > 0
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CARDTYPE)
  	local ac = Duel.AnnounceType(tp)
  	e:SetLabel(ac)
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, PLAYER_ALL, LOCATION_DECK)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldGroupCount(tp, 0, LOCATION_HAND) > 0 and Duel.IsChainDisablable(0) and Duel.SelectYesNo(1 - tp, aux.Stringid(id, 4)) then
  		Duel.DiscardHand(1 - tp, aux.TRUE, 1, 1, REASON_EFFECT + REASON_DISCARD)
  		Duel.NegateEffect(0)
  		return
  	end
  	local ty = TYPE_MONSTER
  	if e:GetLabel() == 1 then
  		ty = TYPE_SPELL
  	elseif e:GetLabel() == 2 then
  		ty = TYPE_TRAP
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g1 = Duel.SelectMatchingCard(tp, Card.IsType, tp, LOCATION_DECK, 0, 1, 1, nil, ty)
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_TOGRAVE)
  	local g2 = Duel.SelectMatchingCard(1 - tp, Card.IsType, 1 - tp, LOCATION_DECK, 0, 1, 1, nil, ty)
  	g1:Merge(g2)
  	Duel.SendtoGrave(g1, REASON_EFFECT)
  end
  
  
source_text: Evigishki
  You can Ritual Summon this card with any "Gishki" Ritual Spell Card. Once per turn: You can declare 1 card type (Monster, Spell, or Trap); your opponent can discard 1 card to negate this card's effect, otherwise both players send 1 card of the declared type from their Main Deck to the Graveyard.
target_text: -- Evigishki
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--send to grave
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOGRAVE)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) > 0 and Duel.GetFieldGroupCount(tp, 0, LOCATION_DECK) > 0
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CARDTYPE)
  	local ac = Duel.AnnounceType(tp)
  	e:SetLabel(ac)
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, PLAYER_ALL, LOCATION_DECK)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldGroupCount(tp, 0, LOCATION_HAND) > 0 and Duel.IsChainDisablable(0) and Duel.SelectYesNo(1 - tp, aux.Stringid(id, 4)) then
  		Duel.DiscardHand(1 - tp, aux.TRUE, 1, 1, REASON_EFFECT + REASON_DISCARD)
  		Duel.NegateEffect(0)
  		return
  	end
  	local ty = TYPE_MONSTER
  	if e:GetLabel() == 1 then
  		ty = TYPE_SPELL
  	elseif e:GetLabel() == 2 then
  		ty = TYPE_TRAP
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g1 = Duel.SelectMatchingCard(tp, Card.IsType, tp, LOCATION_DECK, 0, 1, 1, nil, ty)
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_TOGRAVE)
  	local g2 = Duel.SelectMatchingCard(1 - tp, Card.IsType, 1 - tp, LOCATION_DECK, 0, 1, 1, nil, ty)
  	g1:Merge(g2)
  	Duel.SendtoGrave(g1, REASON_EFFECT)
  end
  
  