name: Galaxy
card_text: When this card is activated: You can send 1 "Photon" or "Galaxy" card from your Deck to the GY. If "Galaxy-Eyes Photon Dragon" is Special Summoned to your field (except during the Damage Step): You can look at your opponent's Extra Deck, then you can apply 1 of these effects.
  ● Banish 1 monster from it.
  ● Special Summon 1 "Number" monster from it to your field.
  You can only use this effect of "Galaxy Hundred" once per turn. You can only activate 1 "Galaxy Hundred" per turn.
external_ids: local CARD_ID_1 = 93717133 --Galaxy-Eyes Photon Dragon
  local SETCARD_ID_0 = 0x55 --Photon
  local SETCARD_ID_1 = 0x48 --Number
  
lua: local CARD_ID_1 = 93717133 --Galaxy-Eyes Photon Dragon
  local SETCARD_ID_0 = 0x55 --Photon
  local SETCARD_ID_1 = 0x48 --Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_DECKDES)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--confirm
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_REMOVE + CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.cfcon)
  	e2:SetTarget(s.cftg)
  	e2:SetOperation(s.cfop)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsSetCard(SETCARD_ID_1, 0x7b) and c:IsAbleToGrave()
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil)
  	if g:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local sg = g:Select(tp, 1, 1, nil)
  		Duel.SendtoGrave(sg, REASON_EFFECT)
  	end
  end
  function s.cfilter(c, tp)
  	return c:IsControler(tp) and c:IsFaceup() and c:IsCode(CARD_ID_1)
  end
  function s.cfcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp)
  end
  function s.cftg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(nil, 1 - tp, LOCATION_EXTRA, 0, 1, nil)
  	end
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_1) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.GetLocationCountFromEx(tp, tp, nil, c) > 0
  end
  function s.cfop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetFieldGroup(tp, 0, LOCATION_EXTRA)
  	Duel.ConfirmCards(tp, g)
  	local g1 = g:Filter(Card.IsAbleToRemove, nil, tp, POS_FACEUP)
  	local g2 = g:Filter(s.spfilter, nil, e, tp)
  	local b1 = g1:GetCount() > 0
  	local b2 = g2:GetCount() > 0
  	local off = 1
  	local ops = {}
  	local opval = {}
  	if b1 then
  		ops[off] = aux.Stringid(id, 1)
  		opval[off - 1] = 1
  		off = off + 1
  	end
  	if b2 then
  		ops[off] = aux.Stringid(id, 2)
  		opval[off - 1] = 2
  		off = off + 1
  	end
  	ops[off] = aux.Stringid(id, 3)
  	opval[off - 1] = 3
  	off = off + 1
  	local op = Duel.SelectOption(tp, table.unpack(ops))
  	if opval[op] == 1 then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local sg = g1:Select(tp, 1, 1, nil)
  		if #sg > 0 then
  			Duel.Remove(sg, POS_FACEUP, REASON_EFFECT)
  		end
  		Duel.ShuffleExtra(1 - tp)
  	elseif opval[op] == 2 then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = g2:Select(tp, 1, 1, nil)
  		if #sg > 0 then
  			Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP)
  		end
  		Duel.ShuffleExtra(1 - tp)
  	end
  end
  
  
source_text: Galaxy
  When this card is activated: You can send 1 "Photon" or "Galaxy" card from your Deck to the GY. If "Galaxy-Eyes Photon Dragon" is Special Summoned to your field (except during the Damage Step): You can look at your opponent's Extra Deck, then you can apply 1 of these effects.
  ● Banish 1 monster from it.
  ● Special Summon 1 "Number" monster from it to your field.
  You can only use this effect of "Galaxy Hundred" once per turn. You can only activate 1 "Galaxy Hundred" per turn.
target_text: -- Galaxy
  local CARD_ID_1 = 93717133 --Galaxy-Eyes Photon Dragon
  local SETCARD_ID_0 = 0x55 --Photon
  local SETCARD_ID_1 = 0x48 --Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_DECKDES)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--confirm
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_REMOVE + CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.cfcon)
  	e2:SetTarget(s.cftg)
  	e2:SetOperation(s.cfop)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsSetCard(SETCARD_ID_1, 0x7b) and c:IsAbleToGrave()
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil)
  	if g:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local sg = g:Select(tp, 1, 1, nil)
  		Duel.SendtoGrave(sg, REASON_EFFECT)
  	end
  end
  function s.cfilter(c, tp)
  	return c:IsControler(tp) and c:IsFaceup() and c:IsCode(CARD_ID_1)
  end
  function s.cfcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp)
  end
  function s.cftg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(nil, 1 - tp, LOCATION_EXTRA, 0, 1, nil)
  	end
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_1) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.GetLocationCountFromEx(tp, tp, nil, c) > 0
  end
  function s.cfop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetFieldGroup(tp, 0, LOCATION_EXTRA)
  	Duel.ConfirmCards(tp, g)
  	local g1 = g:Filter(Card.IsAbleToRemove, nil, tp, POS_FACEUP)
  	local g2 = g:Filter(s.spfilter, nil, e, tp)
  	local b1 = g1:GetCount() > 0
  	local b2 = g2:GetCount() > 0
  	local off = 1
  	local ops = {}
  	local opval = {}
  	if b1 then
  		ops[off] = aux.Stringid(id, 1)
  		opval[off - 1] = 1
  		off = off + 1
  	end
  	if b2 then
  		ops[off] = aux.Stringid(id, 2)
  		opval[off - 1] = 2
  		off = off + 1
  	end
  	ops[off] = aux.Stringid(id, 3)
  	opval[off - 1] = 3
  	off = off + 1
  	local op = Duel.SelectOption(tp, table.unpack(ops))
  	if opval[op] == 1 then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local sg = g1:Select(tp, 1, 1, nil)
  		if #sg > 0 then
  			Duel.Remove(sg, POS_FACEUP, REASON_EFFECT)
  		end
  		Duel.ShuffleExtra(1 - tp)
  	elseif opval[op] == 2 then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = g2:Select(tp, 1, 1, nil)
  		if #sg > 0 then
  			Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP)
  		end
  		Duel.ShuffleExtra(1 - tp)
  	end
  end
  
  