name: Zefraxi,
card_text: Pendulum Scale = 1
  [ Pendulum Effect ]
  You cannot Pendulum Summon monsters, except "Yang Zing" and "Zefra" monsters. This effect cannot be negated.
  ----------------------------------------
  [ Monster Effect ]
  If this card is Pendulum Summoned, or Special Summoned from the Main Deck: You can target 1 "Yang Zing" or "Zefra" monster you control, except "Zefraxi, Treasure of the Yang Zing"; that face-up monster is treated as a Tuner this turn, also place this card on the bottom of the Deck when it leaves the field. You can only use this effect of "Zefraxi, Treasure of the Yang Zing" once per turn.
external_ids: local SETCARD_ID_0 = 0x9e --Yang
  
lua: local SETCARD_ID_0 = 0x9e --Yang
  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 success
  	local e3 = Effect.CreateEffect(c)
  	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.condition)
  	e3:SetTarget(s.target)
  	e3:SetOperation(s.operation)
  	c:RegisterEffect(e3)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp)
  	if c:IsSetCard(SETCARD_ID_0, 0xc4) then
  		return false
  	end
  	return bit.band(sumtype, SUMMON_TYPE_PENDULUM) == SUMMON_TYPE_PENDULUM
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_PENDULUM) or e:GetHandler():IsPreviousLocation(LOCATION_DECK)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0, 0xc4) and not c:IsType(TYPE_TUNER) and not c:IsCode(id)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_ADD_TYPE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e1:SetValue(TYPE_TUNER)
  		tc:RegisterEffect(e1)
  	end
  	if c:IsRelateToEffect(e) then
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
  		e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e2:SetReset(RESET_EVENT + RESETS_REDIRECT)
  		e2:SetValue(LOCATION_DECKBOT)
  		c:RegisterEffect(e2)
  	end
  end
  
  
source_text: Zefraxi,
  Pendulum Scale = 1
  [ Pendulum Effect ]
  You cannot Pendulum Summon monsters, except "Yang Zing" and "Zefra" monsters. This effect cannot be negated.
  ----------------------------------------
  [ Monster Effect ]
  If this card is Pendulum Summoned, or Special Summoned from the Main Deck: You can target 1 "Yang Zing" or "Zefra" monster you control, except "Zefraxi, Treasure of the Yang Zing"; that face-up monster is treated as a Tuner this turn, also place this card on the bottom of the Deck when it leaves the field. You can only use this effect of "Zefraxi, Treasure of the Yang Zing" once per turn.
target_text: -- Zefraxi,
  local SETCARD_ID_0 = 0x9e --Yang
  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 success
  	local e3 = Effect.CreateEffect(c)
  	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.condition)
  	e3:SetTarget(s.target)
  	e3:SetOperation(s.operation)
  	c:RegisterEffect(e3)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp)
  	if c:IsSetCard(SETCARD_ID_0, 0xc4) then
  		return false
  	end
  	return bit.band(sumtype, SUMMON_TYPE_PENDULUM) == SUMMON_TYPE_PENDULUM
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_PENDULUM) or e:GetHandler():IsPreviousLocation(LOCATION_DECK)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0, 0xc4) and not c:IsType(TYPE_TUNER) and not c:IsCode(id)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_ADD_TYPE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e1:SetValue(TYPE_TUNER)
  		tc:RegisterEffect(e1)
  	end
  	if c:IsRelateToEffect(e) then
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
  		e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e2:SetReset(RESET_EVENT + RESETS_REDIRECT)
  		e2:SetValue(LOCATION_DECKBOT)
  		c:RegisterEffect(e2)
  	end
  end
  
  