name: The
card_text: Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by banishing 1 LIGHT and 1 DARK monster from your GY. If you control this card that was Special Summoned from the hand: You can target 3 banished monsters with different names; Special Summon 1 of them, then place the rest on the bottom of the Deck in any order. You can only use this effect of "The Chaos Creator" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--todeck and special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TODECK + CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.tdcon)
  	e2:SetTarget(s.tdtg)
  	e2:SetOperation(s.tdop)
  	c:RegisterEffect(e2)
  end
  function s.spcostfilter(c)
  	return c:IsAbleToRemoveAsCost() and c:IsAttribute(ATTRIBUTE_LIGHT + ATTRIBUTE_DARK)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	if Duel.GetMZoneCount(tp) <= 0 then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.spcostfilter, tp, LOCATION_GRAVE, 0, nil)
  	return g:CheckSubGroup(aux.gfcheck, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spcostfilter, tp, LOCATION_GRAVE, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = g:SelectSubGroup(tp, aux.gfcheck, true, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  	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 sg = e:GetLabelObject()
  	Duel.Remove(sg, POS_FACEUP, REASON_SPSUMMON)
  	sg:DeleteGroup()
  end
  function s.tdcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL) and e:GetHandler():IsPreviousLocation(LOCATION_HAND)
  end
  function s.tdfilter(c, e, tp)
  	return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsCanBeEffectTarget(e) and (c:IsAbleToDeck() or c:IsCanBeSpecialSummoned(e, 0, tp, false, false))
  end
  function s.fselect(g, e, tp)
  	return aux.dncheck(g) and g:IsExists(Card.IsAbleToDeck, 2, nil) and g:IsExists(Card.IsCanBeSpecialSummoned, 1, nil, e, 0, tp, false, false)
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local dg = Duel.GetMatchingGroup(s.tdfilter, tp, LOCATION_REMOVED, LOCATION_REMOVED, nil, e, tp)
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return dg:CheckSubGroup(s.fselect, 3, 3, e, tp) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  	local g = dg:SelectSubGroup(tp, s.fselect, false, 3, 3, e, tp)
  	Duel.SetTargetCard(g)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, 2, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.spfilter(c, e, tp)
  	return c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if tg:GetCount() > 0 and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = tg:FilterSelect(tp, s.spfilter, 1, 1, nil, e, tp)
  		if sg:GetCount() > 0 then
  			Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP)
  			tg:Sub(sg)
  			aux.PlaceCardsOnDeckBottom(tp, tg)
  		end
  	end
  end
  
  
source_text: The
  Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by banishing 1 LIGHT and 1 DARK monster from your GY. If you control this card that was Special Summoned from the hand: You can target 3 banished monsters with different names; Special Summon 1 of them, then place the rest on the bottom of the Deck in any order. You can only use this effect of "The Chaos Creator" once per turn.
target_text: -- The
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--todeck and special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TODECK + CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.tdcon)
  	e2:SetTarget(s.tdtg)
  	e2:SetOperation(s.tdop)
  	c:RegisterEffect(e2)
  end
  function s.spcostfilter(c)
  	return c:IsAbleToRemoveAsCost() and c:IsAttribute(ATTRIBUTE_LIGHT + ATTRIBUTE_DARK)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	if Duel.GetMZoneCount(tp) <= 0 then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.spcostfilter, tp, LOCATION_GRAVE, 0, nil)
  	return g:CheckSubGroup(aux.gfcheck, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spcostfilter, tp, LOCATION_GRAVE, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = g:SelectSubGroup(tp, aux.gfcheck, true, 2, 2, Card.IsAttribute, ATTRIBUTE_LIGHT, ATTRIBUTE_DARK)
  	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 sg = e:GetLabelObject()
  	Duel.Remove(sg, POS_FACEUP, REASON_SPSUMMON)
  	sg:DeleteGroup()
  end
  function s.tdcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL) and e:GetHandler():IsPreviousLocation(LOCATION_HAND)
  end
  function s.tdfilter(c, e, tp)
  	return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsCanBeEffectTarget(e) and (c:IsAbleToDeck() or c:IsCanBeSpecialSummoned(e, 0, tp, false, false))
  end
  function s.fselect(g, e, tp)
  	return aux.dncheck(g) and g:IsExists(Card.IsAbleToDeck, 2, nil) and g:IsExists(Card.IsCanBeSpecialSummoned, 1, nil, e, 0, tp, false, false)
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local dg = Duel.GetMatchingGroup(s.tdfilter, tp, LOCATION_REMOVED, LOCATION_REMOVED, nil, e, tp)
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return dg:CheckSubGroup(s.fselect, 3, 3, e, tp) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  	local g = dg:SelectSubGroup(tp, s.fselect, false, 3, 3, e, tp)
  	Duel.SetTargetCard(g)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, 2, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  end
  function s.spfilter(c, e, tp)
  	return c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if tg:GetCount() > 0 and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = tg:FilterSelect(tp, s.spfilter, 1, 1, nil, e, tp)
  		if sg:GetCount() > 0 then
  			Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP)
  			tg:Sub(sg)
  			aux.PlaceCardsOnDeckBottom(tp, tg)
  		end
  	end
  end
  
  