name: Hieratic
card_text: 2 Level 8 monsters
  Once per turn: You can detach 1 material from this card; Tribute any number of monsters from your hand and/or field (min. 1), then destroy an equal number of cards on the field.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 8, 2)
  	c:EnableReviveLimit()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.descost)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  end
  function s.descost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroupEx(tp, nil, 1, REASON_EFFECT, true, nil) and Duel.IsExistingMatchingCard(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local ct1 = Duel.GetMatchingGroupCount(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, nil)
  	local rg = Duel.SelectReleaseGroupEx(tp, nil, 1, ct1, REASON_EFFECT, true, nil)
  	local ct2 = Duel.Release(rg, REASON_EFFECT)
  	if ct2 == 0 then
  		return
  	end
  	Duel.BreakEffect()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local dg = Duel.SelectMatchingCard(tp, aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, ct2, ct2, nil)
  	Duel.HintSelection(dg)
  	Duel.Destroy(dg, REASON_EFFECT)
  end
  
  
source_text: Hieratic
  2 Level 8 monsters
  Once per turn: You can detach 1 material from this card; Tribute any number of monsters from your hand and/or field (min. 1), then destroy an equal number of cards on the field.
target_text: -- Hieratic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 8, 2)
  	c:EnableReviveLimit()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.descost)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  end
  function s.descost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroupEx(tp, nil, 1, REASON_EFFECT, true, nil) and Duel.IsExistingMatchingCard(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local ct1 = Duel.GetMatchingGroupCount(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, nil)
  	local rg = Duel.SelectReleaseGroupEx(tp, nil, 1, ct1, REASON_EFFECT, true, nil)
  	local ct2 = Duel.Release(rg, REASON_EFFECT)
  	if ct2 == 0 then
  		return
  	end
  	Duel.BreakEffect()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local dg = Duel.SelectMatchingCard(tp, aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, ct2, ct2, nil)
  	Duel.HintSelection(dg)
  	Duel.Destroy(dg, REASON_EFFECT)
  end
  
  