name: Dogmatikamacabre
card_text: This card can be used to Ritual Summon any "Dogmatika" Ritual Monster from your hand or GY. You must also Tribute monsters from your hand or field, and/or banish Fusion or Synchro Monsters from your GY, whose total Levels equal or exceed the Level of the Ritual Monster you Ritual Summon, then, if both "White Knight of Dogmatika" and "White Relic of Dogmatika" are on the field, you can look at either your Extra Deck or your opponent's, and send 1 monster from it to the GY. You can only activate 1 "Dogmatikamacabre" per turn.
external_ids: local CARD_ID_0 = 40352445 --White Knight of Dogmatika
  local CARD_ID_1 = 48654323 --White Relic of Dogmatika
  local SETCARD_ID_0 = 0x145 --Dogmatika
  
lua: local CARD_ID_0 = 40352445 --White Knight of Dogmatika
  local CARD_ID_1 = 48654323 --White Relic of Dogmatika
  local SETCARD_ID_0 = 0x145 --Dogmatika
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0, CARD_ID_1)
  	local e1 = aux.AddRitualProcGreater2(c, s.filter, LOCATION_HAND + LOCATION_GRAVE, s.grfilter, nil, true, s.extraop)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  function s.grfilter(c)
  	return c:IsType(TYPE_FUSION + TYPE_SYNCHRO)
  end
  function s.opfilter(c, code)
  	return c:IsFaceup() and c:IsCode(code)
  end
  function s.extraop(e, tp, eg, ep, ev, re, r, rp, tc)
  	if not tc then
  		return
  	end
  	local g1 = Duel.GetFieldGroup(tp, LOCATION_EXTRA, 0)
  	local g2 = Duel.GetFieldGroup(tp, 0, LOCATION_EXTRA)
  	if
  		Duel.IsExistingMatchingCard(s.opfilter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil, CARD_ID_0)
  		and Duel.IsExistingMatchingCard(s.opfilter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil, CARD_ID_1)
  		and (#g1 ~= 0 or #g2 ~= 0)
  		and Duel.SelectYesNo(tp, aux.Stringid(id, 0))
  	then
  		Duel.BreakEffect()
  		local g = nil
  		if #g1 ~= 0 and (#g2 == 0 or Duel.SelectOption(tp, aux.Stringid(id, 1), aux.Stringid(id, 2)) == 0) then
  			g = g1
  		else
  			g = g2
  			Duel.ConfirmCards(tp, g, true)
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local tg = g:FilterSelect(tp, Card.IsAbleToGrave, 1, 1, nil)
  		Duel.SendtoGrave(tg, REASON_EFFECT)
  	end
  end
  
  
source_text: Dogmatikamacabre
  This card can be used to Ritual Summon any "Dogmatika" Ritual Monster from your hand or GY. You must also Tribute monsters from your hand or field, and/or banish Fusion or Synchro Monsters from your GY, whose total Levels equal or exceed the Level of the Ritual Monster you Ritual Summon, then, if both "White Knight of Dogmatika" and "White Relic of Dogmatika" are on the field, you can look at either your Extra Deck or your opponent's, and send 1 monster from it to the GY. You can only activate 1 "Dogmatikamacabre" per turn.
target_text: -- Dogmatikamacabre
  local CARD_ID_0 = 40352445 --White Knight of Dogmatika
  local CARD_ID_1 = 48654323 --White Relic of Dogmatika
  local SETCARD_ID_0 = 0x145 --Dogmatika
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0, CARD_ID_1)
  	local e1 = aux.AddRitualProcGreater2(c, s.filter, LOCATION_HAND + LOCATION_GRAVE, s.grfilter, nil, true, s.extraop)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  function s.grfilter(c)
  	return c:IsType(TYPE_FUSION + TYPE_SYNCHRO)
  end
  function s.opfilter(c, code)
  	return c:IsFaceup() and c:IsCode(code)
  end
  function s.extraop(e, tp, eg, ep, ev, re, r, rp, tc)
  	if not tc then
  		return
  	end
  	local g1 = Duel.GetFieldGroup(tp, LOCATION_EXTRA, 0)
  	local g2 = Duel.GetFieldGroup(tp, 0, LOCATION_EXTRA)
  	if
  		Duel.IsExistingMatchingCard(s.opfilter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil, CARD_ID_0)
  		and Duel.IsExistingMatchingCard(s.opfilter, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil, CARD_ID_1)
  		and (#g1 ~= 0 or #g2 ~= 0)
  		and Duel.SelectYesNo(tp, aux.Stringid(id, 0))
  	then
  		Duel.BreakEffect()
  		local g = nil
  		if #g1 ~= 0 and (#g2 == 0 or Duel.SelectOption(tp, aux.Stringid(id, 1), aux.Stringid(id, 2)) == 0) then
  			g = g1
  		else
  			g = g2
  			Duel.ConfirmCards(tp, g, true)
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local tg = g:FilterSelect(tp, Card.IsAbleToGrave, 1, 1, nil)
  		Duel.SendtoGrave(tg, REASON_EFFECT)
  	end
  end
  
  