name: Gishki
card_text: This card can be used to Ritual Summon any "Gishki" Ritual Monster. You must also pay Life Points equal to the Level of the Ritual Summoned monster x 500 (when this card resolves).
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)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, e, tp, lp)
  	if bit.band(c:GetType(), 0x81) ~= 0x81 or not c:IsSetCard(SETCARD_ID_0) or not c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_RITUAL, tp, true, false) then
  		return false
  	end
  	return lp > c:GetLevel() * 500
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local lp = Duel.GetLP(tp)
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil, e, tp, lp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	local lp = Duel.GetLP(tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local tg = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp, lp)
  	local tc = tg:GetFirst()
  	if tc then
  		Duel.PayLPCost(tp, tc:GetLevel() * 500)
  		tc:SetMaterial(nil)
  		Duel.SpecialSummon(tc, SUMMON_TYPE_RITUAL, tp, tp, true, false, POS_FACEUP)
  		tc:CompleteProcedure()
  	end
  end
  
  
source_text: Gishki
  This card can be used to Ritual Summon any "Gishki" Ritual Monster. You must also pay Life Points equal to the Level of the Ritual Summoned monster x 500 (when this card resolves).
target_text: -- Gishki
  local SETCARD_ID_0 = 0x3a --Gishki
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, e, tp, lp)
  	if bit.band(c:GetType(), 0x81) ~= 0x81 or not c:IsSetCard(SETCARD_ID_0) or not c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_RITUAL, tp, true, false) then
  		return false
  	end
  	return lp > c:GetLevel() * 500
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local lp = Duel.GetLP(tp)
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil, e, tp, lp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	local lp = Duel.GetLP(tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local tg = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp, lp)
  	local tc = tg:GetFirst()
  	if tc then
  		Duel.PayLPCost(tp, tc:GetLevel() * 500)
  		tc:SetMaterial(nil)
  		Duel.SpecialSummon(tc, SUMMON_TYPE_RITUAL, tp, tp, true, false, POS_FACEUP)
  		tc:CompleteProcedure()
  	end
  end
  
  