name: Crush
card_text: Tribute 1 DARK monster with 1000 or less ATK; your opponent takes no damage until the end of the next turn after this card resolves, also, you look at your opponent's hand and all monsters they control, and if you do, destroy the monsters among them with 1500 or more ATK, then your opponent can destroy up to 3 monsters with 1500 or more ATK in their Deck.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_TOHAND)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.costfilter(c)
  	return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAttackBelow(1000)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.costfilter, 1, nil)
  	end
  	local g = Duel.SelectReleaseGroup(tp, s.costfilter, 1, 1, nil)
  	Duel.Release(g, REASON_COST)
  end
  function s.filter(c)
  	return c:IsAttackAbove(1500)
  end
  function s.hgfilter(c)
  	return not c:IsPublic() or s.filter(c)
  end
  function s.fgfilter(c)
  	return c:IsFacedown() or s.filter(c)
  end
  function s.tgfilter(c)
  	return ((c:IsLocation(LOCATION_HAND) and c:IsPublic()) or (c:IsLocation(LOCATION_MZONE) and c:IsFaceup())) and s.filter(c)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.hgfilter, tp, 0, LOCATION_HAND, 1, nil) or Duel.IsExistingMatchingCard(s.fgfilter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.tgfilter, tp, 0, LOCATION_MZONE + LOCATION_HAND, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local conf = Duel.GetFieldGroup(tp, 0, LOCATION_MZONE + LOCATION_HAND)
  	local ct = 0
  	if conf:GetCount() > 0 then
  		Duel.ConfirmCards(tp, conf)
  		local dg = conf:Filter(s.filter, nil)
  		ct = Duel.Destroy(dg, REASON_EFFECT)
  		Duel.ShuffleHand(1 - tp)
  	end
  	local g = Duel.GetMatchingGroup(s.filter, 1 - tp, LOCATION_DECK, 0, nil)
  	if ct > 0 and g:GetCount() > 0 and Duel.SelectYesNo(1 - tp, aux.Stringid(id, 0)) then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_DESTROY)
  		local dg = g:Select(1 - tp, 1, 3, nil)
  		Duel.Destroy(dg, REASON_EFFECT)
  	end
  	if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetCode(EFFECT_CHANGE_DAMAGE)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetTargetRange(0, 1)
  		e1:SetValue(0)
  		e1:SetReset(RESET_PHASE + PHASE_END, 2)
  		Duel.RegisterEffect(e1, tp)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_NO_EFFECT_DAMAGE)
  		e2:SetReset(RESET_PHASE + PHASE_END, 2)
  		Duel.RegisterEffect(e2, tp)
  	end
  end
  
  
source_text: Crush
  Tribute 1 DARK monster with 1000 or less ATK; your opponent takes no damage until the end of the next turn after this card resolves, also, you look at your opponent's hand and all monsters they control, and if you do, destroy the monsters among them with 1500 or more ATK, then your opponent can destroy up to 3 monsters with 1500 or more ATK in their Deck.
target_text: -- Crush
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_TOHAND)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.costfilter(c)
  	return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAttackBelow(1000)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.costfilter, 1, nil)
  	end
  	local g = Duel.SelectReleaseGroup(tp, s.costfilter, 1, 1, nil)
  	Duel.Release(g, REASON_COST)
  end
  function s.filter(c)
  	return c:IsAttackAbove(1500)
  end
  function s.hgfilter(c)
  	return not c:IsPublic() or s.filter(c)
  end
  function s.fgfilter(c)
  	return c:IsFacedown() or s.filter(c)
  end
  function s.tgfilter(c)
  	return ((c:IsLocation(LOCATION_HAND) and c:IsPublic()) or (c:IsLocation(LOCATION_MZONE) and c:IsFaceup())) and s.filter(c)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.hgfilter, tp, 0, LOCATION_HAND, 1, nil) or Duel.IsExistingMatchingCard(s.fgfilter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.tgfilter, tp, 0, LOCATION_MZONE + LOCATION_HAND, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local conf = Duel.GetFieldGroup(tp, 0, LOCATION_MZONE + LOCATION_HAND)
  	local ct = 0
  	if conf:GetCount() > 0 then
  		Duel.ConfirmCards(tp, conf)
  		local dg = conf:Filter(s.filter, nil)
  		ct = Duel.Destroy(dg, REASON_EFFECT)
  		Duel.ShuffleHand(1 - tp)
  	end
  	local g = Duel.GetMatchingGroup(s.filter, 1 - tp, LOCATION_DECK, 0, nil)
  	if ct > 0 and g:GetCount() > 0 and Duel.SelectYesNo(1 - tp, aux.Stringid(id, 0)) then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_DESTROY)
  		local dg = g:Select(1 - tp, 1, 3, nil)
  		Duel.Destroy(dg, REASON_EFFECT)
  	end
  	if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetCode(EFFECT_CHANGE_DAMAGE)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetTargetRange(0, 1)
  		e1:SetValue(0)
  		e1:SetReset(RESET_PHASE + PHASE_END, 2)
  		Duel.RegisterEffect(e1, tp)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_NO_EFFECT_DAMAGE)
  		e2:SetReset(RESET_PHASE + PHASE_END, 2)
  		Duel.RegisterEffect(e2, tp)
  	end
  end
  
  