Skip to content

Commit

Permalink
Lock damage reflection on a time windows of 3 seconds from reflected …
Browse files Browse the repository at this point in the history
…to target hit
  • Loading branch information
Tercioo committed May 10, 2020
1 parent 8967c88 commit 1142fbb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local _tempo = time()
local _

local DetailsFramework = DetailsFramework

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers

Expand Down Expand Up @@ -467,7 +468,7 @@
--> this cast may have been spell reflected
if (who_serial == alvo_serial) then
local idx = who_serial
if (reflected[idx] and reflected[idx].serial) then
if (reflected[idx] and reflected[idx].serial and DetailsFramework:IsNearlyEqual(reflected[idx].time, time, 3.0)) then
--> the 'SPELL_MISSED' with type 'REFLECT' appeared first -> log the reflection
who_serial = reflected[idx].serial
who_name = reflected[idx].name
Expand All @@ -477,7 +478,8 @@
else
--> otherwise log the amount for the 'SPELL_MISSED' event
reflected[idx] = {
amount = amount
amount = amount,
time = time
}
end
end
Expand Down Expand Up @@ -1352,7 +1354,7 @@
end

-- ~miss
function parser:missed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, missType, isOffHand, amountMissed, arg1)
function parser:missed (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, missType, isOffHand, amountMissed, arg1, arg2, arg3)

------------------------------------------------------------------------------------------------
--> early checks and fixes
Expand Down Expand Up @@ -1454,18 +1456,21 @@

--> It is non deterministic whether the 'SPELL_DAMAGE' or the 'SPELL_MISSED' log appears first. We handle both cases.
elseif (missType == "REFLECT") then
if (reflected[who_serial] and reflected[who_serial].amount > 0) then

if (reflected[who_serial] and reflected[who_serial].amount > 0 and DetailsFramework:IsNearlyEqual(reflected[who_serial].time, time, 3.0)) then
--> 'SPELL_DAMAGE' was logged first -> log the reflect here
--> We cannot rely on amountMissed which is empty in the reflection case
local amount = reflected[who_serial].amount
reflected[who_serial] = nil
return parser:spell_dmg (token, time, alvo_serial, alvo_name, alvo_flags, who_serial, who_name, who_flags, nil, spellid, spellname, spelltype, amount, -1, nil, nil, nil, nil, false, false, false, false)

else
--> otherwise write out information used in the 'SPELL_DAMAGE' event
reflected[who_serial] = {
serial = alvo_serial,
name = alvo_name,
who_flags = alvo_flags,
time = time,
amount = 0
}
end
Expand Down

0 comments on commit 1142fbb

Please sign in to comment.