fix issue with LOWEST_HP and improve melee spell failure checks

This commit is contained in:
pepopo978
2025-04-04 07:32:21 -07:00
parent a91086a15c
commit cb86e3cc92
3 changed files with 39 additions and 20 deletions
+26 -13
View File
@@ -34,7 +34,9 @@ local fades_test = L["(.+) fades from (.+)"]
local resist_test = L["Your (.+) was resisted by (.+)"]
local missed_test = L["Your (.+) missed (.+)"]
local parry_test = L["Your (.+) is parried by (.+)"]
local immune_test = L["Your (.+) fails. (.+) is immune"]
local immune_test = L["Your (.+) fail.+\. (.+) is immune"]
local block_test = L["Your (.+) was blocked by (.+)"]
local dodge_test = L["Your (.+) was dodged by (.+)"]
local lastGuid = nil
@@ -225,19 +227,30 @@ end)
Cursive:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE",
function(message)
-- check for resist
local _, _, spellName, target = string.find(message, resist_test)
-- check for missed
if not spellName then
_, _, spellName, target = string.find(message, missed_test)
local spell_failed_tests = {
resist_test,
immune_test
}
-- only some classes have melee spells that need to check for dodge, parry, miss, block
if playerClassName == "DRUID" or playerClassName == "HUNTER" or playerClassName == "ROGUE" then
spell_failed_tests = {
resist_test,
immune_test,
missed_test,
parry_test,
block_test,
dodge_test
}
end
-- check for parry
if not spellName then
_, _, spellName, target = string.find(message, parry_test)
end
-- check for immune
if not spellName then
_, _, spellName, target = string.find(message, immune_test)
local spellName, target
for _, test in pairs(spell_failed_tests) do
local _, _, foundSpell, foundTarget = string.find(message, test)
if foundSpell and foundTarget then
spellName = foundSpell
target = foundTarget
break
end
end
if spellName and target then