name: Top
card_text: Reveal 1 card from your Deck and place it on top of your Deck, then your opponent reveals 1 card from their Deck and places it on top of their Deck. You can only activate 1 "Top Share" per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--set top
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 1))
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) >= 2 and Duel.GetFieldGroupCount(1 - tp, LOCATION_DECK, 0) >= 2
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) < 2 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 0))
  	local tc = Duel.SelectMatchingCard(tp, nil, tp, LOCATION_DECK, 0, 1, 1, nil):GetFirst()
  	Duel.ShuffleDeck(tp)
  	Duel.MoveSequence(tc, SEQ_DECKTOP)
  	Duel.ConfirmDecktop(tp, 1)
  	if Duel.GetFieldGroupCount(1 - tp, LOCATION_DECK, 0) < 2 then
  		return
  	end
  	Duel.BreakEffect()
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, aux.Stringid(id, 0))
  	local tc2 = Duel.SelectMatchingCard(1 - tp, nil, 1 - tp, LOCATION_DECK, 0, 1, 1, nil):GetFirst()
  	Duel.ShuffleDeck(1 - tp)
  	Duel.MoveSequence(tc2, SEQ_DECKTOP)
  	Duel.ConfirmDecktop(1 - tp, 1)
  end
  
  
source_text: Top
  Reveal 1 card from your Deck and place it on top of your Deck, then your opponent reveals 1 card from their Deck and places it on top of their Deck. You can only activate 1 "Top Share" per turn.
target_text: -- Top
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--set top
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 1))
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) >= 2 and Duel.GetFieldGroupCount(1 - tp, LOCATION_DECK, 0) >= 2
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) < 2 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, aux.Stringid(id, 0))
  	local tc = Duel.SelectMatchingCard(tp, nil, tp, LOCATION_DECK, 0, 1, 1, nil):GetFirst()
  	Duel.ShuffleDeck(tp)
  	Duel.MoveSequence(tc, SEQ_DECKTOP)
  	Duel.ConfirmDecktop(tp, 1)
  	if Duel.GetFieldGroupCount(1 - tp, LOCATION_DECK, 0) < 2 then
  		return
  	end
  	Duel.BreakEffect()
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, aux.Stringid(id, 0))
  	local tc2 = Duel.SelectMatchingCard(1 - tp, nil, 1 - tp, LOCATION_DECK, 0, 1, 1, nil):GetFirst()
  	Duel.ShuffleDeck(1 - tp)
  	Duel.MoveSequence(tc2, SEQ_DECKTOP)
  	Duel.ConfirmDecktop(1 - tp, 1)
  end
  
  