name: Prediction
card_text: FLIP: During the End Phase of this turn, destroy as many Defense Position monsters your opponent controls as possible, and if you do, inflict 500 damage to your opponent for each monster destroyed.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--flip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_FLIP)
  	e1:SetOperation(s.flipop)
  	c:RegisterEffect(e1)
  end
  function s.flipop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetCountLimit(1)
  	e1:SetOperation(s.desop)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.desfilter(c)
  	return c:IsDefensePos()
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.desfilter, tp, 0, LOCATION_MZONE, nil)
  	if g:GetCount() > 0 then
  		Duel.Hint(HINT_CARD, 0, id)
  		local ct = Duel.Destroy(g, REASON_EFFECT)
  		Duel.Damage(1 - tp, ct * 500, REASON_EFFECT)
  	end
  end
  
  
source_text: Prediction
  FLIP: During the End Phase of this turn, destroy as many Defense Position monsters your opponent controls as possible, and if you do, inflict 500 damage to your opponent for each monster destroyed.
target_text: -- Prediction
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--flip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_FLIP)
  	e1:SetOperation(s.flipop)
  	c:RegisterEffect(e1)
  end
  function s.flipop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetCountLimit(1)
  	e1:SetOperation(s.desop)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.desfilter(c)
  	return c:IsDefensePos()
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.desfilter, tp, 0, LOCATION_MZONE, nil)
  	if g:GetCount() > 0 then
  		Duel.Hint(HINT_CARD, 0, id)
  		local ct = Duel.Destroy(g, REASON_EFFECT)
  		Duel.Damage(1 - tp, ct * 500, REASON_EFFECT)
  	end
  end
  
  