name: Fighting
card_text: If a card(s) you control and a card(s) your opponent controls are destroyed by battle or card effect at the same time: Each player draws 2 cards. You can only activate 1 "Fighting Dirty" per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_CUSTOM + id)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	if not s.global_check then
  		s.global_check = true
  		local ge1 = Effect.CreateEffect(c)
  		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge1:SetCode(EVENT_DESTROYED)
  		ge1:SetCondition(s.regcon)
  		ge1:SetOperation(s.regop)
  		Duel.RegisterEffect(ge1, 0)
  	end
  end
  function s.cfilter(c, tp)
  	return c:IsReason(REASON_BATTLE + REASON_EFFECT) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	local v = 0
  	if eg:IsExists(s.cfilter, 1, nil, 0) then
  		v = v + 1
  	end
  	if eg:IsExists(s.cfilter, 1, nil, 1) then
  		v = v + 2
  	end
  	if v == 0 then
  		return false
  	end
  	e:SetLabel(({ 0, 1, PLAYER_ALL })[v])
  	return true
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.RaiseEvent(eg, EVENT_CUSTOM + id, re, r, rp, ep, e:GetLabel())
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return ev == PLAYER_ALL
  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_DRAW, nil, 0, PLAYER_ALL, 2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Draw(tp, 2, REASON_EFFECT)
  	Duel.Draw(1 - tp, 2, REASON_EFFECT)
  end
  
  
source_text: Fighting
  If a card(s) you control and a card(s) your opponent controls are destroyed by battle or card effect at the same time: Each player draws 2 cards. You can only activate 1 "Fighting Dirty" per turn.
target_text: -- Fighting
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_CUSTOM + id)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	if not s.global_check then
  		s.global_check = true
  		local ge1 = Effect.CreateEffect(c)
  		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge1:SetCode(EVENT_DESTROYED)
  		ge1:SetCondition(s.regcon)
  		ge1:SetOperation(s.regop)
  		Duel.RegisterEffect(ge1, 0)
  	end
  end
  function s.cfilter(c, tp)
  	return c:IsReason(REASON_BATTLE + REASON_EFFECT) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	local v = 0
  	if eg:IsExists(s.cfilter, 1, nil, 0) then
  		v = v + 1
  	end
  	if eg:IsExists(s.cfilter, 1, nil, 1) then
  		v = v + 2
  	end
  	if v == 0 then
  		return false
  	end
  	e:SetLabel(({ 0, 1, PLAYER_ALL })[v])
  	return true
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.RaiseEvent(eg, EVENT_CUSTOM + id, re, r, rp, ep, e:GetLabel())
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return ev == PLAYER_ALL
  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_DRAW, nil, 0, PLAYER_ALL, 2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Draw(tp, 2, REASON_EFFECT)
  	Duel.Draw(1 - tp, 2, REASON_EFFECT)
  end
  
  