diff --git a/VuhDoShieldAbsorb.lua b/VuhDoShieldAbsorb.lua index 67166f660c14862fe46daac11a9dfe1d4425b552..cb1ee805980e1dd94579e82995be5b7e383134fa 100644 --- a/VuhDoShieldAbsorb.lua +++ b/VuhDoShieldAbsorb.lua @@ -5,21 +5,21 @@ local type = type; local UnitGetTotalAbsorbs = VUHDO_unitGetTotalAbsorbs; local VUHDO_SHIELDS = { - [17] = 30, --Power Word: Shield rank 1 - [592] = 30, --Power Word: Shield rank 2 - [600] = 30, --Power Word: Shield rank 3 - [3747] = 30, --Power Word: Shield rank 4 - [6056] = 30, --Power Word: Shield rank 5 - [6066] = 30, --Power Word: Shield rank 6 - [10898] = 30, --Power Word: Shield rank 7 - [10899] = 30, --Power Word: Shield rank 8 - [10900] = 30, --Power Word: Shield rank 9 - [10901] = 30, --Power Word: Shield rank 10 - [25217] = 30, --Power Word: Shield rank 11 - [25218] = 30, --Power Word: Shield rank 12 - [48065] = 30, --Power Word: Shield rank 13 - [48066] = 30, --Power Word: Shield rank 14 - [56160] = 30, --Glyph of Power Word: Shield + [17] = 30, -- Power Word: Shield (rank 1) + [592] = 30, -- Power Word: Shield (rank 2) + [600] = 30, -- Power Word: Shield (rank 3) + [3747] = 30, -- Power Word: Shield (rank 4) + [6056] = 30, -- Power Word: Shield (rank 5) + [6066] = 30, -- Power Word: Shield (rank 6) + [10898] = 30, -- Power Word: Shield (rank 7) + [10899] = 30, -- Power Word: Shield (rank 8) + [10900] = 30, -- Power Word: Shield (rank 9) + [10901] = 30, -- Power Word: Shield (rank 10) + [25217] = 30, -- Power Word: Shield (rank 11) + [25218] = 30, -- Power Word: Shield (rank 12) + [48065] = 30, -- Power Word: Shield (rank 13) + [48066] = 30, -- Power Word: Shield (rank 14) + [56160] = 30, -- Glyph of Power Word: Shield } @@ -214,6 +214,7 @@ local function VUHDO_removeShield(aUnit, aShieldName) VUHDO_SHIELD_LEFT[aUnit][aShieldName] = nil; VUHDO_SHIELD_EXPIRY[aUnit][aShieldName] = nil; VUHDO_SHIELD_LAST_SOURCE_GUID[aUnit][aShieldName] = nil; + VUHDO_SHIELD_LEFT_TEMP[aUnit][aShieldName] = nil; --VUHDO_xMsg("Removed shield " .. aShieldName .. " from " .. aUnit); end @@ -308,15 +309,20 @@ end -- function VUHDO_getUnitOverallShieldRemain(aUnit) - local aRemain = UnitGetTotalAbsorbs(aUnit) - if aRemain > 0 then return aRemain end + local aRemain = UnitGetTotalAbsorbs(aUnit); + + if aRemain > 0 then + return aRemain; + end + if VUHDO_SHIELD_LEFT[aUnit] then for _, value in pairs(VUHDO_SHIELD_LEFT[aUnit]) do if value then - aRemain = aRemain + value + aRemain = aRemain + value; end end end + return aRemain; end @@ -344,26 +350,30 @@ function VUHDO_parseCombatLogShieldAbsorb(aMessage, aSrcGuid, aDstGuid, aShieldN if VUHDO_SHIELDS[aSpellId] then if "SPELL_AURA_REFRESH" == aMessage then - if not anAmount then --anAmount is always nil at wotlkc - anAmount = VUHDO_SHIELD_LEFT_TEMP[tUnit][aShieldName] or 0 + if not anAmount then -- anAmount is always nil in Wrath Classic + anAmount = VUHDO_SHIELD_LEFT_TEMP[tUnit][aShieldName] or 0; end + VUHDO_updateShieldValue(tUnit, aShieldName, anAmount, VUHDO_SHIELDS[aSpellId]); elseif "SPELL_AURA_APPLIED" == aMessage then - if not anAmount then --anAmount is always nil at wotlkc - anAmount = VUHDO_SHIELD_LEFT_TEMP[tUnit][aShieldName] or 0 + if not anAmount then -- anAmount is always nil in Wrath Classic + anAmount = VUHDO_SHIELD_LEFT_TEMP[tUnit][aShieldName] or 0; end + VUHDO_initShieldValue(tUnit, aShieldName, anAmount, VUHDO_SHIELDS[aSpellId]); VUHDO_SHIELD_LAST_SOURCE_GUID[tUnit][aShieldName] = aSrcGuid; elseif "SPELL_AURA_REMOVED" == aMessage or "SPELL_AURA_BROKEN" == aMessage or "SPELL_AURA_BROKEN_SPELL" == aMessage then VUHDO_removeShield(tUnit, aShieldName); - elseif "SPELL_HEAL" == aMessage and aSpellId == 56160 then --Glyph of Power Word: Shield - anAmount = aHealAmount * 5 + elseif "SPELL_HEAL" == aMessage and aSpellId == 56160 then -- Glyph of Power Word: Shield + anAmount = aHealAmount / 0.2; -- the glyph heal amount is 20% of the absorb amount + if aCritical then - anAmount = math.floor(anAmount / 1.5) + anAmount = math.floor(anAmount / 1.5); -- critical heals in Wrath Classic are 150% end - VUHDO_SHIELD_LEFT_TEMP[tUnit][VUHDO_SPELL_ID.POWERWORD_SHIELD] = anAmount -- save shield value into temp table + + VUHDO_SHIELD_LEFT_TEMP[tUnit][VUHDO_SPELL_ID.POWERWORD_SHIELD] = anAmount; end elseif VUHDO_ABSORB_DEBUFFS[aSpellId] then @@ -397,13 +407,17 @@ function VUHDO_parseCombatLogShieldAbsorb(aMessage, aSrcGuid, aDstGuid, aShieldN VUHDO_updateAllHoTs(); VUHDO_updateAllCyclicBouquets(true); elseif "SPELL_ABSORBED" == aMessage then + -- SPELL_ABSORBED optionally includes the spell payload if triggered from what would be SPELL_DAMAGE + -- this offsets the CLEU payload by +3 + -- see: https://wowpedia.fandom.com/wiki/COMBAT_LOG_EVENT#SPELL_ABSORBED if anAbsorbSpellSchool then - tShieldName = anAbsorbSpellName - anAmount = anAbsorbSpellDamageAmount or 0 + tShieldName = anAbsorbSpellName; + anAmount = anAbsorbSpellDamageAmount or 0; else - tShieldName = anAbsorbAmount - anAmount = anAbsorbSwingDamageAmount or 0 + tShieldName = anAbsorbAmount; + anAmount = anAbsorbSwingDamageAmount or 0; end + if VUHDO_SHIELD_LEFT[tUnit][tShieldName] then tDelta = VUHDO_getShieldLeftAmount(tUnit, tShieldName) - anAmount; VUHDO_updateShieldValue(tUnit, tShieldName, tDelta);