name: Bujingi
card_text: During either player's turn, when a card or effect is activated that targets a "Bujin" monster you control (except during the Damage Step): You can banish this card from your Graveyard; negate that effect.
external_ids: local SETCARD_ID_0 = 0x88 --Bujin
  
lua: local SETCARD_ID_0 = 0x88 --Bujin
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--negate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DISABLE)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCondition(s.negcon)
  	e1:SetCost(aux.bfgcost)
  	e1:SetTarget(s.negtg)
  	e1:SetOperation(s.negop)
  	c:RegisterEffect(e1)
  end
  function s.tfilter(c, tp)
  	return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.negcon(e, tp, eg, ep, ev, re, r, rp)
  	if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
  		return false
  	end
  	local g = Duel.GetChainInfo(ev, CHAININFO_TARGET_CARDS)
  	return g and g:IsExists(s.tfilter, 1, nil, tp) and Duel.IsChainDisablable(ev)
  end
  function s.negtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE, eg, 1, 0, 0)
  end
  function s.negop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateEffect(ev)
  end
  
  
source_text: Bujingi
  During either player's turn, when a card or effect is activated that targets a "Bujin" monster you control (except during the Damage Step): You can banish this card from your Graveyard; negate that effect.
target_text: -- Bujingi
  local SETCARD_ID_0 = 0x88 --Bujin
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--negate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DISABLE)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCondition(s.negcon)
  	e1:SetCost(aux.bfgcost)
  	e1:SetTarget(s.negtg)
  	e1:SetOperation(s.negop)
  	c:RegisterEffect(e1)
  end
  function s.tfilter(c, tp)
  	return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.negcon(e, tp, eg, ep, ev, re, r, rp)
  	if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
  		return false
  	end
  	local g = Duel.GetChainInfo(ev, CHAININFO_TARGET_CARDS)
  	return g and g:IsExists(s.tfilter, 1, nil, tp) and Duel.IsChainDisablable(ev)
  end
  function s.negtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DISABLE, eg, 1, 0, 0)
  end
  function s.negop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.NegateEffect(ev)
  end
  
  