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
+8 -4
View File
@@ -36,7 +36,9 @@ L:RegisterTranslations("enUS", function()
["Your (.+) was resisted by (.+)"] = true,
["Your (.+) missed (.+)"] = true,
["Your (.+) is parried by (.+)"] = true,
["Your (.+) fails. (.+) is immune"] = true,
["Your (.+) fail.+\. (.+) is immune"] = true,
["Your (.+) was blocked by (.+)"] = true,
["Your (.+) was dodged by (.+)"] = true,
-- global
["|cffffcc00Cursive:|cffffaaaa Couldn't detect SuperWoW."] = true,
@@ -222,9 +224,11 @@ L:RegisterTranslations("zhCN", function()
-- curses
["(.+) fades from (.+)"] = "(.+)效果从(.+)身上消失",
["Your (.+) was resisted by (.+)"] = "你的(.+)被(.+)抵抗了",
["Your (.+) missed (.+)"] = "你的(.+)未命中(.+)",
["Your (.+) is parried by (.+)"] = "你的(.+)被(.+)招架",
["Your (.+) fails. (.+) is immune"] = "你的(.+)失败,(.+)免疫",
["Your (.+) is parried by (.+)"] = "你的(.+)被(.+)招架了",
["Your (.+) missed (.+)"] = "你的(.+)没有击中(.+)",
["Your (.+) was dodged by (.+)"] = "你的(.+)被(.+)躲闪过去了",
["Your (.+) was blocked by (.+)"] = "你的(.+)被(.+)格挡了",
["Your (.+) fail.+\. (.+) is immune"] = "你的(.+)施放失败。(.+)对此免疫",
-- global
["|cffffcc00Cursive:|cffffaaaa Couldn't detect SuperWoW."] = "|cffffcc00Cursive:|cffffaaaa 无法检测到SuperWoW.",
+5 -3
View File
@@ -419,9 +419,11 @@ local function pickTarget(selectedPriority, spellNameNoRank, checkRange, options
primaryValue = UnitHealth(guid) or 0
end
if selectedPriority == PRIORITY_LOWEST_HP and primaryValue < highestPrimaryValue then
highestPrimaryValue = primaryValue
targetedGuid = guid
if selectedPriority == PRIORITY_LOWEST_HP then
if primaryValue < highestPrimaryValue then
highestPrimaryValue = primaryValue
targetedGuid = guid
end
elseif primaryValue > highestPrimaryValue then
highestPrimaryValue = primaryValue
highestSecondaryValue = secondaryValue
+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