name: Boot-Up
card_text: Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by sending 2 "Gadget" Monster Cards from your hand and/or face-up field to the GY. Cannot be destroyed by battle or card effects while you control a "Gadget" monster or a "Gadget" Monster Card equipped to a monster. Once per turn: You can target 1 other card on the field; destroy it.
external_ids: local SETCARD_ID_0 = 0x51 --Gadget
  
lua: local SETCARD_ID_0 = 0x51 --Gadget
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--cannot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--special summon rule
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.sprcon)
  	e2:SetTarget(s.sprtg)
  	e2:SetOperation(s.sprop)
  	c:RegisterEffect(e2)
  	--indestructable
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCondition(s.indcon)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	local e4 = e3:Clone()
  	e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	c:RegisterEffect(e4)
  	--destroy
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 0))
  	e5:SetCategory(CATEGORY_DESTROY)
  	e5:SetType(EFFECT_TYPE_IGNITION)
  	e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e5:SetRange(LOCATION_MZONE)
  	e5:SetCountLimit(1)
  	e5:SetTarget(s.destg)
  	e5:SetOperation(s.desop)
  	c:RegisterEffect(e5)
  end
  function s.sprfilter(c)
  	return (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsSetCard(SETCARD_ID_0) and bit.band(c:GetOriginalType(), TYPE_MONSTER) ~= 0 and c:IsAbleToGraveAsCost()
  end
  function s.sprcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local g = Duel.GetMatchingGroup(s.sprfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, nil)
  	return g:CheckSubGroup(aux.mzctcheck, 2, 2, tp)
  end
  function s.sprtg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.sprfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local sg = g:SelectSubGroup(tp, aux.mzctcheck, true, 2, 2, tp)
  	if sg then
  		sg:KeepAlive()
  		e:SetLabelObject(sg)
  		return true
  	else
  		return false
  	end
  end
  function s.sprop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = e:GetLabelObject()
  	Duel.SendtoGrave(g, REASON_SPSUMMON)
  	g:DeleteGroup()
  end
  function s.indfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and (c:IsLocation(LOCATION_MZONE) or (bit.band(c:GetOriginalType(), TYPE_MONSTER) ~= 0 and c:GetEquipTarget()))
  end
  function s.indcon(e)
  	return Duel.IsExistingMatchingCard(s.indfilter, e:GetHandlerPlayer(), LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsOnField() and chkc ~= c
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(nil, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, c)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, nil, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, c)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  
  
source_text: Boot-Up
  Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by sending 2 "Gadget" Monster Cards from your hand and/or face-up field to the GY. Cannot be destroyed by battle or card effects while you control a "Gadget" monster or a "Gadget" Monster Card equipped to a monster. Once per turn: You can target 1 other card on the field; destroy it.
target_text: -- Boot-Up
  local SETCARD_ID_0 = 0x51 --Gadget
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--cannot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--special summon rule
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.sprcon)
  	e2:SetTarget(s.sprtg)
  	e2:SetOperation(s.sprop)
  	c:RegisterEffect(e2)
  	--indestructable
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCondition(s.indcon)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	local e4 = e3:Clone()
  	e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	c:RegisterEffect(e4)
  	--destroy
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 0))
  	e5:SetCategory(CATEGORY_DESTROY)
  	e5:SetType(EFFECT_TYPE_IGNITION)
  	e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e5:SetRange(LOCATION_MZONE)
  	e5:SetCountLimit(1)
  	e5:SetTarget(s.destg)
  	e5:SetOperation(s.desop)
  	c:RegisterEffect(e5)
  end
  function s.sprfilter(c)
  	return (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsSetCard(SETCARD_ID_0) and bit.band(c:GetOriginalType(), TYPE_MONSTER) ~= 0 and c:IsAbleToGraveAsCost()
  end
  function s.sprcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local g = Duel.GetMatchingGroup(s.sprfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, nil)
  	return g:CheckSubGroup(aux.mzctcheck, 2, 2, tp)
  end
  function s.sprtg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.sprfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local sg = g:SelectSubGroup(tp, aux.mzctcheck, true, 2, 2, tp)
  	if sg then
  		sg:KeepAlive()
  		e:SetLabelObject(sg)
  		return true
  	else
  		return false
  	end
  end
  function s.sprop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = e:GetLabelObject()
  	Duel.SendtoGrave(g, REASON_SPSUMMON)
  	g:DeleteGroup()
  end
  function s.indfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and (c:IsLocation(LOCATION_MZONE) or (bit.band(c:GetOriginalType(), TYPE_MONSTER) ~= 0 and c:GetEquipTarget()))
  end
  function s.indcon(e)
  	return Duel.IsExistingMatchingCard(s.indfilter, e:GetHandlerPlayer(), LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsOnField() and chkc ~= c
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(nil, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, c)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, nil, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, c)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  
  