name: Rainbow
card_text: (This card is always treated as an "Ultimate Crystal" card.)
  Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by banishing 7 DARK monsters with different names from your GY. You can banish all other DARK monsters from your field and GY; this card gains 500 ATK for each card banished this way.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--splimit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  	--atkup
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetCategory(CATEGORY_ATKCHANGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCost(s.atkcost)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  end
  function s.spfilter(c)
  	return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToRemoveAsCost()
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	if Duel.GetLocationCount(c:GetControler(), LOCATION_MZONE) <= 0 then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.spfilter, c:GetControler(), LOCATION_GRAVE, 0, nil)
  	local ct = g:GetClassCount(Card.GetCode)
  	return ct >= 7
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_GRAVE, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	aux.GCheckAdditional = aux.dncheck
  	local sg = g:SelectSubGroup(tp, aux.TRUE, true, 7, 7)
  	aux.GCheckAdditional = nil
  	if sg then
  		sg:KeepAlive()
  		e:SetLabelObject(sg)
  		return true
  	else
  		return false
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local rg = e:GetLabelObject()
  	Duel.Remove(rg, POS_FACEUP, REASON_SPSUMMON)
  	rg:DeleteGroup()
  end
  function s.cfilter(c)
  	return c:IsAttribute(ATTRIBUTE_DARK) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup())
  end
  function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, e:GetHandler())
  	if chk == 0 then
  		return g:GetCount() > 0 and g:FilterCount(Card.IsAbleToRemoveAsCost, nil) == g:GetCount()
  	end
  	e:SetLabel(g:GetCount())
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFaceup() and c:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(e:GetLabel() * 500)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  end
  
  
source_text: Rainbow
  (This card is always treated as an "Ultimate Crystal" card.)
  Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by banishing 7 DARK monsters with different names from your GY. You can banish all other DARK monsters from your field and GY; this card gains 500 ATK for each card banished this way.
target_text: -- Rainbow
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--splimit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  	--atkup
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetCategory(CATEGORY_ATKCHANGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCost(s.atkcost)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  end
  function s.spfilter(c)
  	return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToRemoveAsCost()
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	if Duel.GetLocationCount(c:GetControler(), LOCATION_MZONE) <= 0 then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.spfilter, c:GetControler(), LOCATION_GRAVE, 0, nil)
  	local ct = g:GetClassCount(Card.GetCode)
  	return ct >= 7
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_GRAVE, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	aux.GCheckAdditional = aux.dncheck
  	local sg = g:SelectSubGroup(tp, aux.TRUE, true, 7, 7)
  	aux.GCheckAdditional = nil
  	if sg then
  		sg:KeepAlive()
  		e:SetLabelObject(sg)
  		return true
  	else
  		return false
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local rg = e:GetLabelObject()
  	Duel.Remove(rg, POS_FACEUP, REASON_SPSUMMON)
  	rg:DeleteGroup()
  end
  function s.cfilter(c)
  	return c:IsAttribute(ATTRIBUTE_DARK) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup())
  end
  function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, e:GetHandler())
  	if chk == 0 then
  		return g:GetCount() > 0 and g:FilterCount(Card.IsAbleToRemoveAsCost, nil) == g:GetCount()
  	end
  	e:SetLabel(g:GetCount())
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFaceup() and c:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(e:GetLabel() * 500)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  end
  
  