name: Zoroa,
card_text: 1 Spellcaster Tuner + 1+ non-Tuner monsters
  If this card is Synchro Summoned: You can equip 1 "Magistus" monster from your Extra Deck to this card. Your opponent cannot activate the effects of monsters with the same card type (Fusion, Synchro, Xyz, or Link) as a "Magistus" Monster Card in your Spell & Trap Zone. If this card is in your GY: You can target 1 "Magistus" card you control; destroy it, and if you do, Special Summon this card. You can only use this effect of "Zoroa, the Magistus Conflagrant Calamity" once per turn.
external_ids: local SETCARD_ID_0 = 0x150 --Magistus
  
lua: local SETCARD_ID_0 = 0x150 --Magistus
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, aux.FilterBoolFunction(Card.IsRace, RACE_SPELLCASTER), aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCondition(s.eqcon)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  	--actlimit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, 1)
  	e2:SetValue(s.actlimit)
  	c:RegisterEffect(e2)
  	--spsummon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_DESTROY + CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetCountLimit(1, id)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
  end
  function s.eqfilter(c, ec)
  	return c:IsSetCard(SETCARD_ID_0) and not c:IsForbidden()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingMatchingCard(s.eqfilter, tp, LOCATION_EXTRA, 0, 1, nil, e:GetHandler())
  	end
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and c:IsFaceup() and c:IsRelateToEffect(e) and c:IsLocation(LOCATION_MZONE) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  		local g = Duel.SelectMatchingCard(tp, s.eqfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, c)
  		if g:GetCount() > 0 then
  			Duel.Equip(tp, g:GetFirst(), c)
  			local e1 = Effect.CreateEffect(c)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  			e1:SetCode(EFFECT_EQUIP_LIMIT)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e1:SetValue(s.eqlimit)
  			e1:SetLabelObject(c)
  			g:GetFirst():RegisterEffect(e1)
  		end
  	end
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  function s.cfilter(c, rtype)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:GetOriginalType() & rtype > 0
  end
  function s.actlimit(e, re, rp)
  	local tp = e:GetHandlerPlayer()
  	local rtype = bit.band(re:GetHandler():GetType(), TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK)
  	return re:IsActiveType(TYPE_MONSTER) and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_SZONE, 0, 1, nil, rtype)
  end
  function s.desfilter(c, tp)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and Duel.GetMZoneCount(tp, c) > 0
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(tp) and s.desfilter(chkc, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.desfilter, tp, LOCATION_ONFIELD, 0, 1, nil, tp) and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter, tp, LOCATION_ONFIELD, 0, 1, 1, nil, tp)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.Destroy(tc, REASON_EFFECT) ~= 0 then
  		local c = e:GetHandler()
  		if c:IsRelateToEffect(e) then
  			Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  end
  
  
source_text: Zoroa,
  1 Spellcaster Tuner + 1+ non-Tuner monsters
  If this card is Synchro Summoned: You can equip 1 "Magistus" monster from your Extra Deck to this card. Your opponent cannot activate the effects of monsters with the same card type (Fusion, Synchro, Xyz, or Link) as a "Magistus" Monster Card in your Spell & Trap Zone. If this card is in your GY: You can target 1 "Magistus" card you control; destroy it, and if you do, Special Summon this card. You can only use this effect of "Zoroa, the Magistus Conflagrant Calamity" once per turn.
target_text: -- Zoroa,
  local SETCARD_ID_0 = 0x150 --Magistus
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, aux.FilterBoolFunction(Card.IsRace, RACE_SPELLCASTER), aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCondition(s.eqcon)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  	--actlimit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, 1)
  	e2:SetValue(s.actlimit)
  	c:RegisterEffect(e2)
  	--spsummon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_DESTROY + CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetCountLimit(1, id)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
  end
  function s.eqfilter(c, ec)
  	return c:IsSetCard(SETCARD_ID_0) and not c:IsForbidden()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingMatchingCard(s.eqfilter, tp, LOCATION_EXTRA, 0, 1, nil, e:GetHandler())
  	end
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and c:IsFaceup() and c:IsRelateToEffect(e) and c:IsLocation(LOCATION_MZONE) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  		local g = Duel.SelectMatchingCard(tp, s.eqfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, c)
  		if g:GetCount() > 0 then
  			Duel.Equip(tp, g:GetFirst(), c)
  			local e1 = Effect.CreateEffect(c)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  			e1:SetCode(EFFECT_EQUIP_LIMIT)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e1:SetValue(s.eqlimit)
  			e1:SetLabelObject(c)
  			g:GetFirst():RegisterEffect(e1)
  		end
  	end
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  function s.cfilter(c, rtype)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:GetOriginalType() & rtype > 0
  end
  function s.actlimit(e, re, rp)
  	local tp = e:GetHandlerPlayer()
  	local rtype = bit.band(re:GetHandler():GetType(), TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK)
  	return re:IsActiveType(TYPE_MONSTER) and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_SZONE, 0, 1, nil, rtype)
  end
  function s.desfilter(c, tp)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and Duel.GetMZoneCount(tp, c) > 0
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(tp) and s.desfilter(chkc, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.desfilter, tp, LOCATION_ONFIELD, 0, 1, nil, tp) and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter, tp, LOCATION_ONFIELD, 0, 1, 1, nil, tp)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.Destroy(tc, REASON_EFFECT) ~= 0 then
  		local c = e:GetHandler()
  		if c:IsRelateToEffect(e) then
  			Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  end
  
  