name: Dogmatika
card_text: Target 1 face-up monster your opponent controls; send 1 monster with an equal or higher ATK from your Extra Deck to the GY, and if you do, destroy that monster. Until the end of your next turn after this card resolves, you cannot Special Summon monsters from the Extra Deck. You can only activate 1 "Dogmatika Punishment" per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.desfilter(c, tp)
  	return c:IsFaceup() and Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_EXTRA, 0, 1, nil, c:GetAttack())
  end
  function s.tgfilter(c, atk)
  	return c:IsAttackAbove(atk) and c:IsAbleToGrave()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.desfilter(chkc, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.desfilter, tp, 0, LOCATION_MZONE, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter, tp, 0, LOCATION_MZONE, 1, 1, nil, tp)
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_EXTRA)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local atk = tc:GetAttack()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, atk)
  		local gc = g:GetFirst()
  		if gc and Duel.SendtoGrave(gc, REASON_EFFECT) ~= 0 and gc:IsLocation(LOCATION_GRAVE) then
  			Duel.Destroy(tc, REASON_EFFECT)
  		end
  	end
  	if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  		e1:SetTargetRange(1, 0)
  		e1:SetTarget(s.splimit)
  		if Duel.GetTurnPlayer() == tp then
  			e1:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 2)
  		else
  			e1:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 1)
  		end
  		Duel.RegisterEffect(e1, tp)
  	end
  end
  function s.splimit(e, c)
  	return c:IsLocation(LOCATION_EXTRA)
  end
  
  
source_text: Dogmatika
  Target 1 face-up monster your opponent controls; send 1 monster with an equal or higher ATK from your Extra Deck to the GY, and if you do, destroy that monster. Until the end of your next turn after this card resolves, you cannot Special Summon monsters from the Extra Deck. You can only activate 1 "Dogmatika Punishment" per turn.
target_text: -- Dogmatika
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.desfilter(c, tp)
  	return c:IsFaceup() and Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_EXTRA, 0, 1, nil, c:GetAttack())
  end
  function s.tgfilter(c, atk)
  	return c:IsAttackAbove(atk) and c:IsAbleToGrave()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.desfilter(chkc, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.desfilter, tp, 0, LOCATION_MZONE, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter, tp, 0, LOCATION_MZONE, 1, 1, nil, tp)
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_EXTRA)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local atk = tc:GetAttack()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, atk)
  		local gc = g:GetFirst()
  		if gc and Duel.SendtoGrave(gc, REASON_EFFECT) ~= 0 and gc:IsLocation(LOCATION_GRAVE) then
  			Duel.Destroy(tc, REASON_EFFECT)
  		end
  	end
  	if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  		e1:SetTargetRange(1, 0)
  		e1:SetTarget(s.splimit)
  		if Duel.GetTurnPlayer() == tp then
  			e1:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 2)
  		else
  			e1:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 1)
  		end
  		Duel.RegisterEffect(e1, tp)
  	end
  end
  function s.splimit(e, c)
  	return c:IsLocation(LOCATION_EXTRA)
  end
  
  