Hojo
Pendulum Scale = 1
[ Pendulum Effect ]
If "Vaylantz World - Shinra Bansho" is in a Field Zone or if you control a WATER "Vaylantz" monster: You can Special Summon this card to your Main Monster Zone in its same column. You can only use this effect of "Hojo the Vaylantz Warrior" once per turn.
----------------------------------------
[ Monster Effect ]
You can target 1 face-up card in either Spell & Trap Zone; return it to the hand. If this card in the Monster Zone moves to another Monster Zone (except during the Damage Step): You can Fusion Summon 1 "Vaylantz" Fusion Monster from your Extra Deck, using monsters from your hand, field, and/or Pendulum Zones. You can only use each effect of "Hojo the Vaylantz Warrior" once per turn.
local CARD_ID_0 = 49568943 --Vaylantz World - Shinra Bansho
local SETCARD_ID_0 = 0x17d --Vaylantz

local CARD_ID_0 = 49568943 --Vaylantz World - Shinra Bansho
local SETCARD_ID_0 = 0x17d --Vaylantz
local s, id, o = GetID()
function s.initial_effect(c)
	aux.AddCodeList(c, CARD_ID_0)
	--pendulum summon
	aux.EnablePendulumAttribute(c)
	--spsummon
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_IGNITION)
	e1:SetRange(LOCATION_PZONE)
	e1:SetCountLimit(1, id)
	e1:SetCondition(s.spcon)
	e1:SetTarget(s.sptg)
	e1:SetOperation(s.spop)
	c:RegisterEffect(e1)
	--to hand
	local e2 = Effect.CreateEffect(c)
	e2:SetCategory(CATEGORY_TOHAND)
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetRange(LOCATION_MZONE)
	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e2:SetCountLimit(1, id + o)
	e2:SetTarget(s.thtg)
	e2:SetOperation(s.thop)
	c:RegisterEffect(e2)
	-- fusion sumon
	local e3 = FusionSpell.CreateSummonEffect(c, {
		fusfilter = s.fusfilter,
		pre_select_mat_location = LOCATION_HAND | LOCATION_MZONE | LOCATION_PZONE,
	})
	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e3:SetCode(EVENT_MOVE)
	e3:SetRange(LOCATION_MZONE)
	e3:SetProperty(EFFECT_FLAG_DELAY)
	e3:SetCountLimit(1, id + o * 2)
	e3:SetCondition(s.mvcon)
	c:RegisterEffect(e3)
end

function s.cfilter(c)
	return c:IsSetCard(SETCARD_ID_0) and c:IsAttribute(ATTRIBUTE_WATER) and c:IsFaceup()
end

function s.spcon(e, tp, eg, ep, ev, re, r, rp)
	return Duel.IsEnvironment(CARD_ID_0) or Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
end

function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
	local c = e:GetHandler()
	local zone = 1 << c:GetSequence()
	if chk == 0 then
		return c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP, tp, zone)
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
end

function s.spop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local zone = 1 << c:GetSequence()
	if c:IsRelateToEffect(e) then
		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP, zone)
	end
end

function s.thfilter(c)
	return c:GetSequence() < 5 and c:IsFaceup() and c:IsAbleToHand()
end

function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_SZONE) and s.thfilter(chkc)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.thfilter, tp, LOCATION_SZONE, LOCATION_SZONE, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
	local g = Duel.SelectTarget(tp, s.thfilter, tp, LOCATION_SZONE, LOCATION_SZONE, 1, 1, nil)
	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
end

function s.thop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) then
		Duel.SendtoHand(tc, nil, REASON_EFFECT)
	end
end

function s.mvcon(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local ph = Duel.GetCurrentPhase()
	return c:IsPreviousLocation(LOCATION_MZONE)
		and c:IsLocation(LOCATION_MZONE)
		and (c:GetPreviousSequence() ~= c:GetSequence() or c:GetPreviousControler() ~= tp)
		and ph ~= PHASE_DAMAGE
		and ph ~= PHASE_DAMAGE_CAL
end

function s.fusfilter(c)
	return c:IsSetCard(SETCARD_ID_0)
end


Hojo
Pendulum Scale = 1
[ Pendulum Effect ]
If "Vaylantz World - Shinra Bansho" is in a Field Zone or if you control a WATER "Vaylantz" monster: You can Special Summon this card to your Main Monster Zone in its same column. You can only use this effect of "Hojo the Vaylantz Warrior" once per turn.
----------------------------------------
[ Monster Effect ]
You can target 1 face-up card in either Spell & Trap Zone; return it to the hand. If this card in the Monster Zone moves to another Monster Zone (except during the Damage Step): You can Fusion Summon 1 "Vaylantz" Fusion Monster from your Extra Deck, using monsters from your hand, field, and/or Pendulum Zones. You can only use each effect of "Hojo the Vaylantz Warrior" once per turn.
-- Hojo
local CARD_ID_0 = 49568943 --Vaylantz World - Shinra Bansho
local SETCARD_ID_0 = 0x17d --Vaylantz
local s, id, o = GetID()
function s.initial_effect(c)
	aux.AddCodeList(c, CARD_ID_0)
	--pendulum summon
	aux.EnablePendulumAttribute(c)
	--spsummon
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_IGNITION)
	e1:SetRange(LOCATION_PZONE)
	e1:SetCountLimit(1, id)
	e1:SetCondition(s.spcon)
	e1:SetTarget(s.sptg)
	e1:SetOperation(s.spop)
	c:RegisterEffect(e1)
	--to hand
	local e2 = Effect.CreateEffect(c)
	e2:SetCategory(CATEGORY_TOHAND)
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetRange(LOCATION_MZONE)
	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e2:SetCountLimit(1, id + o)
	e2:SetTarget(s.thtg)
	e2:SetOperation(s.thop)
	c:RegisterEffect(e2)
	-- fusion sumon
	local e3 = FusionSpell.CreateSummonEffect(c, {
		fusfilter = s.fusfilter,
		pre_select_mat_location = LOCATION_HAND | LOCATION_MZONE | LOCATION_PZONE,
	})
	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e3:SetCode(EVENT_MOVE)
	e3:SetRange(LOCATION_MZONE)
	e3:SetProperty(EFFECT_FLAG_DELAY)
	e3:SetCountLimit(1, id + o * 2)
	e3:SetCondition(s.mvcon)
	c:RegisterEffect(e3)
end

function s.cfilter(c)
	return c:IsSetCard(SETCARD_ID_0) and c:IsAttribute(ATTRIBUTE_WATER) and c:IsFaceup()
end

function s.spcon(e, tp, eg, ep, ev, re, r, rp)
	return Duel.IsEnvironment(CARD_ID_0) or Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
end

function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
	local c = e:GetHandler()
	local zone = 1 << c:GetSequence()
	if chk == 0 then
		return c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP, tp, zone)
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
end

function s.spop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local zone = 1 << c:GetSequence()
	if c:IsRelateToEffect(e) then
		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP, zone)
	end
end

function s.thfilter(c)
	return c:GetSequence() < 5 and c:IsFaceup() and c:IsAbleToHand()
end

function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_SZONE) and s.thfilter(chkc)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.thfilter, tp, LOCATION_SZONE, LOCATION_SZONE, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
	local g = Duel.SelectTarget(tp, s.thfilter, tp, LOCATION_SZONE, LOCATION_SZONE, 1, 1, nil)
	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
end

function s.thop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) then
		Duel.SendtoHand(tc, nil, REASON_EFFECT)
	end
end

function s.mvcon(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local ph = Duel.GetCurrentPhase()
	return c:IsPreviousLocation(LOCATION_MZONE)
		and c:IsLocation(LOCATION_MZONE)
		and (c:GetPreviousSequence() ~= c:GetSequence() or c:GetPreviousControler() ~= tp)
		and ph ~= PHASE_DAMAGE
		and ph ~= PHASE_DAMAGE_CAL
end

function s.fusfilter(c)
	return c:IsSetCard(SETCARD_ID_0)
end

