name: スクラップ・ゴーレム
card_text: 1ターンに1度、自分の墓地に存在するレベル4以下の「スクラップ」と名のついたモンスター1体を選択し、自分または相手フィールド上に特殊召喚する事ができる。
external_ids: local SETCARD_ID_0 = 0x24 --スクラップ
  
lua: local SETCARD_ID_0 = 0x24 --スクラップ
  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_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, e, tp)
  	return c:IsLevelBelow(4) and c:IsSetCard(SETCARD_ID_0) and (c:IsCanBeSpecialSummoned(e, 0, tp, false, false) or c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP, 1 - tp))
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return (Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 or Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0) and Duel.IsExistingTarget(s.filter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if not tc:IsRelateToEffect(e) then
  		return
  	end
  	local s1 = Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and tc:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	local s2 = Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0 and tc:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP, 1 - tp)
  	local op = 0
  	Duel.Hint(HINT_SELECTMSG, tp, 0)
  	if s1 and s2 then
  		op = Duel.SelectOption(tp, aux.Stringid(id, 1), aux.Stringid(id, 2))
  	elseif s1 then
  		op = Duel.SelectOption(tp, aux.Stringid(id, 1))
  	elseif s2 then
  		op = Duel.SelectOption(tp, aux.Stringid(id, 2)) + 1
  	else
  		return
  	end
  	if op == 0 then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  	else
  		Duel.SpecialSummon(tc, 0, tp, 1 - tp, false, false, POS_FACEUP)
  	end
  end
  
  
source_text: スクラップ・ゴーレム
  1ターンに1度、自分の墓地に存在するレベル4以下の「スクラップ」と名のついたモンスター1体を選択し、自分または相手フィールド上に特殊召喚する事ができる。
target_text: -- スクラップ・ゴーレム
  local SETCARD_ID_0 = 0x24 --スクラップ
  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_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, e, tp)
  	return c:IsLevelBelow(4) and c:IsSetCard(SETCARD_ID_0) and (c:IsCanBeSpecialSummoned(e, 0, tp, false, false) or c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP, 1 - tp))
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return (Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 or Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0) and Duel.IsExistingTarget(s.filter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if not tc:IsRelateToEffect(e) then
  		return
  	end
  	local s1 = Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and tc:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	local s2 = Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0 and tc:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP, 1 - tp)
  	local op = 0
  	Duel.Hint(HINT_SELECTMSG, tp, 0)
  	if s1 and s2 then
  		op = Duel.SelectOption(tp, aux.Stringid(id, 1), aux.Stringid(id, 2))
  	elseif s1 then
  		op = Duel.SelectOption(tp, aux.Stringid(id, 1))
  	elseif s2 then
  		op = Duel.SelectOption(tp, aux.Stringid(id, 2)) + 1
  	else
  		return
  	end
  	if op == 0 then
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  	else
  		Duel.SpecialSummon(tc, 0, tp, 1 - tp, false, false, POS_FACEUP)
  	end
  end
  
  