name: Sophia,
card_text: Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by banishing 1 face-up Ritual, Fusion, Synchro, and Xyz Monster from anywhere on the field, and cannot be Special Summoned by other ways. This card's Special Summon cannot be negated. When this card is Special Summoned: Banish all other cards from both players' hands, fields, and Graveyards. Cards and effects cannot be activated in response to this effect's activation.
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)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_CANNOT_DISABLE_SPSUMMON)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	c:RegisterEffect(e2)
  	--cannot special summon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e3)
  	--remove
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_REMOVE)
  	e4:SetType(EFFECT_TYPE_TRIGGER_F + EFFECT_TYPE_SINGLE)
  	e4:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e4:SetTarget(s.rmtg)
  	e4:SetOperation(s.rmop)
  	c:RegisterEffect(e4)
  end
  s.spchecks = aux.CreateChecks(Card.IsType, { TYPE_RITUAL, TYPE_FUSION, TYPE_SYNCHRO, TYPE_XYZ })
  function s.spcostfilter(c)
  	return c:IsFaceup() and c:IsAbleToRemoveAsCost() and c:IsType(TYPE_RITUAL + TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local g = Duel.GetMatchingGroup(s.spcostfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	return g:CheckSubGroupEach(s.spchecks, aux.mzctcheck, tp)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spcostfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = g:SelectSubGroupEach(tp, s.spchecks, true, aux.mzctcheck, tp)
  	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 g = e:GetLabelObject()
  	Duel.Remove(g, POS_FACEUP, REASON_SPSUMMON)
  	g:DeleteGroup()
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, e:GetHandler())
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, g:GetCount(), 0, 0)
  	Duel.SetChainLimit(aux.FALSE)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, aux.ExceptThisCard(e))
  	Duel.Remove(g, POS_FACEUP, REASON_EFFECT)
  end
  
  
source_text: Sophia,
  Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by banishing 1 face-up Ritual, Fusion, Synchro, and Xyz Monster from anywhere on the field, and cannot be Special Summoned by other ways. This card's Special Summon cannot be negated. When this card is Special Summoned: Banish all other cards from both players' hands, fields, and Graveyards. Cards and effects cannot be activated in response to this effect's activation.
target_text: -- Sophia,
  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)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_CANNOT_DISABLE_SPSUMMON)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	c:RegisterEffect(e2)
  	--cannot special summon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e3)
  	--remove
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_REMOVE)
  	e4:SetType(EFFECT_TYPE_TRIGGER_F + EFFECT_TYPE_SINGLE)
  	e4:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e4:SetTarget(s.rmtg)
  	e4:SetOperation(s.rmop)
  	c:RegisterEffect(e4)
  end
  s.spchecks = aux.CreateChecks(Card.IsType, { TYPE_RITUAL, TYPE_FUSION, TYPE_SYNCHRO, TYPE_XYZ })
  function s.spcostfilter(c)
  	return c:IsFaceup() and c:IsAbleToRemoveAsCost() and c:IsType(TYPE_RITUAL + TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local g = Duel.GetMatchingGroup(s.spcostfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	return g:CheckSubGroupEach(s.spchecks, aux.mzctcheck, tp)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spcostfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = g:SelectSubGroupEach(tp, s.spchecks, true, aux.mzctcheck, tp)
  	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 g = e:GetLabelObject()
  	Duel.Remove(g, POS_FACEUP, REASON_SPSUMMON)
  	g:DeleteGroup()
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, e:GetHandler())
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, g:GetCount(), 0, 0)
  	Duel.SetChainLimit(aux.FALSE)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE, aux.ExceptThisCard(e))
  	Duel.Remove(g, POS_FACEUP, REASON_EFFECT)
  end
  
  