name: Speedroid
card_text: Once per turn, during the Standby Phase, if your opponent controls a face-up monster that was Special Summoned from the Extra Deck: You can Special Summon this card from your hand. Cannot be destroyed by battle with a Normal Summoned/Set monster. Your opponent takes any battle damage you would have taken from battles involving this card. You can only use this effect of "Speedroid Skull Marbles" once per turn. If you control a face-up monster that is not a "Speedroid" monster, destroy this card.
external_ids: local SETCARD_ID_0 = 0x2016 --Speedroid
  
lua: local SETCARD_ID_0 = 0x2016 --Speedroid
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e2:SetValue(s.indval)
  	c:RegisterEffect(e2)
  	--battle damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_REFLECT_BATTLE_DAMAGE)
  	e3:SetValue(s.refval)
  	c:RegisterEffect(e3)
  	--self destroy
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e4:SetCode(EFFECT_SELF_DESTROY)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCondition(s.sdcon)
  	c:RegisterEffect(e4)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(Card.IsSummonLocation, tp, 0, LOCATION_MZONE, 1, nil, LOCATION_EXTRA)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  end
  function s.indval(e, c)
  	return c:IsSummonType(SUMMON_TYPE_NORMAL)
  end
  function s.refval(e, c)
  	if e:GetHandler():GetFlagEffect(id) ~= 0 then
  		Duel.RegisterFlagEffect(e:GetHandlerPlayer(), id, RESET_PHASE + PHASE_END, 0, 1)
  		e:GetHandler():ResetFlagEffect(id)
  		return true
  	elseif Duel.GetFlagEffect(e:GetHandlerPlayer(), id) == 0 then
  		e:GetHandler():RegisterFlagEffect(id, 0, 0, 1)
  		return true
  	else
  		return false
  	end
  end
  function s.sdfilter(c)
  	return c:IsFaceup() and not c:IsSetCard(SETCARD_ID_0)
  end
  function s.sdcon(e)
  	return Duel.IsExistingMatchingCard(s.sdfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, nil)
  end
  
  
source_text: Speedroid
  Once per turn, during the Standby Phase, if your opponent controls a face-up monster that was Special Summoned from the Extra Deck: You can Special Summon this card from your hand. Cannot be destroyed by battle with a Normal Summoned/Set monster. Your opponent takes any battle damage you would have taken from battles involving this card. You can only use this effect of "Speedroid Skull Marbles" once per turn. If you control a face-up monster that is not a "Speedroid" monster, destroy this card.
target_text: -- Speedroid
  local SETCARD_ID_0 = 0x2016 --Speedroid
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e2:SetValue(s.indval)
  	c:RegisterEffect(e2)
  	--battle damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_REFLECT_BATTLE_DAMAGE)
  	e3:SetValue(s.refval)
  	c:RegisterEffect(e3)
  	--self destroy
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e4:SetCode(EFFECT_SELF_DESTROY)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCondition(s.sdcon)
  	c:RegisterEffect(e4)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(Card.IsSummonLocation, tp, 0, LOCATION_MZONE, 1, nil, LOCATION_EXTRA)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  end
  function s.indval(e, c)
  	return c:IsSummonType(SUMMON_TYPE_NORMAL)
  end
  function s.refval(e, c)
  	if e:GetHandler():GetFlagEffect(id) ~= 0 then
  		Duel.RegisterFlagEffect(e:GetHandlerPlayer(), id, RESET_PHASE + PHASE_END, 0, 1)
  		e:GetHandler():ResetFlagEffect(id)
  		return true
  	elseif Duel.GetFlagEffect(e:GetHandlerPlayer(), id) == 0 then
  		e:GetHandler():RegisterFlagEffect(id, 0, 0, 1)
  		return true
  	else
  		return false
  	end
  end
  function s.sdfilter(c)
  	return c:IsFaceup() and not c:IsSetCard(SETCARD_ID_0)
  end
  function s.sdcon(e)
  	return Duel.IsExistingMatchingCard(s.sdfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, nil)
  end
  
  