name: Ogdoabyss,
card_text: If this card is in your GY: You can Tribute 3 monsters; Special Summon this card. Once, while this card is face-up on the field (Quick Effect): You can send all monsters from the field to the GY, except face-up monsters Special Summoned from the GY. You can only use each effect of "Ogdoabyss, the Ogdoadic Overlord" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--to grave
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOGRAVE)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetTarget(s.tgtg)
  	e2:SetOperation(s.tgop)
  	c:RegisterEffect(e2)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetReleaseGroup(tp)
  	if chk == 0 then
  		return g:CheckSubGroup(aux.mzctcheckrel, 3, 3, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local rg = g:SelectSubGroup(tp, aux.mzctcheckrel, false, 3, 3, tp)
  	aux.UseExtraReleaseCount(rg, tp)
  	Duel.Release(rg, REASON_COST)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.tgfilter(c)
  	return not (c:IsFaceup() and c:IsSummonLocation(LOCATION_GRAVE) and c:GetOriginalType() & TYPE_MONSTER ~= 0) and c:IsAbleToGrave()
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.tgfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	if chk == 0 then
  		return #g > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, g, #g, 0, 0)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.tgfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	if #g > 0 then
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  end
  
  
source_text: Ogdoabyss,
  If this card is in your GY: You can Tribute 3 monsters; Special Summon this card. Once, while this card is face-up on the field (Quick Effect): You can send all monsters from the field to the GY, except face-up monsters Special Summoned from the GY. You can only use each effect of "Ogdoabyss, the Ogdoadic Overlord" once per turn.
target_text: -- Ogdoabyss,
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--to grave
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOGRAVE)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetTarget(s.tgtg)
  	e2:SetOperation(s.tgop)
  	c:RegisterEffect(e2)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetReleaseGroup(tp)
  	if chk == 0 then
  		return g:CheckSubGroup(aux.mzctcheckrel, 3, 3, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local rg = g:SelectSubGroup(tp, aux.mzctcheckrel, false, 3, 3, tp)
  	aux.UseExtraReleaseCount(rg, tp)
  	Duel.Release(rg, REASON_COST)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.tgfilter(c)
  	return not (c:IsFaceup() and c:IsSummonLocation(LOCATION_GRAVE) and c:GetOriginalType() & TYPE_MONSTER ~= 0) and c:IsAbleToGrave()
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.tgfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	if chk == 0 then
  		return #g > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, g, #g, 0, 0)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.tgfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	if #g > 0 then
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  end
  
  