PSY-Frame
If a "PSY-Frame" monster(s) is Special Summoned to your side of the field (except during the Damage Step), you can: Immediately after this effect resolves, Synchro Summon 1 Synchro Monster, using only "PSY-Frame" monsters you control. At the start of the Damage Step, if a "PSY-Frame" monster you control battles an opponent's monster: You can discard 1 "PSY-Frame" monster; your battling monster gains ATK equal to the discarded monster's ATK until the end of this turn.
local SETCARD_ID_0 = 0xc1 --PSY-Frame

local SETCARD_ID_0 = 0xc1 --PSY-Frame
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)
	--synchro summon
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
	e2:SetProperty(EFFECT_FLAG_DELAY)
	e2:SetRange(LOCATION_FZONE)
	e2:SetCountLimit(1, EFFECT_COUNT_CODE_CHAIN)
	e2:SetCondition(s.sccon)
	e2:SetTarget(s.sctg)
	e2:SetOperation(s.scop)
	c:RegisterEffect(e2)
	--atkup
	local e3 = Effect.CreateEffect(c)
	e3:SetDescription(aux.Stringid(id, 1))
	e3:SetCategory(CATEGORY_ATKCHANGE)
	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
	e3:SetCode(EVENT_BATTLE_START)
	e3:SetRange(LOCATION_FZONE)
	e3:SetCondition(s.atkcon)
	e3:SetCost(s.atkcost)
	e3:SetOperation(s.atkop)
	c:RegisterEffect(e3)
end
function s.scfilter(c, tp)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsControler(tp)
end
function s.sccon(e, tp, eg, ep, ev, re, r, rp)
	return eg:IsExists(s.scfilter, 1, nil, tp)
end
function s.sctg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		local mg = Duel.GetSynchroMaterial(tp):Filter(Card.IsSetCard, nil, 0xc1)
		return Duel.IsExistingMatchingCard(Card.IsSynchroSummonable, tp, LOCATION_EXTRA, 0, 1, nil, nil, mg)
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
end
function s.scop(e, tp, eg, ep, ev, re, r, rp)
	local mg = Duel.GetSynchroMaterial(tp):Filter(Card.IsSetCard, nil, 0xc1)
	local g = Duel.GetMatchingGroup(Card.IsSynchroSummonable, tp, LOCATION_EXTRA, 0, nil, nil, mg)
	if g:GetCount() > 0 then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
		local sg = g:Select(tp, 1, 1, nil)
		Duel.SynchroSummon(tp, sg:GetFirst(), nil, mg)
	end
end
function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetAttacker()
	if tc:IsControler(1 - tp) then
		tc = Duel.GetAttackTarget()
	end
	e:SetLabelObject(tc)
	return tc and tc:IsControler(tp) and tc:IsSetCard(SETCARD_ID_0) and tc:IsRelateToBattle() and Duel.GetAttackTarget() ~= nil
end
function s.atkfilter(c)
	return c:IsSetCard(SETCARD_ID_0) and c:GetAttack() > 0 and c:IsDiscardable()
end
function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.atkfilter, tp, LOCATION_HAND, 0, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISCARD)
	local g = Duel.SelectMatchingCard(tp, s.atkfilter, tp, LOCATION_HAND, 0, 1, 1, nil)
	e:SetLabel(g:GetFirst():GetAttack())
	Duel.SendtoGrave(g, REASON_COST + REASON_DISCARD)
end
function s.atkop(e, tp, eg, ep, ev, re, r, rp)
	local tc = e:GetLabelObject()
	if tc:IsRelateToBattle() and tc:IsFaceup() and tc:IsControler(tp) then
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_UPDATE_ATTACK)
		e1:SetValue(e:GetLabel())
		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		tc:RegisterEffect(e1)
	end
end


PSY-Frame
If a "PSY-Frame" monster(s) is Special Summoned to your side of the field (except during the Damage Step), you can: Immediately after this effect resolves, Synchro Summon 1 Synchro Monster, using only "PSY-Frame" monsters you control. At the start of the Damage Step, if a "PSY-Frame" monster you control battles an opponent's monster: You can discard 1 "PSY-Frame" monster; your battling monster gains ATK equal to the discarded monster's ATK until the end of this turn.
-- PSY-Frame
local SETCARD_ID_0 = 0xc1 --PSY-Frame
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)
	--synchro summon
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
	e2:SetProperty(EFFECT_FLAG_DELAY)
	e2:SetRange(LOCATION_FZONE)
	e2:SetCountLimit(1, EFFECT_COUNT_CODE_CHAIN)
	e2:SetCondition(s.sccon)
	e2:SetTarget(s.sctg)
	e2:SetOperation(s.scop)
	c:RegisterEffect(e2)
	--atkup
	local e3 = Effect.CreateEffect(c)
	e3:SetDescription(aux.Stringid(id, 1))
	e3:SetCategory(CATEGORY_ATKCHANGE)
	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
	e3:SetCode(EVENT_BATTLE_START)
	e3:SetRange(LOCATION_FZONE)
	e3:SetCondition(s.atkcon)
	e3:SetCost(s.atkcost)
	e3:SetOperation(s.atkop)
	c:RegisterEffect(e3)
end
function s.scfilter(c, tp)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsControler(tp)
end
function s.sccon(e, tp, eg, ep, ev, re, r, rp)
	return eg:IsExists(s.scfilter, 1, nil, tp)
end
function s.sctg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		local mg = Duel.GetSynchroMaterial(tp):Filter(Card.IsSetCard, nil, 0xc1)
		return Duel.IsExistingMatchingCard(Card.IsSynchroSummonable, tp, LOCATION_EXTRA, 0, 1, nil, nil, mg)
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
end
function s.scop(e, tp, eg, ep, ev, re, r, rp)
	local mg = Duel.GetSynchroMaterial(tp):Filter(Card.IsSetCard, nil, 0xc1)
	local g = Duel.GetMatchingGroup(Card.IsSynchroSummonable, tp, LOCATION_EXTRA, 0, nil, nil, mg)
	if g:GetCount() > 0 then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
		local sg = g:Select(tp, 1, 1, nil)
		Duel.SynchroSummon(tp, sg:GetFirst(), nil, mg)
	end
end
function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetAttacker()
	if tc:IsControler(1 - tp) then
		tc = Duel.GetAttackTarget()
	end
	e:SetLabelObject(tc)
	return tc and tc:IsControler(tp) and tc:IsSetCard(SETCARD_ID_0) and tc:IsRelateToBattle() and Duel.GetAttackTarget() ~= nil
end
function s.atkfilter(c)
	return c:IsSetCard(SETCARD_ID_0) and c:GetAttack() > 0 and c:IsDiscardable()
end
function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.atkfilter, tp, LOCATION_HAND, 0, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISCARD)
	local g = Duel.SelectMatchingCard(tp, s.atkfilter, tp, LOCATION_HAND, 0, 1, 1, nil)
	e:SetLabel(g:GetFirst():GetAttack())
	Duel.SendtoGrave(g, REASON_COST + REASON_DISCARD)
end
function s.atkop(e, tp, eg, ep, ev, re, r, rp)
	local tc = e:GetLabelObject()
	if tc:IsRelateToBattle() and tc:IsFaceup() and tc:IsControler(tp) then
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_UPDATE_ATTACK)
		e1:SetValue(e:GetLabel())
		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		tc:RegisterEffect(e1)
	end
end

