Malefic
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by banishing 1 "Cyber End Dragon" from your Extra Deck. There can only be 1 "Malefic" monster on the field. Other monsters you control cannot declare an attack. If there is no face-up Field Spell on the field, destroy this card.
local CARD_ID_0 = 1546123 --Cyber End Dragon
local CARD_ID_1 = 48829461 --Malefic Paradox Gear
local CARD_ID_2 = 75223115 --Malefic Territory
local SETCARD_ID_0 = 0x23 --Malefic

local CARD_ID_0 = 1546123 --Cyber End Dragon
local CARD_ID_1 = 48829461 --Malefic Paradox Gear
local CARD_ID_2 = 75223115 --Malefic Territory
local SETCARD_ID_0 = 0x23 --Malefic
local s, id, o = GetID()
function s.initial_effect(c)
	c:EnableReviveLimit()
	c:SetUniqueOnField(1, 1, s.uqfilter, LOCATION_MZONE)
	--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)
	--selfdes
	local e7 = Effect.CreateEffect(c)
	e7:SetType(EFFECT_TYPE_SINGLE)
	e7:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e7:SetRange(LOCATION_MZONE)
	e7:SetCode(EFFECT_SELF_DESTROY)
	e7:SetCondition(s.descon)
	c:RegisterEffect(e7)
	--cannot announce
	local e8 = Effect.CreateEffect(c)
	e8:SetType(EFFECT_TYPE_FIELD)
	e8:SetRange(LOCATION_MZONE)
	e8:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
	e8:SetTargetRange(LOCATION_MZONE, 0)
	e8:SetTarget(s.antarget)
	c:RegisterEffect(e8)
	--spson
	local e9 = Effect.CreateEffect(c)
	e9:SetType(EFFECT_TYPE_SINGLE)
	e9:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
	e9:SetCode(EFFECT_SPSUMMON_CONDITION)
	e9:SetValue(aux.FALSE)
	c:RegisterEffect(e9)
end
function s.uqfilter(c)
	if Duel.IsPlayerAffectedByEffect(c:GetControler(), CARD_ID_2) then
		return c:IsCode(id)
	else
		return c:IsSetCard(SETCARD_ID_0)
	end
end
function s.spfilter(c)
	return c:IsCode(CARD_ID_0) and c:IsAbleToRemoveAsCost()
end
function s.spfilter2(c, tp)
	return c:IsHasEffect(CARD_ID_1, tp) and c:IsAbleToRemoveAsCost() and Duel.GetMZoneCount(tp, c) > 0
end
function s.spcon(e, c)
	if c == nil then
		return true
	end
	local tp = c:GetControler()
	local b1 = Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_EXTRA, 0, 1, nil)
	local b2 = Duel.IsExistingMatchingCard(s.spfilter2, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, 1, nil, tp)
	return b1 or b2
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
	local g = Group.CreateGroup()
	if Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
		local g1 = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_EXTRA, 0, nil)
		g:Merge(g1)
	end
	local g2 = Duel.GetMatchingGroup(s.spfilter2, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, nil, tp)
	g:Merge(g2)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
	local tc = g:SelectUnselect(nil, tp, false, true, 1, 1)
	if tc then
		e:SetLabelObject(tc)
		if g2:IsContains(tc) then
			local te = tc:IsHasEffect(CARD_ID_1, tp)
			te:UseCountLimit(tp)
		end
		return true
	else
		return false
	end
end
function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
	local tc = e:GetLabelObject()
	Duel.Remove(tc, POS_FACEUP, REASON_SPSUMMON)
end
function s.descon(e)
	return not Duel.IsExistingMatchingCard(Card.IsFaceup, 0, LOCATION_FZONE, LOCATION_FZONE, 1, nil)
end
function s.antarget(e, c)
	return c ~= e:GetHandler()
end


Malefic
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by banishing 1 "Cyber End Dragon" from your Extra Deck. There can only be 1 "Malefic" monster on the field. Other monsters you control cannot declare an attack. If there is no face-up Field Spell on the field, destroy this card.
-- Malefic
local CARD_ID_0 = 1546123 --Cyber End Dragon
local CARD_ID_1 = 48829461 --Malefic Paradox Gear
local CARD_ID_2 = 75223115 --Malefic Territory
local SETCARD_ID_0 = 0x23 --Malefic
local s, id, o = GetID()
function s.initial_effect(c)
	c:EnableReviveLimit()
	c:SetUniqueOnField(1, 1, s.uqfilter, LOCATION_MZONE)
	--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)
	--selfdes
	local e7 = Effect.CreateEffect(c)
	e7:SetType(EFFECT_TYPE_SINGLE)
	e7:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e7:SetRange(LOCATION_MZONE)
	e7:SetCode(EFFECT_SELF_DESTROY)
	e7:SetCondition(s.descon)
	c:RegisterEffect(e7)
	--cannot announce
	local e8 = Effect.CreateEffect(c)
	e8:SetType(EFFECT_TYPE_FIELD)
	e8:SetRange(LOCATION_MZONE)
	e8:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
	e8:SetTargetRange(LOCATION_MZONE, 0)
	e8:SetTarget(s.antarget)
	c:RegisterEffect(e8)
	--spson
	local e9 = Effect.CreateEffect(c)
	e9:SetType(EFFECT_TYPE_SINGLE)
	e9:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
	e9:SetCode(EFFECT_SPSUMMON_CONDITION)
	e9:SetValue(aux.FALSE)
	c:RegisterEffect(e9)
end
function s.uqfilter(c)
	if Duel.IsPlayerAffectedByEffect(c:GetControler(), CARD_ID_2) then
		return c:IsCode(id)
	else
		return c:IsSetCard(SETCARD_ID_0)
	end
end
function s.spfilter(c)
	return c:IsCode(CARD_ID_0) and c:IsAbleToRemoveAsCost()
end
function s.spfilter2(c, tp)
	return c:IsHasEffect(CARD_ID_1, tp) and c:IsAbleToRemoveAsCost() and Duel.GetMZoneCount(tp, c) > 0
end
function s.spcon(e, c)
	if c == nil then
		return true
	end
	local tp = c:GetControler()
	local b1 = Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_EXTRA, 0, 1, nil)
	local b2 = Duel.IsExistingMatchingCard(s.spfilter2, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, 1, nil, tp)
	return b1 or b2
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
	local g = Group.CreateGroup()
	if Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
		local g1 = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_EXTRA, 0, nil)
		g:Merge(g1)
	end
	local g2 = Duel.GetMatchingGroup(s.spfilter2, tp, LOCATION_MZONE + LOCATION_GRAVE, 0, nil, tp)
	g:Merge(g2)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
	local tc = g:SelectUnselect(nil, tp, false, true, 1, 1)
	if tc then
		e:SetLabelObject(tc)
		if g2:IsContains(tc) then
			local te = tc:IsHasEffect(CARD_ID_1, tp)
			te:UseCountLimit(tp)
		end
		return true
	else
		return false
	end
end
function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
	local tc = e:GetLabelObject()
	Duel.Remove(tc, POS_FACEUP, REASON_SPSUMMON)
end
function s.descon(e)
	return not Duel.IsExistingMatchingCard(Card.IsFaceup, 0, LOCATION_FZONE, LOCATION_FZONE, 1, nil)
end
function s.antarget(e, c)
	return c ~= e:GetHandler()
end

