name: Gishki
card_text: When this card is Normal Summoned: You can excavate the top 5 cards of your Deck, send any excavated Ritual Spell Cards and "Gishki" monsters to the Graveyard, also place the other cards on the bottom of your Deck in any order.
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)
  	--to grave
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DECKDES)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	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.IsPlayerCanDiscardDeck(tp, 5)
  	end
  end
  function s.filter(c)
  	return c:GetType() == 0x82 or (c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER))
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if not Duel.IsPlayerCanDiscardDeck(tp, 5) then
  		return
  	end
  	Duel.ConfirmDecktop(tp, 5)
  	local g = Duel.GetDecktopGroup(tp, 5)
  	local sg = g:Filter(s.filter, nil)
  	if sg:GetCount() > 0 then
  		Duel.DisableShuffleCheck()
  		Duel.SendtoGrave(sg, REASON_EFFECT + REASON_REVEAL)
  	end
  	Duel.SortDecktop(tp, tp, 5 - sg:GetCount())
  	for i = 1, 5 - sg:GetCount() do
  		local mg = Duel.GetDecktopGroup(tp, 1)
  		Duel.MoveSequence(mg:GetFirst(), SEQ_DECKBOTTOM)
  	end
  end
  
  
source_text: Gishki
  When this card is Normal Summoned: You can excavate the top 5 cards of your Deck, send any excavated Ritual Spell Cards and "Gishki" monsters to the Graveyard, also place the other cards on the bottom of your Deck in any order.
target_text: -- Gishki
  local SETCARD_ID_0 = 0x3a --Gishki
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--to grave
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DECKDES)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	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.IsPlayerCanDiscardDeck(tp, 5)
  	end
  end
  function s.filter(c)
  	return c:GetType() == 0x82 or (c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER))
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if not Duel.IsPlayerCanDiscardDeck(tp, 5) then
  		return
  	end
  	Duel.ConfirmDecktop(tp, 5)
  	local g = Duel.GetDecktopGroup(tp, 5)
  	local sg = g:Filter(s.filter, nil)
  	if sg:GetCount() > 0 then
  		Duel.DisableShuffleCheck()
  		Duel.SendtoGrave(sg, REASON_EFFECT + REASON_REVEAL)
  	end
  	Duel.SortDecktop(tp, tp, 5 - sg:GetCount())
  	for i = 1, 5 - sg:GetCount() do
  		local mg = Duel.GetDecktopGroup(tp, 1)
  		Duel.MoveSequence(mg:GetFirst(), SEQ_DECKBOTTOM)
  	end
  end
  
  