name: Gottoms'
card_text: If you control an "X-Saber" Synchro Monster: You can target 2 "X-Saber" monsters in your Graveyard; Special Summon both targets, ignoring their Summoning conditions, but change their ATK to 0, also destroy them during the End Phase of this turn. You can only activate 1 "Gottoms' Second Call" per turn. You cannot conduct your Battle Phase the turn you activate this card.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x100d --X-Saber
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x100d --X-Saber
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCurrentPhase() ~= PHASE_MAIN2
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_BP)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetTargetRange(1, 0)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SYNCHRO)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, true, false)
  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.spfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 1 and Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, 0, 2, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, 0, 2, 2, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 2, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if g:GetCount() ~= 2 then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
  		return
  	end
  	local c = e:GetHandler()
  	local fid = c:GetFieldID()
  	local tc = g:GetFirst()
  	while tc do
  		if Duel.SpecialSummonStep(tc, 0, tp, tp, true, false, POS_FACEUP) then
  			local e1 = Effect.CreateEffect(c)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  			e1:SetValue(0)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			tc:RegisterEffect(e1)
  			tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1, fid)
  		end
  		tc = g:GetNext()
  	end
  	Duel.SpecialSummonComplete()
  	g:KeepAlive()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetCountLimit(1)
  	e1:SetLabel(fid)
  	e1:SetLabelObject(g)
  	e1:SetCondition(s.descon)
  	e1:SetOperation(s.desop)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.desfilter(c, fid)
  	return c:GetFlagEffectLabel(id) == fid
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local g = e:GetLabelObject()
  	if not g:IsExists(s.desfilter, 1, nil, e:GetLabel()) then
  		g:DeleteGroup()
  		e:Reset()
  		return false
  	else
  		return true
  	end
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g = e:GetLabelObject()
  	local tg = g:Filter(s.desfilter, nil, e:GetLabel())
  	Duel.Destroy(tg, REASON_EFFECT)
  end
  
  
source_text: Gottoms'
  If you control an "X-Saber" Synchro Monster: You can target 2 "X-Saber" monsters in your Graveyard; Special Summon both targets, ignoring their Summoning conditions, but change their ATK to 0, also destroy them during the End Phase of this turn. You can only activate 1 "Gottoms' Second Call" per turn. You cannot conduct your Battle Phase the turn you activate this card.
target_text: -- Gottoms'
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0x100d --X-Saber
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCurrentPhase() ~= PHASE_MAIN2
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_BP)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetTargetRange(1, 0)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SYNCHRO)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, true, false)
  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.spfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 1 and Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, 0, 2, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, 0, 2, 2, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 2, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if g:GetCount() ~= 2 then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
  		return
  	end
  	local c = e:GetHandler()
  	local fid = c:GetFieldID()
  	local tc = g:GetFirst()
  	while tc do
  		if Duel.SpecialSummonStep(tc, 0, tp, tp, true, false, POS_FACEUP) then
  			local e1 = Effect.CreateEffect(c)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  			e1:SetValue(0)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			tc:RegisterEffect(e1)
  			tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1, fid)
  		end
  		tc = g:GetNext()
  	end
  	Duel.SpecialSummonComplete()
  	g:KeepAlive()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetCountLimit(1)
  	e1:SetLabel(fid)
  	e1:SetLabelObject(g)
  	e1:SetCondition(s.descon)
  	e1:SetOperation(s.desop)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.desfilter(c, fid)
  	return c:GetFlagEffectLabel(id) == fid
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local g = e:GetLabelObject()
  	if not g:IsExists(s.desfilter, 1, nil, e:GetLabel()) then
  		g:DeleteGroup()
  		e:Reset()
  		return false
  	else
  		return true
  	end
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g = e:GetLabelObject()
  	local tg = g:Filter(s.desfilter, nil, e:GetLabel())
  	Duel.Destroy(tg, REASON_EFFECT)
  end
  
  