name: Gishki
card_text: You can Ritual Summon this card with any "Gishki" Ritual Spell Card. Once per turn: You can pay 1000 Life Points; draw 1 card, and if you do, reveal it, then, if it was a "Gishki" monster, shuffle 1 card from the field into the Deck.
external_ids: local SETCARD_ID_0 = 0x3a --Gishki
  
lua: local SETCARD_ID_0 = 0x3a --Gishki
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--draw
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 1000)
  	end
  	Duel.PayLPCost(tp, 1000)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.Draw(tp, 1, REASON_EFFECT) == 0 then
  		return
  	end
  	local tc = Duel.GetOperatedGroup():GetFirst()
  	Duel.ConfirmCards(1 - tp, tc)
  	if tc:IsSetCard(SETCARD_ID_0) and tc:IsType(TYPE_MONSTER) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  		local dg = Duel.SelectMatchingCard(tp, Card.IsAbleToDeck, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  		Duel.SendtoDeck(dg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
  	end
  	Duel.ShuffleHand(tp)
  end
  
  
source_text: Gishki
  You can Ritual Summon this card with any "Gishki" Ritual Spell Card. Once per turn: You can pay 1000 Life Points; draw 1 card, and if you do, reveal it, then, if it was a "Gishki" monster, shuffle 1 card from the field into the Deck.
target_text: -- Gishki
  local SETCARD_ID_0 = 0x3a --Gishki
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--draw
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 1000)
  	end
  	Duel.PayLPCost(tp, 1000)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.Draw(tp, 1, REASON_EFFECT) == 0 then
  		return
  	end
  	local tc = Duel.GetOperatedGroup():GetFirst()
  	Duel.ConfirmCards(1 - tp, tc)
  	if tc:IsSetCard(SETCARD_ID_0) and tc:IsType(TYPE_MONSTER) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  		local dg = Duel.SelectMatchingCard(tp, Card.IsAbleToDeck, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  		Duel.SendtoDeck(dg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
  	end
  	Duel.ShuffleHand(tp)
  end
  
  