name: Merciful
card_text: Tribute 1 "Cyber Angel" Ritual Monster from your hand or field; draw 2 cards, then place 1 card from your hand on the bottom of the Deck. For the rest of this turn after this card resolves, you cannot Special Summon monsters, except Ritual Monsters. You can only activate 1 "Merciful Machine Angel" per turn.
external_ids: local SETCARD_ID_0 = 0x2093 --Cyber
  
lua: local SETCARD_ID_0 = 0x2093 --Cyber
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.costfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:GetType() & 0x81 == 0x81
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroupEx(tp, s.costfilter, 1, REASON_COST, true, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local g = Duel.SelectReleaseGroupEx(tp, s.costfilter, 1, 1, REASON_COST, true, nil)
  	Duel.Release(g, REASON_COST)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 2)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(2)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Draw(p, d, REASON_EFFECT)
  	local g = Duel.GetMatchingGroup(Card.IsAbleToDeck, p, LOCATION_HAND, 0, nil)
  	if g:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, p, HINTMSG_TODECK)
  		local sg = g:Select(p, 1, 1, nil)
  		Duel.SendtoDeck(sg, nil, SEQ_DECKBOTTOM, REASON_EFFECT)
  	end
  	if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		return
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c)
  	return c:GetOriginalType() & 0x81 ~= 0x81
  end
  
  
source_text: Merciful
  Tribute 1 "Cyber Angel" Ritual Monster from your hand or field; draw 2 cards, then place 1 card from your hand on the bottom of the Deck. For the rest of this turn after this card resolves, you cannot Special Summon monsters, except Ritual Monsters. You can only activate 1 "Merciful Machine Angel" per turn.
target_text: -- Merciful
  local SETCARD_ID_0 = 0x2093 --Cyber
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.costfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:GetType() & 0x81 == 0x81
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroupEx(tp, s.costfilter, 1, REASON_COST, true, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local g = Duel.SelectReleaseGroupEx(tp, s.costfilter, 1, 1, REASON_COST, true, nil)
  	Duel.Release(g, REASON_COST)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 2)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(2)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Draw(p, d, REASON_EFFECT)
  	local g = Duel.GetMatchingGroup(Card.IsAbleToDeck, p, LOCATION_HAND, 0, nil)
  	if g:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, p, HINTMSG_TODECK)
  		local sg = g:Select(p, 1, 1, nil)
  		Duel.SendtoDeck(sg, nil, SEQ_DECKBOTTOM, REASON_EFFECT)
  	end
  	if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		return
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c)
  	return c:GetOriginalType() & 0x81 ~= 0x81
  end
  
  