name: Gimmick
card_text: You can Special Summon this card (from your hand) by discarding 1 "Gimmick Puppet" monster. You can banish this card from your GY; your opponent cannot target "Gimmick Puppet" monsters you control with card effects this turn.
external_ids: local SETCARD_ID_0 = 0x1083 --Gimmick
  
lua: local SETCARD_ID_0 = 0x1083 --Gimmick
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--protection
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCost(aux.bfgcost)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  end
  function s.spfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, c)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, c)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISCARD)
  	local tc = g:SelectUnselect(nil, tp, false, true, 1, 1)
  	if tc then
  		e:SetLabelObject(tc)
  		return true
  	else
  		return false
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = e:GetLabelObject()
  	Duel.SendtoGrave(g, REASON_SPSUMMON + REASON_DISCARD)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.efftg)
  	e1:SetValue(aux.tgoval)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.efftg(e, c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  
  
source_text: Gimmick
  You can Special Summon this card (from your hand) by discarding 1 "Gimmick Puppet" monster. You can banish this card from your GY; your opponent cannot target "Gimmick Puppet" monsters you control with card effects this turn.
target_text: -- Gimmick
  local SETCARD_ID_0 = 0x1083 --Gimmick
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--protection
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCost(aux.bfgcost)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  end
  function s.spfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, c)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, c)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISCARD)
  	local tc = g:SelectUnselect(nil, tp, false, true, 1, 1)
  	if tc then
  		e:SetLabelObject(tc)
  		return true
  	else
  		return false
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = e:GetLabelObject()
  	Duel.SendtoGrave(g, REASON_SPSUMMON + REASON_DISCARD)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.efftg)
  	e1:SetValue(aux.tgoval)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.efftg(e, c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  
  