name: Masked
card_text: Must be Special Summoned by "Mask Change". Any card sent to your opponent's GY is banished instead. Once per turn, if your opponent adds a card(s) from their Deck to their hand (except during the Draw Phase or the Damage Step): You can banish 1 random card from your opponent's hand.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--spsummon condition
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(aux.MaskChangeLimit)
  	c:RegisterEffect(e1)
  	--remove
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_IGNORE_RANGE + EFFECT_FLAG_IGNORE_IMMUNE)
  	e2:SetCode(EFFECT_TO_GRAVE_REDIRECT)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, LOCATION_DECK)
  	e2:SetValue(LOCATION_REMOVED)
  	e2:SetTarget(s.rmtg)
  	c:RegisterEffect(e2)
  	--handes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_REMOVE)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetProperty(EFFECT_FLAG_DELAY)
  	e3:SetCode(EVENT_TO_HAND)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.hdcon)
  	e3:SetTarget(s.hdtg)
  	e3:SetOperation(s.hdop)
  	c:RegisterEffect(e3)
  end
  function s.rmtg(e, c)
  	return c:GetOwner() ~= e:GetHandlerPlayer()
  end
  function s.cfilter(c, tp)
  	return c:IsControler(tp) and c:IsPreviousLocation(LOCATION_DECK)
  end
  function s.hdcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetCurrentPhase() ~= PHASE_DRAW and eg:IsExists(s.cfilter, 1, nil, 1 - tp)
  end
  function s.hdtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsAbleToRemove, tp, 0, LOCATION_HAND, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, nil, 1, tp, LOCATION_HAND)
  end
  function s.hdop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, 0, LOCATION_HAND, nil)
  	if g:GetCount() > 0 then
  		local sg = g:RandomSelect(tp, 1)
  		Duel.Remove(sg, POS_FACEUP, REASON_EFFECT)
  	end
  end
  
  
source_text: Masked
  Must be Special Summoned by "Mask Change". Any card sent to your opponent's GY is banished instead. Once per turn, if your opponent adds a card(s) from their Deck to their hand (except during the Draw Phase or the Damage Step): You can banish 1 random card from your opponent's hand.
target_text: -- Masked
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--spsummon condition
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(aux.MaskChangeLimit)
  	c:RegisterEffect(e1)
  	--remove
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_IGNORE_RANGE + EFFECT_FLAG_IGNORE_IMMUNE)
  	e2:SetCode(EFFECT_TO_GRAVE_REDIRECT)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, LOCATION_DECK)
  	e2:SetValue(LOCATION_REMOVED)
  	e2:SetTarget(s.rmtg)
  	c:RegisterEffect(e2)
  	--handes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_REMOVE)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetProperty(EFFECT_FLAG_DELAY)
  	e3:SetCode(EVENT_TO_HAND)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.hdcon)
  	e3:SetTarget(s.hdtg)
  	e3:SetOperation(s.hdop)
  	c:RegisterEffect(e3)
  end
  function s.rmtg(e, c)
  	return c:GetOwner() ~= e:GetHandlerPlayer()
  end
  function s.cfilter(c, tp)
  	return c:IsControler(tp) and c:IsPreviousLocation(LOCATION_DECK)
  end
  function s.hdcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetCurrentPhase() ~= PHASE_DRAW and eg:IsExists(s.cfilter, 1, nil, 1 - tp)
  end
  function s.hdtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsAbleToRemove, tp, 0, LOCATION_HAND, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, nil, 1, tp, LOCATION_HAND)
  end
  function s.hdop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, 0, LOCATION_HAND, nil)
  	if g:GetCount() > 0 then
  		local sg = g:RandomSelect(tp, 1)
  		Duel.Remove(sg, POS_FACEUP, REASON_EFFECT)
  	end
  end
  
  