From 1142fbb13a328fb77cc5fde9f2223d0798fb2b39 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sun, 10 May 2020 19:33:19 -0300 Subject: [PATCH] Lock damage reflection on a time windows of 3 seconds from reflected to target hit --- core/parser.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/parser.lua b/core/parser.lua index d727f269e..fbc9e1586 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -4,7 +4,8 @@ local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) local _tempo = time() local _ - + local DetailsFramework = DetailsFramework + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> local pointers @@ -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 @@ -477,7 +478,8 @@ else --> otherwise log the amount for the 'SPELL_MISSED' event reflected[idx] = { - amount = amount + amount = amount, + time = time } end end @@ -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 @@ -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