name: Wonder
card_text: Immediately after this effect resolves, Xyz Summon 1 Xyz Monster using monsters you control as Materials.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER)
  	e1:SetTarget(s.xyztg)
  	e1:SetOperation(s.xyzop)
  	c:RegisterEffect(e1)
  end
  function s.xyzfilter(c)
  	return c:IsXyzSummonable(nil)
  end
  function s.xyztg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.xyzfilter, tp, LOCATION_EXTRA, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.xyzop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.xyzfilter, tp, LOCATION_EXTRA, 0, nil)
  	if g:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local tg = g:Select(tp, 1, 1, nil)
  		Duel.XyzSummon(tp, tg:GetFirst(), nil)
  	end
  end
  
  
source_text: Wonder
  Immediately after this effect resolves, Xyz Summon 1 Xyz Monster using monsters you control as Materials.
target_text: -- Wonder
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER)
  	e1:SetTarget(s.xyztg)
  	e1:SetOperation(s.xyzop)
  	c:RegisterEffect(e1)
  end
  function s.xyzfilter(c)
  	return c:IsXyzSummonable(nil)
  end
  function s.xyztg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.xyzfilter, tp, LOCATION_EXTRA, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.xyzop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.xyzfilter, tp, LOCATION_EXTRA, 0, nil)
  	if g:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local tg = g:Select(tp, 1, 1, nil)
  		Duel.XyzSummon(tp, tg:GetFirst(), nil)
  	end
  end
  
  