name: Jirai
card_text: When this card declares an attack: Toss a coin and call it. If you call it wrong, lose half your LP.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--coin
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_COIN)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e1:SetTarget(s.attg)
  	e1:SetOperation(s.atop)
  	c:RegisterEffect(e1)
  end
  function s.attg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_COIN, nil, 0, tp, 1)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_COIN)
  	local opt = Duel.AnnounceCoin(tp)
  	local coin = Duel.TossCoin(tp, 1)
  	if opt == coin then
  		Duel.SetLP(tp, math.ceil(Duel.GetLP(tp) / 2))
  	end
  end
  
  
source_text: Jirai
  When this card declares an attack: Toss a coin and call it. If you call it wrong, lose half your LP.
target_text: -- Jirai
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--coin
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_COIN)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e1:SetTarget(s.attg)
  	e1:SetOperation(s.atop)
  	c:RegisterEffect(e1)
  end
  function s.attg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_COIN, nil, 0, tp, 1)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_COIN)
  	local opt = Duel.AnnounceCoin(tp)
  	local coin = Duel.TossCoin(tp, 1)
  	if opt == coin then
  		Duel.SetLP(tp, math.ceil(Duel.GetLP(tp) / 2))
  	end
  end
  
  