name: Memories
card_text: Draw cards equal to the number of "Number" Xyz Monsters with different names you control. You can only activate 1 "Memories of Hope" per turn.
external_ids: local SETCARD_ID_0 = 0x48 --Number
  
lua: local SETCARD_ID_0 = 0x48 --Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_XYZ)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_MZONE, 0, nil)
  	local ct = g:GetClassCount(Card.GetCode)
  	if chk == 0 then
  		return ct > 0 and Duel.IsPlayerCanDraw(tp, ct)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(ct)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, ct)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_MZONE, 0, nil)
  	local ct = g:GetClassCount(Card.GetCode)
  	Duel.Draw(p, ct, REASON_EFFECT)
  end
  
  
source_text: Memories
  Draw cards equal to the number of "Number" Xyz Monsters with different names you control. You can only activate 1 "Memories of Hope" per turn.
target_text: -- Memories
  local SETCARD_ID_0 = 0x48 --Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_XYZ)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_MZONE, 0, nil)
  	local ct = g:GetClassCount(Card.GetCode)
  	if chk == 0 then
  		return ct > 0 and Duel.IsPlayerCanDraw(tp, ct)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(ct)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, ct)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_MZONE, 0, nil)
  	local ct = g:GetClassCount(Card.GetCode)
  	Duel.Draw(p, ct, REASON_EFFECT)
  end
  
  