name: Vaylantz
card_text: Pendulum Scale = 1
  [ Pendulum Effect ]
  During your Main Phase: You can Special Summon this card to your Main Monster Zone in its same column, also you cannot Special Summon non-"Vaylantz" monsters for the rest of this turn, except from the Extra Deck. You can only use this effect of "Vaylantz Voltage Viscount" once per turn.
  ----------------------------------------
  [ Monster Effect ]
  During your Main Phase, if you control this Special Summoned card: You can place 1 face-up "Vaylantz" Pendulum Monster from your Extra Deck, face-up in your Spell & Trap Zone as a Continuous Spell. If this card in the Monster Zone moves to another Monster Zone: You can place 1 face-up "Vaylantz" Pendulum Monster from your Extra Deck in your Pendulum Zone. You can only use each effect of "Vaylantz Voltage Viscount" once per turn.
external_ids: local SETCARD_ID_0 = 0x17d --Vaylantz
  
lua: local SETCARD_ID_0 = 0x17d --Vaylantz
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--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:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--set
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.stcon)
  	e2:SetTarget(s.sttg)
  	e2:SetOperation(s.stop)
  	c:RegisterEffect(e2)
  	--pzone set
  	local e3 = Effect.CreateEffect(c)
  	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 + 2)
  	e3:SetCondition(s.mvcon)
  	e3:SetTarget(s.mvtg)
  	e3:SetOperation(s.mvop)
  	c:RegisterEffect(e3)
  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
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c)
  	return not c:IsSetCard(SETCARD_ID_0) and not c:IsLocation(LOCATION_EXTRA)
  end
  function s.stcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL)
  end
  function s.stfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_PENDULUM) and c:IsFaceup() and not c:IsForbidden()
  end
  function s.sttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingMatchingCard(s.stfilter, tp, LOCATION_EXTRA, 0, 1, nil)
  	end
  end
  function s.stop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local g = Duel.SelectMatchingCard(tp, s.stfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc then
  		Duel.MoveToField(tc, tp, tp, LOCATION_SZONE, POS_FACEUP, true)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetCode(EFFECT_CHANGE_TYPE)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET)
  		e1:SetValue(TYPE_SPELL + TYPE_CONTINUOUS)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.mvcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousLocation(LOCATION_MZONE) and c:IsLocation(LOCATION_MZONE) and (c:GetPreviousSequence() ~= c:GetSequence() or c:GetPreviousControler() ~= tp)
  end
  function s.mvtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return (Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)) and Duel.IsExistingMatchingCard(s.stfilter, tp, LOCATION_EXTRA, 0, 1, nil)
  	end
  end
  function s.mvop(e, tp, eg, ep, ev, re, r, rp)
  	if not (Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)) then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local g = Duel.SelectMatchingCard(tp, s.stfilter, 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
  
  
source_text: Vaylantz
  Pendulum Scale = 1
  [ Pendulum Effect ]
  During your Main Phase: You can Special Summon this card to your Main Monster Zone in its same column, also you cannot Special Summon non-"Vaylantz" monsters for the rest of this turn, except from the Extra Deck. You can only use this effect of "Vaylantz Voltage Viscount" once per turn.
  ----------------------------------------
  [ Monster Effect ]
  During your Main Phase, if you control this Special Summoned card: You can place 1 face-up "Vaylantz" Pendulum Monster from your Extra Deck, face-up in your Spell & Trap Zone as a Continuous Spell. If this card in the Monster Zone moves to another Monster Zone: You can place 1 face-up "Vaylantz" Pendulum Monster from your Extra Deck in your Pendulum Zone. You can only use each effect of "Vaylantz Voltage Viscount" once per turn.
target_text: -- Vaylantz
  local SETCARD_ID_0 = 0x17d --Vaylantz
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--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:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--set
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.stcon)
  	e2:SetTarget(s.sttg)
  	e2:SetOperation(s.stop)
  	c:RegisterEffect(e2)
  	--pzone set
  	local e3 = Effect.CreateEffect(c)
  	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 + 2)
  	e3:SetCondition(s.mvcon)
  	e3:SetTarget(s.mvtg)
  	e3:SetOperation(s.mvop)
  	c:RegisterEffect(e3)
  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
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c)
  	return not c:IsSetCard(SETCARD_ID_0) and not c:IsLocation(LOCATION_EXTRA)
  end
  function s.stcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL)
  end
  function s.stfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_PENDULUM) and c:IsFaceup() and not c:IsForbidden()
  end
  function s.sttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingMatchingCard(s.stfilter, tp, LOCATION_EXTRA, 0, 1, nil)
  	end
  end
  function s.stop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local g = Duel.SelectMatchingCard(tp, s.stfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc then
  		Duel.MoveToField(tc, tp, tp, LOCATION_SZONE, POS_FACEUP, true)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetCode(EFFECT_CHANGE_TYPE)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET)
  		e1:SetValue(TYPE_SPELL + TYPE_CONTINUOUS)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.mvcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousLocation(LOCATION_MZONE) and c:IsLocation(LOCATION_MZONE) and (c:GetPreviousSequence() ~= c:GetSequence() or c:GetPreviousControler() ~= tp)
  end
  function s.mvtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return (Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)) and Duel.IsExistingMatchingCard(s.stfilter, tp, LOCATION_EXTRA, 0, 1, nil)
  	end
  end
  function s.mvop(e, tp, eg, ep, ev, re, r, rp)
  	if not (Duel.CheckLocation(tp, LOCATION_PZONE, 0) or Duel.CheckLocation(tp, LOCATION_PZONE, 1)) then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  	local g = Duel.SelectMatchingCard(tp, s.stfilter, 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
  
  