Number
2 Level 4 monsters
While you control a face-up Spell, your opponent cannot target this card for attacks. Once per turn: You can detach 1 material from this card; this turn, this card can attack your opponent directly, but other monsters cannot attack.
local s, id, o = GetID()
function s.initial_effect(c)
	--xyz summon
	aux.AddXyzProcedure(c, nil, 4, 2)
	c:EnableReviveLimit()
	--cannot be battle target
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e1:SetRange(LOCATION_MZONE)
	e1:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
	e1:SetCondition(s.atkcon)
	e1:SetValue(aux.imval1)
	c:RegisterEffect(e1)
	--direct
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetCountLimit(1)
	e2:SetRange(LOCATION_MZONE)
	e2:SetCondition(s.condition)
	e2:SetCost(s.cost)
	e2:SetOperation(s.operation)
	c:RegisterEffect(e2)
end
aux.xyz_number[id] = 82
function s.filter(c)
	return c:IsFaceup() and c:IsType(TYPE_SPELL)
end
function s.atkcon(e)
	return Duel.IsExistingMatchingCard(s.filter, e:GetHandlerPlayer(), LOCATION_ONFIELD, 0, 1, nil)
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	return Duel.IsAbleToEnterBP() and not e:GetHandler():IsHasEffect(EFFECT_DIRECT_ATTACK)
end
function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
	end
	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
end
function s.ftarget(e, c)
	return e:GetLabel() ~= c:GetFieldID()
end
function s.operation(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local fid = 0
	if c:IsRelateToEffect(e) then
		fid = c:GetFieldID()
	end
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetCode(EFFECT_CANNOT_ATTACK)
	e1:SetProperty(EFFECT_FLAG_OATH)
	e1:SetTargetRange(LOCATION_MZONE, 0)
	e1:SetTarget(s.ftarget)
	e1:SetLabel(fid)
	e1:SetReset(RESET_PHASE + PHASE_END)
	Duel.RegisterEffect(e1, tp)
	if c:IsFaceup() and c:IsRelateToEffect(e) then
		local e2 = Effect.CreateEffect(c)
		e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
		e2:SetType(EFFECT_TYPE_SINGLE)
		e2:SetCode(EFFECT_DIRECT_ATTACK)
		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		c:RegisterEffect(e2)
	end
end


Number
2 Level 4 monsters
While you control a face-up Spell, your opponent cannot target this card for attacks. Once per turn: You can detach 1 material from this card; this turn, this card can attack your opponent directly, but other monsters cannot attack.
-- Number
local s, id, o = GetID()
function s.initial_effect(c)
	--xyz summon
	aux.AddXyzProcedure(c, nil, 4, 2)
	c:EnableReviveLimit()
	--cannot be battle target
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e1:SetRange(LOCATION_MZONE)
	e1:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
	e1:SetCondition(s.atkcon)
	e1:SetValue(aux.imval1)
	c:RegisterEffect(e1)
	--direct
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetCountLimit(1)
	e2:SetRange(LOCATION_MZONE)
	e2:SetCondition(s.condition)
	e2:SetCost(s.cost)
	e2:SetOperation(s.operation)
	c:RegisterEffect(e2)
end
aux.xyz_number[id] = 82
function s.filter(c)
	return c:IsFaceup() and c:IsType(TYPE_SPELL)
end
function s.atkcon(e)
	return Duel.IsExistingMatchingCard(s.filter, e:GetHandlerPlayer(), LOCATION_ONFIELD, 0, 1, nil)
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	return Duel.IsAbleToEnterBP() and not e:GetHandler():IsHasEffect(EFFECT_DIRECT_ATTACK)
end
function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
	end
	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
end
function s.ftarget(e, c)
	return e:GetLabel() ~= c:GetFieldID()
end
function s.operation(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local fid = 0
	if c:IsRelateToEffect(e) then
		fid = c:GetFieldID()
	end
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetCode(EFFECT_CANNOT_ATTACK)
	e1:SetProperty(EFFECT_FLAG_OATH)
	e1:SetTargetRange(LOCATION_MZONE, 0)
	e1:SetTarget(s.ftarget)
	e1:SetLabel(fid)
	e1:SetReset(RESET_PHASE + PHASE_END)
	Duel.RegisterEffect(e1, tp)
	if c:IsFaceup() and c:IsRelateToEffect(e) then
		local e2 = Effect.CreateEffect(c)
		e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
		e2:SetType(EFFECT_TYPE_SINGLE)
		e2:SetCode(EFFECT_DIRECT_ATTACK)
		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		c:RegisterEffect(e2)
	end
end

