Merge pull request #62 from athei/spell_reflect

Track spell reflect damage
This commit is contained in:
Tercio Jose
2020-05-10 17:30:58 -03:00
committed by GitHub
Regular → Executable
+39
View File
@@ -108,6 +108,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
@@ -461,6 +463,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
@@ -1432,6 +1452,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
@@ -5164,6 +5202,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_table_wipe (npcid_cache)
_table_wipe (ignore_death)
_table_wipe (reflected)
damage_cache = setmetatable ({}, _detalhes.weaktable)
damage_cache_pets = setmetatable ({}, _detalhes.weaktable)