From 655f54ad8fc49acca615720190af6f5179c5d803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Sat, 11 Apr 2020 10:08:53 +0200 Subject: [PATCH] Track spell reflect damage Add damage that was reflected to the entity that has done the reflected (mostly prot warris). Previously the damage was added to the caster of the spell. --- core/parser.lua | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) mode change 100644 => 100755 core/parser.lua diff --git a/core/parser.lua b/core/parser.lua old mode 100644 new mode 100755 index fbcb8ac9..ab0c060d --- a/core/parser.lua +++ b/core/parser.lua @@ -105,6 +105,8 @@ local ignore_actors = {} --> spell containers for special cases local monk_guard_talent = {} --guard talent for bm monks + --> holds transitory information about reflected spells + local reflected = {} ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> constants @@ -455,6 +457,24 @@ --if (ignore_actors [alvo_serial]) then -- return --end + + --> 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 + --> the 'SPELL_MISSED' with type 'REFLECT' appeared first -> log the reflection + who_serial = reflected[idx].serial + who_name = reflected[idx].name + who_flags = reflected[idx].who_flags + reflected[idx] = nil + return parser:spell_dmg (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, amount, -1, nil, nil, nil, nil, false, false, false, false) + else + --> otherwise log the amount for the 'SPELL_MISSED' event + reflected[idx] = { + amount = amount + } + end + end --rules of specific encounters @@ -1406,6 +1426,24 @@ end + --> 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 + --> '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, + amount = 0 + } + end + else --colocando aqui apenas pois ele confere o override dentro do damage if (is_using_spellId_override) then @@ -5137,6 +5175,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _table_wipe (misc_cache_petsOwners) _table_wipe (ignore_death) + _table_wipe (reflected) damage_cache = setmetatable ({}, _detalhes.weaktable) damage_cache_pets = setmetatable ({}, _detalhes.weaktable)