Odd-Eyes
Pendulum Scale = 1
[ Pendulum Effect ]
Once per turn, during the End Phase, if your opponent activated a card or effect this turn that targeted 1 "Odd-Eyes" Pendulum Monster you controlled (and no other cards) while this card was in your Pendulum Zone: Special Summon this card, and if you do, place 1 face-up "Odd-Eyes" Pendulum Monster from your Extra Deck in your Pendulum Zone, except "Odd-Eyes Persona Dragon".
----------------------------------------
[ Monster Effect ]
Once per turn (Quick Effect): You can target 1 face-up monster on the field that was Special Summoned from the Extra Deck; it has its effects negated, until the end of this turn.
local SETCARD_ID_0 = 0x99 --Odd-Eyes

local SETCARD_ID_0 = 0x99 --Odd-Eyes
local s, id, o = GetID()
function s.initial_effect(c)
	--pendulum summon
	aux.EnablePendulumAttribute(c)
	--spsummon reg
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e1:SetCode(EVENT_BECOME_TARGET)
	e1:SetRange(LOCATION_PZONE)
	e1:SetOperation(s.regop1)
	c:RegisterEffect(e1)
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e2:SetCode(EVENT_CHAIN_SOLVED)
	e2:SetRange(LOCATION_PZONE)
	e2:SetOperation(s.regop2)
	c:RegisterEffect(e2)
	--spsummon
	local e3 = Effect.CreateEffect(c)
	e3:SetDescription(aux.Stringid(id, 0))
	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
	e3:SetRange(LOCATION_PZONE)
	e3:SetCode(EVENT_PHASE + PHASE_END)
	e3:SetCountLimit(1)
	e3:SetCondition(s.spcon)
	e3:SetTarget(s.sptg)
	e3:SetOperation(s.spop)
	c:RegisterEffect(e3)
	--disable
	local e4 = Effect.CreateEffect(c)
	e4:SetDescription(aux.Stringid(id, 1))
	e4:SetCategory(CATEGORY_DISABLE)
	e4:SetType(EFFECT_TYPE_QUICK_O)
	e4:SetCode(EVENT_FREE_CHAIN)
	e4:SetRange(LOCATION_MZONE)
	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e4:SetCountLimit(1)
	e4:SetTarget(s.distg)
	e4:SetOperation(s.disop)
	c:RegisterEffect(e4)
end
function s.regfilter(c, tp)
	return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsType(TYPE_PENDULUM) and c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
end
function s.regop1(e, tp, eg, ep, ev, re, r, rp)
	if rp == 1 - tp and eg:GetCount() == 1 and eg:IsExists(s.regfilter, 1, nil, tp) then
		e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_CHAIN, 0, 1, ev)
	end
end
function s.regop2(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local chain_ct = { c:GetFlagEffectLabel(id) }
	for i = 1, #chain_ct do
		if chain_ct[i] == ev then
			c:RegisterFlagEffect(21250203, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
			return
		end
	end
end
function s.penfilter(c)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_PENDULUM) and not c:IsCode(id) and not c:IsForbidden()
end
function s.spcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():GetFlagEffect(21250203) ~= 0
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return true
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
end
function s.spop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	if not c:IsRelateToEffect(e) then
		return
	end
	if Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) ~= 0 then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
		local g = Duel.SelectMatchingCard(tp, s.penfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil)
		local tc = g:GetFirst()
		if tc then
			Duel.MoveToField(tc, tp, tp, LOCATION_PZONE, POS_FACEUP, true)
		end
	end
end
function s.disfilter(c)
	return aux.NegateMonsterFilter(c) and c:IsSummonLocation(LOCATION_EXTRA)
end
function s.distg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_MZONE) and s.disfilter(chkc)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.disfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISABLE)
	local g = Duel.SelectTarget(tp, s.disfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
	Duel.SetOperationInfo(0, CATEGORY_DISABLE, g, 1, 0, 0)
end
function s.disop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
		Duel.NegateRelatedChain(tc, RESET_TURN_SET)
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_DISABLE)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		tc:RegisterEffect(e1)
		local e2 = Effect.CreateEffect(e:GetHandler())
		e2:SetType(EFFECT_TYPE_SINGLE)
		e2:SetCode(EFFECT_DISABLE_EFFECT)
		e2:SetValue(RESET_TURN_SET)
		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		tc:RegisterEffect(e2)
	end
end


Odd-Eyes
Pendulum Scale = 1
[ Pendulum Effect ]
Once per turn, during the End Phase, if your opponent activated a card or effect this turn that targeted 1 "Odd-Eyes" Pendulum Monster you controlled (and no other cards) while this card was in your Pendulum Zone: Special Summon this card, and if you do, place 1 face-up "Odd-Eyes" Pendulum Monster from your Extra Deck in your Pendulum Zone, except "Odd-Eyes Persona Dragon".
----------------------------------------
[ Monster Effect ]
Once per turn (Quick Effect): You can target 1 face-up monster on the field that was Special Summoned from the Extra Deck; it has its effects negated, until the end of this turn.
-- Odd-Eyes
local SETCARD_ID_0 = 0x99 --Odd-Eyes
local s, id, o = GetID()
function s.initial_effect(c)
	--pendulum summon
	aux.EnablePendulumAttribute(c)
	--spsummon reg
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e1:SetCode(EVENT_BECOME_TARGET)
	e1:SetRange(LOCATION_PZONE)
	e1:SetOperation(s.regop1)
	c:RegisterEffect(e1)
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e2:SetCode(EVENT_CHAIN_SOLVED)
	e2:SetRange(LOCATION_PZONE)
	e2:SetOperation(s.regop2)
	c:RegisterEffect(e2)
	--spsummon
	local e3 = Effect.CreateEffect(c)
	e3:SetDescription(aux.Stringid(id, 0))
	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
	e3:SetRange(LOCATION_PZONE)
	e3:SetCode(EVENT_PHASE + PHASE_END)
	e3:SetCountLimit(1)
	e3:SetCondition(s.spcon)
	e3:SetTarget(s.sptg)
	e3:SetOperation(s.spop)
	c:RegisterEffect(e3)
	--disable
	local e4 = Effect.CreateEffect(c)
	e4:SetDescription(aux.Stringid(id, 1))
	e4:SetCategory(CATEGORY_DISABLE)
	e4:SetType(EFFECT_TYPE_QUICK_O)
	e4:SetCode(EVENT_FREE_CHAIN)
	e4:SetRange(LOCATION_MZONE)
	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e4:SetCountLimit(1)
	e4:SetTarget(s.distg)
	e4:SetOperation(s.disop)
	c:RegisterEffect(e4)
end
function s.regfilter(c, tp)
	return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsType(TYPE_PENDULUM) and c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
end
function s.regop1(e, tp, eg, ep, ev, re, r, rp)
	if rp == 1 - tp and eg:GetCount() == 1 and eg:IsExists(s.regfilter, 1, nil, tp) then
		e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_CHAIN, 0, 1, ev)
	end
end
function s.regop2(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local chain_ct = { c:GetFlagEffectLabel(id) }
	for i = 1, #chain_ct do
		if chain_ct[i] == ev then
			c:RegisterFlagEffect(21250203, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
			return
		end
	end
end
function s.penfilter(c)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_PENDULUM) and not c:IsCode(id) and not c:IsForbidden()
end
function s.spcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():GetFlagEffect(21250203) ~= 0
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return true
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
end
function s.spop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	if not c:IsRelateToEffect(e) then
		return
	end
	if Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) ~= 0 then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
		local g = Duel.SelectMatchingCard(tp, s.penfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil)
		local tc = g:GetFirst()
		if tc then
			Duel.MoveToField(tc, tp, tp, LOCATION_PZONE, POS_FACEUP, true)
		end
	end
end
function s.disfilter(c)
	return aux.NegateMonsterFilter(c) and c:IsSummonLocation(LOCATION_EXTRA)
end
function s.distg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_MZONE) and s.disfilter(chkc)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.disfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISABLE)
	local g = Duel.SelectTarget(tp, s.disfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
	Duel.SetOperationInfo(0, CATEGORY_DISABLE, g, 1, 0, 0)
end
function s.disop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
		Duel.NegateRelatedChain(tc, RESET_TURN_SET)
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_DISABLE)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		tc:RegisterEffect(e1)
		local e2 = Effect.CreateEffect(e:GetHandler())
		e2:SetType(EFFECT_TYPE_SINGLE)
		e2:SetCode(EFFECT_DISABLE_EFFECT)
		e2:SetValue(RESET_TURN_SET)
		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		tc:RegisterEffect(e2)
	end
end

