name: Mazera
card_text: This card cannot be Normal Summoned or Set. This card cannot be Special Summoned except by Tributing 1 face-up "Warrior of Zera" on your side of the field while "Pandemonium" is on the field. If "Pandemonium" is on your side of the field when you Special Summon this card, your opponent discards 3 random cards from their hand. If "Pandemonium" is not on your side of the field, this effect is not applied.
external_ids: local CARD_ID_0 = 66073051 --Warrior of Zera
  local CARD_ID_1 = 94585852 --Pandemonium
  
lua: local CARD_ID_0 = 66073051 --Warrior of Zera
  local CARD_ID_1 = 94585852 --Pandemonium
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0, CARD_ID_1)
  	c:EnableReviveLimit()
  	--cannot special summon
  	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)
  	--handes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_HANDES)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e3:SetTarget(s.hdtg)
  	e3:SetOperation(s.hdop)
  	c:RegisterEffect(e3)
  end
  function s.rfilter(c, tp)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0) and Duel.GetMZoneCount(tp, c) > 0
  end
  function s.spcon(e, c)
  	if c == nil then
  		return Duel.IsEnvironment(CARD_ID_1)
  	end
  	return Duel.CheckReleaseGroupEx(c:GetControler(), s.rfilter, 1, REASON_SPSUMMON, false, nil, c:GetControler())
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetReleaseGroup(tp, false, REASON_SPSUMMON):Filter(s.rfilter, nil, tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local tc = g:SelectUnselect(nil, tp, false, true, 1, 1)
  	if tc then
  		e:SetLabelObject(tc)
  		return true
  	else
  		return false
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = e:GetLabelObject()
  	Duel.Release(g, REASON_SPSUMMON)
  end
  function s.hdtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, 1 - tp, 3)
  end
  function s.hdop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsEnvironment(CARD_ID_1, tp) then
  		local g = Duel.GetFieldGroup(tp, 0, LOCATION_HAND):RandomSelect(tp, 3)
  		Duel.SendtoGrave(g, REASON_EFFECT + REASON_DISCARD)
  	end
  end
  
  
source_text: Mazera
  This card cannot be Normal Summoned or Set. This card cannot be Special Summoned except by Tributing 1 face-up "Warrior of Zera" on your side of the field while "Pandemonium" is on the field. If "Pandemonium" is on your side of the field when you Special Summon this card, your opponent discards 3 random cards from their hand. If "Pandemonium" is not on your side of the field, this effect is not applied.
target_text: -- Mazera
  local CARD_ID_0 = 66073051 --Warrior of Zera
  local CARD_ID_1 = 94585852 --Pandemonium
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0, CARD_ID_1)
  	c:EnableReviveLimit()
  	--cannot special summon
  	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)
  	--handes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_HANDES)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e3:SetTarget(s.hdtg)
  	e3:SetOperation(s.hdop)
  	c:RegisterEffect(e3)
  end
  function s.rfilter(c, tp)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0) and Duel.GetMZoneCount(tp, c) > 0
  end
  function s.spcon(e, c)
  	if c == nil then
  		return Duel.IsEnvironment(CARD_ID_1)
  	end
  	return Duel.CheckReleaseGroupEx(c:GetControler(), s.rfilter, 1, REASON_SPSUMMON, false, nil, c:GetControler())
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetReleaseGroup(tp, false, REASON_SPSUMMON):Filter(s.rfilter, nil, tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local tc = g:SelectUnselect(nil, tp, false, true, 1, 1)
  	if tc then
  		e:SetLabelObject(tc)
  		return true
  	else
  		return false
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = e:GetLabelObject()
  	Duel.Release(g, REASON_SPSUMMON)
  end
  function s.hdtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, 1 - tp, 3)
  end
  function s.hdop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsEnvironment(CARD_ID_1, tp) then
  		local g = Duel.GetFieldGroup(tp, 0, LOCATION_HAND):RandomSelect(tp, 3)
  		Duel.SendtoGrave(g, REASON_EFFECT + REASON_DISCARD)
  	end
  end
  
  