name: Dizzying
card_text: Activate this card only if you control a Level 6 or higher "Yosenju" monster. While you have a "Yosenju" card in your Pendulum Zone, if a monster would be returned from the field to the hand by a card effect, shuffle it into the Deck instead, unless it is a "Yosenju" monster.
external_ids: local SETCARD_ID_0 = 0xb3 --Yosenju
  
lua: local SETCARD_ID_0 = 0xb3 --Yosenju
  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)
  	e1:SetCondition(s.condition)
  	c:RegisterEffect(e1)
  	--todeck
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_IGNORE_IMMUNE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EFFECT_TO_HAND_REDIRECT)
  	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e2:SetTarget(s.tdtg)
  	e2:SetCondition(s.tdcon)
  	e2:SetValue(LOCATION_DECKSHF)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsLevelAbove(6) and c:IsSetCard(SETCARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.tdtg(e, c)
  	return (c:IsFacedown() or not c:IsSetCard(SETCARD_ID_0)) and c:IsReason(REASON_EFFECT)
  end
  function s.tdcon(e)
  	return Duel.IsExistingMatchingCard(Card.IsSetCard, e:GetHandlerPlayer(), LOCATION_PZONE, 0, 1, nil, 0xb3)
  end
  
  
source_text: Dizzying
  Activate this card only if you control a Level 6 or higher "Yosenju" monster. While you have a "Yosenju" card in your Pendulum Zone, if a monster would be returned from the field to the hand by a card effect, shuffle it into the Deck instead, unless it is a "Yosenju" monster.
target_text: -- Dizzying
  local SETCARD_ID_0 = 0xb3 --Yosenju
  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)
  	e1:SetCondition(s.condition)
  	c:RegisterEffect(e1)
  	--todeck
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_IGNORE_IMMUNE)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EFFECT_TO_HAND_REDIRECT)
  	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e2:SetTarget(s.tdtg)
  	e2:SetCondition(s.tdcon)
  	e2:SetValue(LOCATION_DECKSHF)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsLevelAbove(6) and c:IsSetCard(SETCARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.tdtg(e, c)
  	return (c:IsFacedown() or not c:IsSetCard(SETCARD_ID_0)) and c:IsReason(REASON_EFFECT)
  end
  function s.tdcon(e)
  	return Duel.IsExistingMatchingCard(Card.IsSetCard, e:GetHandlerPlayer(), LOCATION_PZONE, 0, 1, nil, 0xb3)
  end
  
  