Shaddoll
Pendulum Scale = 7
[ Pendulum Effect ]
You cannot Pendulum Summon monsters, except "Shaddoll" and "Zefra" monsters. This effect cannot be negated.
----------------------------------------
[ Monster Effect ]
If this card is Pendulum Summoned or sent to the GY: You can target 1 "Zefra" card in your Pendulum Zone, except "Shaddoll Zefracore"; Special Summon it. You can only use this effect of "Shaddoll Zefracore" once per turn.
local SETCARD_ID_0 = 0x9d --Shaddoll
local SETCARD_ID_1 = 0xc4 --Zefra

local SETCARD_ID_0 = 0x9d --Shaddoll
local SETCARD_ID_1 = 0xc4 --Zefra
local s, id, o = GetID()
function s.initial_effect(c)
	--pendulum summon
	aux.EnablePendulumAttribute(c)
	--splimit
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_FIELD)
	e2:SetRange(LOCATION_PZONE)
	e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_CAN_FORBIDDEN)
	e2:SetTargetRange(1, 0)
	e2:SetTarget(s.splimit)
	c:RegisterEffect(e2)
	--spsummon
	local e3 = Effect.CreateEffect(c)
	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e3:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DELAY)
	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
	e3:SetCountLimit(1, id)
	e3:SetCondition(s.condition1)
	e3:SetTarget(s.target)
	e3:SetOperation(s.operation)
	c:RegisterEffect(e3)
	local e4 = e3:Clone()
	e4:SetCode(EVENT_TO_GRAVE)
	e4:SetCondition(aux.TRUE)
	c:RegisterEffect(e4)
end
function s.splimit(e, c, sump, sumtype, sumpos, targetp)
	if c:IsSetCard(SETCARD_ID_1, 0xc4) then
		return false
	end
	return bit.band(sumtype, SUMMON_TYPE_PENDULUM) == SUMMON_TYPE_PENDULUM
end
function s.condition1(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsSummonType(SUMMON_TYPE_PENDULUM)
end
function s.filter(c, e, tp)
	return c:IsSetCard(SETCARD_ID_1) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_PZONE) and chkc:IsControler(tp) and s.filter(chkc, e, tp)
	end
	if chk == 0 then
		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingTarget(s.filter, tp, LOCATION_PZONE, 0, 1, nil, e, tp)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_PZONE, 0, 1, 1, nil, e, tp)
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
end
function s.operation(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) then
		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
	end
end


Shaddoll
Pendulum Scale = 7
[ Pendulum Effect ]
You cannot Pendulum Summon monsters, except "Shaddoll" and "Zefra" monsters. This effect cannot be negated.
----------------------------------------
[ Monster Effect ]
If this card is Pendulum Summoned or sent to the GY: You can target 1 "Zefra" card in your Pendulum Zone, except "Shaddoll Zefracore"; Special Summon it. You can only use this effect of "Shaddoll Zefracore" once per turn.
-- Shaddoll
local SETCARD_ID_0 = 0x9d --Shaddoll
local SETCARD_ID_1 = 0xc4 --Zefra
local s, id, o = GetID()
function s.initial_effect(c)
	--pendulum summon
	aux.EnablePendulumAttribute(c)
	--splimit
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_FIELD)
	e2:SetRange(LOCATION_PZONE)
	e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_CAN_FORBIDDEN)
	e2:SetTargetRange(1, 0)
	e2:SetTarget(s.splimit)
	c:RegisterEffect(e2)
	--spsummon
	local e3 = Effect.CreateEffect(c)
	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e3:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DELAY)
	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
	e3:SetCountLimit(1, id)
	e3:SetCondition(s.condition1)
	e3:SetTarget(s.target)
	e3:SetOperation(s.operation)
	c:RegisterEffect(e3)
	local e4 = e3:Clone()
	e4:SetCode(EVENT_TO_GRAVE)
	e4:SetCondition(aux.TRUE)
	c:RegisterEffect(e4)
end
function s.splimit(e, c, sump, sumtype, sumpos, targetp)
	if c:IsSetCard(SETCARD_ID_1, 0xc4) then
		return false
	end
	return bit.band(sumtype, SUMMON_TYPE_PENDULUM) == SUMMON_TYPE_PENDULUM
end
function s.condition1(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsSummonType(SUMMON_TYPE_PENDULUM)
end
function s.filter(c, e, tp)
	return c:IsSetCard(SETCARD_ID_1) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_PZONE) and chkc:IsControler(tp) and s.filter(chkc, e, tp)
	end
	if chk == 0 then
		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingTarget(s.filter, tp, LOCATION_PZONE, 0, 1, nil, e, tp)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_PZONE, 0, 1, 1, nil, e, tp)
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
end
function s.operation(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) then
		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
	end
end

