Naglfar,
You can only control 1 "Naglfar, Generaider Boss of Fire". If a card(s) you control would be destroyed by battle or card effect, you can destroy 1 "Generaider" monster or 1 Beast-Warrior monster you control instead. You can only use this effect of "Naglfar, Generaider Boss of Fire" once per turn.
local SETCARD_ID_0 = 0x134 --Generaider

local SETCARD_ID_0 = 0x134 --Generaider
local s, id, o = GetID()
function s.initial_effect(c)
	c:SetUniqueOnField(1, 0, id)
	--destroy replace
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e1:SetCode(EFFECT_DESTROY_REPLACE)
	e1:SetRange(LOCATION_MZONE)
	e1:SetCountLimit(1, id)
	e1:SetTarget(s.desreptg)
	e1:SetValue(s.desrepval)
	e1:SetOperation(s.desrepop)
	c:RegisterEffect(e1)
end
function s.repfilter(c, tp)
	return c:IsControler(tp) and c:IsOnField() and c:IsReason(REASON_BATTLE + REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
end
function s.desfilter(c, e, tp)
	return c:IsFaceup()
		and c:IsControler(tp)
		and c:IsLocation(LOCATION_MZONE)
		and (c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_BEASTWARRIOR))
		and c:IsDestructable(e)
		and not c:IsStatus(STATUS_DESTROY_CONFIRMED + STATUS_BATTLE_DESTROYED)
end
function s.desreptg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return eg:IsExists(s.repfilter, 1, nil, tp) and Duel.IsExistingMatchingCard(s.desfilter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
	end
	if Duel.SelectEffectYesNo(tp, e:GetHandler(), 96) then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESREPLACE)
		local g = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
		e:SetLabelObject(g:GetFirst())
		g:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED, true)
		return true
	end
	return false
end
function s.desrepval(e, c)
	return s.repfilter(c, e:GetHandlerPlayer())
end
function s.desrepop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_CARD, 0, id)
	local tc = e:GetLabelObject()
	tc:SetStatus(STATUS_DESTROY_CONFIRMED, false)
	Duel.Destroy(tc, REASON_EFFECT + REASON_REPLACE)
end


Naglfar,
You can only control 1 "Naglfar, Generaider Boss of Fire". If a card(s) you control would be destroyed by battle or card effect, you can destroy 1 "Generaider" monster or 1 Beast-Warrior monster you control instead. You can only use this effect of "Naglfar, Generaider Boss of Fire" once per turn.
-- Naglfar,
local SETCARD_ID_0 = 0x134 --Generaider
local s, id, o = GetID()
function s.initial_effect(c)
	c:SetUniqueOnField(1, 0, id)
	--destroy replace
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e1:SetCode(EFFECT_DESTROY_REPLACE)
	e1:SetRange(LOCATION_MZONE)
	e1:SetCountLimit(1, id)
	e1:SetTarget(s.desreptg)
	e1:SetValue(s.desrepval)
	e1:SetOperation(s.desrepop)
	c:RegisterEffect(e1)
end
function s.repfilter(c, tp)
	return c:IsControler(tp) and c:IsOnField() and c:IsReason(REASON_BATTLE + REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
end
function s.desfilter(c, e, tp)
	return c:IsFaceup()
		and c:IsControler(tp)
		and c:IsLocation(LOCATION_MZONE)
		and (c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_BEASTWARRIOR))
		and c:IsDestructable(e)
		and not c:IsStatus(STATUS_DESTROY_CONFIRMED + STATUS_BATTLE_DESTROYED)
end
function s.desreptg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return eg:IsExists(s.repfilter, 1, nil, tp) and Duel.IsExistingMatchingCard(s.desfilter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
	end
	if Duel.SelectEffectYesNo(tp, e:GetHandler(), 96) then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESREPLACE)
		local g = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
		e:SetLabelObject(g:GetFirst())
		g:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED, true)
		return true
	end
	return false
end
function s.desrepval(e, c)
	return s.repfilter(c, e:GetHandlerPlayer())
end
function s.desrepop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_CARD, 0, id)
	local tc = e:GetLabelObject()
	tc:SetStatus(STATUS_DESTROY_CONFIRMED, false)
	Duel.Destroy(tc, REASON_EFFECT + REASON_REPLACE)
end

