Orcustrated
Once per turn: You can banish 1 monster from your field or GY, then target 1 "Orcust" or "World Legacy" card you control, except "Orcustrated Core"; neither player can target it with card effects this turn (even if this card leaves the field). If other "Orcust" and/or "World Legacy" card(s) you control would be destroyed by battle or card effect, you can send this card to the GY instead.
local SETCARD_ID_0 = 0xfe --World

local SETCARD_ID_0 = 0xfe --World
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	c:RegisterEffect(e1)
	--cannot be target
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetType(EFFECT_TYPE_QUICK_O)
	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e2:SetRange(LOCATION_SZONE)
	e2:SetCode(EVENT_FREE_CHAIN)
	e2:SetCountLimit(1)
	e2:SetCost(s.tgcost)
	e2:SetTarget(s.tgtg)
	e2:SetOperation(s.tgop)
	c:RegisterEffect(e2)
	--replace
	local e3 = Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e3:SetCode(EFFECT_DESTROY_REPLACE)
	e3:SetRange(LOCATION_SZONE)
	e3:SetTarget(s.reptg)
	e3:SetValue(s.repval)
	e3:SetOperation(s.repop)
	c:RegisterEffect(e3)
end
function s.costfilter(c, tp)
	return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost() and Duel.IsExistingTarget(s.tgfilter, tp, LOCATION_ONFIELD, 0, 1, c)
end
function s.tgfilter(c)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0, 0x11b) and not c:IsCode(id)
end
function s.tgcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_GRAVE + LOCATION_MZONE, 0, 1, nil, tp)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
	local cg = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_GRAVE + LOCATION_MZONE, 0, 1, 1, nil, tp)
	Duel.Remove(cg, POS_FACEUP, REASON_COST)
end
function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsOnField() and chkc:IsControler(tp) and s.tgfilter(chkc)
	end
	if chk == 0 then
		return true
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
	Duel.SelectTarget(tp, s.tgfilter, tp, LOCATION_ONFIELD, 0, 1, 1, nil)
end
function s.tgop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
		e1:SetValue(1)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		tc:RegisterEffect(e1)
	end
end
function s.repfilter(c, tp)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0, 0x11b) and c:IsControler(tp) and c:IsOnField() and c:IsReason(REASON_BATTLE + REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
end
function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return not e:GetHandler():IsStatus(STATUS_DESTROY_CONFIRMED) and eg:IsExists(s.repfilter, 1, e:GetHandler(), tp)
	end
	return Duel.SelectEffectYesNo(tp, e:GetHandler(), 96)
end
function s.repval(e, c)
	return s.repfilter(c, e:GetHandlerPlayer())
end
function s.repop(e, tp, eg, ep, ev, re, r, rp)
	Duel.SendtoGrave(e:GetHandler(), REASON_EFFECT)
end


Orcustrated
Once per turn: You can banish 1 monster from your field or GY, then target 1 "Orcust" or "World Legacy" card you control, except "Orcustrated Core"; neither player can target it with card effects this turn (even if this card leaves the field). If other "Orcust" and/or "World Legacy" card(s) you control would be destroyed by battle or card effect, you can send this card to the GY instead.
-- Orcustrated
local SETCARD_ID_0 = 0xfe --World
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	c:RegisterEffect(e1)
	--cannot be target
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetType(EFFECT_TYPE_QUICK_O)
	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e2:SetRange(LOCATION_SZONE)
	e2:SetCode(EVENT_FREE_CHAIN)
	e2:SetCountLimit(1)
	e2:SetCost(s.tgcost)
	e2:SetTarget(s.tgtg)
	e2:SetOperation(s.tgop)
	c:RegisterEffect(e2)
	--replace
	local e3 = Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e3:SetCode(EFFECT_DESTROY_REPLACE)
	e3:SetRange(LOCATION_SZONE)
	e3:SetTarget(s.reptg)
	e3:SetValue(s.repval)
	e3:SetOperation(s.repop)
	c:RegisterEffect(e3)
end
function s.costfilter(c, tp)
	return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost() and Duel.IsExistingTarget(s.tgfilter, tp, LOCATION_ONFIELD, 0, 1, c)
end
function s.tgfilter(c)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0, 0x11b) and not c:IsCode(id)
end
function s.tgcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_GRAVE + LOCATION_MZONE, 0, 1, nil, tp)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
	local cg = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_GRAVE + LOCATION_MZONE, 0, 1, 1, nil, tp)
	Duel.Remove(cg, POS_FACEUP, REASON_COST)
end
function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsOnField() and chkc:IsControler(tp) and s.tgfilter(chkc)
	end
	if chk == 0 then
		return true
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
	Duel.SelectTarget(tp, s.tgfilter, tp, LOCATION_ONFIELD, 0, 1, 1, nil)
end
function s.tgop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
		e1:SetValue(1)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		tc:RegisterEffect(e1)
	end
end
function s.repfilter(c, tp)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0, 0x11b) and c:IsControler(tp) and c:IsOnField() and c:IsReason(REASON_BATTLE + REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
end
function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return not e:GetHandler():IsStatus(STATUS_DESTROY_CONFIRMED) and eg:IsExists(s.repfilter, 1, e:GetHandler(), tp)
	end
	return Duel.SelectEffectYesNo(tp, e:GetHandler(), 96)
end
function s.repval(e, c)
	return s.repfilter(c, e:GetHandlerPlayer())
end
function s.repop(e, tp, eg, ep, ev, re, r, rp)
	Duel.SendtoGrave(e:GetHandler(), REASON_EFFECT)
end

