name: Legendary
card_text: Change all face-up "Wind-Up" monsters you control to face-down Defense Position.
external_ids: local SETCARD_ID_0 = 0x58 --Wind-Up
  
lua: local SETCARD_ID_0 = 0x58 --Wind-Up
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_POSITION)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsCanTurnSet()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_MZONE, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_POSITION, g, g:GetCount(), 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_MZONE, 0, nil)
  	if g:GetCount() > 0 then
  		Duel.ChangePosition(g, POS_FACEDOWN_DEFENSE)
  	end
  end
  
  
source_text: Legendary
  Change all face-up "Wind-Up" monsters you control to face-down Defense Position.
target_text: -- Legendary
  local SETCARD_ID_0 = 0x58 --Wind-Up
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_POSITION)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsCanTurnSet()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_MZONE, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_POSITION, g, g:GetCount(), 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_MZONE, 0, nil)
  	if g:GetCount() > 0 then
  		Duel.ChangePosition(g, POS_FACEDOWN_DEFENSE)
  	end
  end
  
  