name: Mischief
card_text: Neither player can activate cards or effects in response to this card's activation. Cannot be activated as Chain Link 2 or higher. At the end of your Battle Phase, if all monsters you control are "Valkyrie" monsters (min. 1): Send this card to the GY, also, immediately after this effect resolves, skip to the start of the Battle Phase of your next turn. If you do, you cannot activate "Mischief of the Time Goddess" until the end of that turn.
external_ids: local SETCARD_ID_0 = 0x122 --Valkyrie
  
lua: local SETCARD_ID_0 = 0x122 --Valkyrie
  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:SetHintTiming(TIMING_BATTLE_END)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetCurrentChain() > 0 or Duel.GetCurrentPhase() ~= PHASE_BATTLE or Duel.GetTurnPlayer() ~= tp then
  		return false
  	end
  	local g = Duel.GetFieldGroup(tp, LOCATION_MZONE, 0)
  	return g:GetCount() > 0 and g:FilterCount(s.cfilter, nil) == g:GetCount()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		Duel.SetChainLimit(aux.FALSE)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.SendtoGrave(c, REASON_EFFECT)
  	end
  	--
  	Duel.SkipPhase(tp, PHASE_BATTLE, RESET_PHASE + PHASE_END, 1)
  	Duel.SkipPhase(tp, PHASE_MAIN2, RESET_PHASE + PHASE_END, 1)
  	Duel.SkipPhase(tp, PHASE_END, RESET_PHASE + PHASE_END, 1)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_SKIP_TURN)
  	e1:SetTargetRange(0, 1)
  	e1:SetReset(RESET_PHASE + PHASE_END + RESET_OPPO_TURN)
  	Duel.RegisterEffect(e1, tp)
  	Duel.SkipPhase(tp, PHASE_DRAW, RESET_PHASE + PHASE_END, 2)
  	Duel.SkipPhase(tp, PHASE_STANDBY, RESET_PHASE + PHASE_END, 2)
  	Duel.SkipPhase(tp, PHASE_MAIN1, RESET_PHASE + PHASE_END, 2)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EFFECT_CANNOT_EP)
  	e2:SetTargetRange(1, 0)
  	e2:SetReset(RESET_PHASE + PHASE_MAIN1 + RESET_SELF_TURN)
  	Duel.RegisterEffect(e2, tp)
  	--
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e3:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e3:SetTargetRange(1, 0)
  	e3:SetValue(s.aclimit)
  	e3:SetReset(RESET_PHASE + PHASE_END, 3)
  	Duel.RegisterEffect(e3, tp)
  end
  function s.aclimit(e, re, tp)
  	return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsCode(id)
  end
  
  
source_text: Mischief
  Neither player can activate cards or effects in response to this card's activation. Cannot be activated as Chain Link 2 or higher. At the end of your Battle Phase, if all monsters you control are "Valkyrie" monsters (min. 1): Send this card to the GY, also, immediately after this effect resolves, skip to the start of the Battle Phase of your next turn. If you do, you cannot activate "Mischief of the Time Goddess" until the end of that turn.
target_text: -- Mischief
  local SETCARD_ID_0 = 0x122 --Valkyrie
  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:SetHintTiming(TIMING_BATTLE_END)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetCurrentChain() > 0 or Duel.GetCurrentPhase() ~= PHASE_BATTLE or Duel.GetTurnPlayer() ~= tp then
  		return false
  	end
  	local g = Duel.GetFieldGroup(tp, LOCATION_MZONE, 0)
  	return g:GetCount() > 0 and g:FilterCount(s.cfilter, nil) == g:GetCount()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  		Duel.SetChainLimit(aux.FALSE)
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.SendtoGrave(c, REASON_EFFECT)
  	end
  	--
  	Duel.SkipPhase(tp, PHASE_BATTLE, RESET_PHASE + PHASE_END, 1)
  	Duel.SkipPhase(tp, PHASE_MAIN2, RESET_PHASE + PHASE_END, 1)
  	Duel.SkipPhase(tp, PHASE_END, RESET_PHASE + PHASE_END, 1)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_SKIP_TURN)
  	e1:SetTargetRange(0, 1)
  	e1:SetReset(RESET_PHASE + PHASE_END + RESET_OPPO_TURN)
  	Duel.RegisterEffect(e1, tp)
  	Duel.SkipPhase(tp, PHASE_DRAW, RESET_PHASE + PHASE_END, 2)
  	Duel.SkipPhase(tp, PHASE_STANDBY, RESET_PHASE + PHASE_END, 2)
  	Duel.SkipPhase(tp, PHASE_MAIN1, RESET_PHASE + PHASE_END, 2)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EFFECT_CANNOT_EP)
  	e2:SetTargetRange(1, 0)
  	e2:SetReset(RESET_PHASE + PHASE_MAIN1 + RESET_SELF_TURN)
  	Duel.RegisterEffect(e2, tp)
  	--
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e3:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e3:SetTargetRange(1, 0)
  	e3:SetValue(s.aclimit)
  	e3:SetReset(RESET_PHASE + PHASE_END, 3)
  	Duel.RegisterEffect(e3, tp)
  end
  function s.aclimit(e, re, tp)
  	return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsCode(id)
  end
  
  