name: Cup
card_text: Toss a coin and apply this effect.
  ● Heads: Draw 2 cards.
  ● Tails: Your opponent draws 2 cards.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW + CATEGORY_COIN)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	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.IsPlayerCanDraw(tp, 2) and Duel.IsPlayerCanDraw(1 - tp, 2)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_COIN, nil, 0, tp, 1)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local res = Duel.TossCoin(tp, 1)
  	if res == 1 then
  		Duel.Draw(tp, 2, REASON_EFFECT)
  	else
  		Duel.Draw(1 - tp, 2, REASON_EFFECT)
  	end
  end
  
  
source_text: Cup
  Toss a coin and apply this effect.
  ● Heads: Draw 2 cards.
  ● Tails: Your opponent draws 2 cards.
target_text: -- Cup
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW + CATEGORY_COIN)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	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.IsPlayerCanDraw(tp, 2) and Duel.IsPlayerCanDraw(1 - tp, 2)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_COIN, nil, 0, tp, 1)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local res = Duel.TossCoin(tp, 1)
  	if res == 1 then
  		Duel.Draw(tp, 2, REASON_EFFECT)
  	else
  		Duel.Draw(1 - tp, 2, REASON_EFFECT)
  	end
  end
  
  