name: DoomZ
card_text: 2 Level 4 monsters
  If this card is Special Summoned: You can destroy 1 "DoomZ" card in your hand or face-up field, then you can destroy 1 monster on the field. If this card is destroyed by battle or card effect while it has a "DoomZ" monster or "Medius the Pure" as material: You can add to your hand, or send to the GY, 1 Equip Spell from your Deck. You can only use each effect of "DoomZ Break Diactorus" once per turn.
external_ids: local CARD_ID_0 = 97556336 --Medius the Pure
  local SETCARD_ID_0 = 0x1d2 --DoomZ
  
lua: local CARD_ID_0 = 97556336 --Medius the Pure
  local SETCARD_ID_0 = 0x1d2 --DoomZ
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 4, 2)
  	c:EnableReviveLimit()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  	--to hand
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH + CATEGORY_TOGRAVE + CATEGORY_DECKDES)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e4:SetCode(EVENT_DESTROYED)
  	e4:SetProperty(EFFECT_FLAG_DELAY)
  	e4:SetCountLimit(1, id + o)
  	e4:SetCondition(s.thcon)
  	e4:SetTarget(s.thtg)
  	e4:SetOperation(s.thop)
  	c:RegisterEffect(e4)
  end
  function s.desfilter(c)
  	return c:IsFaceupEx() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.desfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, nil)
  	if chk == 0 then
  		return #g > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, 1, 1, nil)
  	local fg = g:Filter(Card.IsLocation, nil, LOCATION_ONFIELD)
  	if fg:GetCount() > 0 then
  		Duel.HintSelection(fg)
  	end
  	if Duel.Destroy(g, REASON_EFFECT) > 0 and Duel.IsExistingMatchingCard(aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil) and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  		local g = Duel.SelectMatchingCard(tp, aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  		if g:GetCount() > 0 then
  			Duel.HintSelection(g)
  			Duel.Destroy(g, REASON_EFFECT)
  		end
  	end
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) or c:IsCode(CARD_ID_0)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local g = c:GetOverlayGroup()
  	return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and g:IsExists(s.cfilter, 1, nil)
  end
  function s.thfilter(c)
  	return c:IsType(TYPE_EQUIP) and (c:IsAbleToHand() or c:IsAbleToGrave())
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() <= 0 then
  		return
  	end
  	local tc = g:GetFirst()
  	if tc:IsAbleToHand() and (not tc:IsAbleToGrave() or Duel.SelectOption(tp, 1190, 1191) == 0) then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, tc)
  	elseif tc:IsAbleToGrave() then
  		Duel.SendtoGrave(tc, REASON_EFFECT)
  	end
  end
  
  
source_text: DoomZ
  2 Level 4 monsters
  If this card is Special Summoned: You can destroy 1 "DoomZ" card in your hand or face-up field, then you can destroy 1 monster on the field. If this card is destroyed by battle or card effect while it has a "DoomZ" monster or "Medius the Pure" as material: You can add to your hand, or send to the GY, 1 Equip Spell from your Deck. You can only use each effect of "DoomZ Break Diactorus" once per turn.
target_text: -- DoomZ
  local CARD_ID_0 = 97556336 --Medius the Pure
  local SETCARD_ID_0 = 0x1d2 --DoomZ
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 4, 2)
  	c:EnableReviveLimit()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  	--to hand
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH + CATEGORY_TOGRAVE + CATEGORY_DECKDES)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e4:SetCode(EVENT_DESTROYED)
  	e4:SetProperty(EFFECT_FLAG_DELAY)
  	e4:SetCountLimit(1, id + o)
  	e4:SetCondition(s.thcon)
  	e4:SetTarget(s.thtg)
  	e4:SetOperation(s.thop)
  	c:RegisterEffect(e4)
  end
  function s.desfilter(c)
  	return c:IsFaceupEx() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.desfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, nil)
  	if chk == 0 then
  		return #g > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, 1, 1, nil)
  	local fg = g:Filter(Card.IsLocation, nil, LOCATION_ONFIELD)
  	if fg:GetCount() > 0 then
  		Duel.HintSelection(fg)
  	end
  	if Duel.Destroy(g, REASON_EFFECT) > 0 and Duel.IsExistingMatchingCard(aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil) and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  		local g = Duel.SelectMatchingCard(tp, aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  		if g:GetCount() > 0 then
  			Duel.HintSelection(g)
  			Duel.Destroy(g, REASON_EFFECT)
  		end
  	end
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) or c:IsCode(CARD_ID_0)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local g = c:GetOverlayGroup()
  	return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and g:IsExists(s.cfilter, 1, nil)
  end
  function s.thfilter(c)
  	return c:IsType(TYPE_EQUIP) and (c:IsAbleToHand() or c:IsAbleToGrave())
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() <= 0 then
  		return
  	end
  	local tc = g:GetFirst()
  	if tc:IsAbleToHand() and (not tc:IsAbleToGrave() or Duel.SelectOption(tp, 1190, 1191) == 0) then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, tc)
  	elseif tc:IsAbleToGrave() then
  		Duel.SendtoGrave(tc, REASON_EFFECT)
  	end
  end
  
  