name: Phantom
card_text: Once per turn, if you control a face-up "Infernity" monster(s), you can remove from play all cards in your hand (face-down) until your next Standby Phase.
external_ids: local SETCARD_ID_0 = 0xb --Infernity
  
lua: local SETCARD_ID_0 = 0xb --Infernity
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--remove
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetCondition(s.remcon)
  	e2:SetTarget(s.remtg)
  	e2:SetOperation(s.remop)
  	c:RegisterEffect(e2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if
  		Duel.IsExistingMatchingCard(Card.IsAbleToRemove, tp, LOCATION_HAND, 0, 1, nil, tp, POS_FACEDOWN)
  		and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  		and Duel.SelectYesNo(tp, aux.Stringid(id, 1))
  	then
  		s.remop(e, tp, eg, ep, ev, re, r, rp)
  		e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  		e:GetHandler():RegisterFlagEffect(0, RESET_CHAIN, EFFECT_FLAG_CLIENT_HINT, 1, 0, aux.Stringid(id, 2))
  	end
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.remcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.remtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():GetFlagEffect(id) == 0 and Duel.IsExistingMatchingCard(Card.IsAbleToRemove, tp, LOCATION_HAND, 0, 1, nil, tp, POS_FACEDOWN)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, nil, 1, tp, LOCATION_HAND)
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.remop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_HAND, 0, nil, tp, POS_FACEDOWN)
  	if g:GetCount() > 0 then
  		Duel.Remove(g, POS_FACEDOWN, REASON_EFFECT)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  		e1:SetReset(RESET_PHASE + PHASE_STANDBY + RESET_SELF_TURN, 1)
  		e1:SetCountLimit(1)
  		e1:SetLabel(s.counter)
  		e1:SetCondition(s.retcon)
  		e1:SetOperation(s.retop)
  		e1:SetLabelObject(g)
  		Duel.RegisterEffect(e1, tp)
  		g:KeepAlive()
  		local tc = g:GetFirst()
  		while tc do
  			tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1)
  			tc = g:GetNext()
  		end
  	end
  end
  function s.retfilter(c)
  	return c:GetFlagEffect(id) ~= 0
  end
  function s.retcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.retop(e, tp, eg, ep, ev, re, r, rp)
  	local g = e:GetLabelObject()
  	local sg = g:Filter(s.retfilter, nil)
  	g:DeleteGroup()
  	if sg:GetCount() > 0 then
  		Duel.SendtoHand(sg, nil, REASON_EFFECT)
  	end
  end
  
  
source_text: Phantom
  Once per turn, if you control a face-up "Infernity" monster(s), you can remove from play all cards in your hand (face-down) until your next Standby Phase.
target_text: -- Phantom
  local SETCARD_ID_0 = 0xb --Infernity
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--remove
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetCondition(s.remcon)
  	e2:SetTarget(s.remtg)
  	e2:SetOperation(s.remop)
  	c:RegisterEffect(e2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if
  		Duel.IsExistingMatchingCard(Card.IsAbleToRemove, tp, LOCATION_HAND, 0, 1, nil, tp, POS_FACEDOWN)
  		and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  		and Duel.SelectYesNo(tp, aux.Stringid(id, 1))
  	then
  		s.remop(e, tp, eg, ep, ev, re, r, rp)
  		e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  		e:GetHandler():RegisterFlagEffect(0, RESET_CHAIN, EFFECT_FLAG_CLIENT_HINT, 1, 0, aux.Stringid(id, 2))
  	end
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.remcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.remtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():GetFlagEffect(id) == 0 and Duel.IsExistingMatchingCard(Card.IsAbleToRemove, tp, LOCATION_HAND, 0, 1, nil, tp, POS_FACEDOWN)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, nil, 1, tp, LOCATION_HAND)
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.remop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_HAND, 0, nil, tp, POS_FACEDOWN)
  	if g:GetCount() > 0 then
  		Duel.Remove(g, POS_FACEDOWN, REASON_EFFECT)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  		e1:SetReset(RESET_PHASE + PHASE_STANDBY + RESET_SELF_TURN, 1)
  		e1:SetCountLimit(1)
  		e1:SetLabel(s.counter)
  		e1:SetCondition(s.retcon)
  		e1:SetOperation(s.retop)
  		e1:SetLabelObject(g)
  		Duel.RegisterEffect(e1, tp)
  		g:KeepAlive()
  		local tc = g:GetFirst()
  		while tc do
  			tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1)
  			tc = g:GetNext()
  		end
  	end
  end
  function s.retfilter(c)
  	return c:GetFlagEffect(id) ~= 0
  end
  function s.retcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.retop(e, tp, eg, ep, ev, re, r, rp)
  	local g = e:GetLabelObject()
  	local sg = g:Filter(s.retfilter, nil)
  	g:DeleteGroup()
  	if sg:GetCount() > 0 then
  		Duel.SendtoHand(sg, nil, REASON_EFFECT)
  	end
  end
  
  