Johnny C. Lam [08-10-13 - 18:40]
diff --git a/OvaleAura.lua b/OvaleAura.lua
index c2ab4b2..be0309d 100644
--- a/OvaleAura.lua
+++ b/OvaleAura.lua
@@ -555,29 +555,6 @@ function OvaleAura:GetAuraOnAnyTarget(spellId, filter, mine, excludingGUID)
return start, ending, count
end
-function OvaleAura:GetDamageMultiplier(spellId)
- -- Calculate the base damage multiplier for all spells.
- local damageMultiplier = OvalePaperDoll.stat.damageMultiplier
-
- -- Factor in the spell-specific multipliers from SpellDamage{Buff,Debuff} declarations.
- if spellId then
- local si = OvaleData.spellInfo[spellId]
- if si and si.damageAura then
- for filter, auraList in pairs(si.damageAura) do
- for auraSpellId, multiplier in pairs(auraList) do
- count = select(3, self:GetAuraByGUID(self_player_guid, auraSpellId, filter, nil, "player"))
- if count and count > 0 then
- -- Try to account for a stacking aura.
- -- multiplier = 1 + (multiplier - 1) * count
- damageMultiplier = damageMultiplier * multiplier
- end
- end
- end
- end
- end
- return damageMultiplier
-end
-
function OvaleAura:Debug()
self_pool:Debug()
self_aura_pool:Debug()
diff --git a/OvaleCondition.lua b/OvaleCondition.lua
index 5553053..cd4dc8f 100644
--- a/OvaleCondition.lua
+++ b/OvaleCondition.lua
@@ -636,11 +636,13 @@ OvaleCondition.conditions.debuffcombopoints = OvaleCondition.conditions.buffcomb
-- if target.DebuffDamageMultiplier(rake) <1 Spell(rake)
OvaleCondition.conditions.buffdamagemultiplier = function(condition)
+ self_auraFound.baseDamageMultiplier = nil
self_auraFound.damageMultiplier = nil
local start, ending = GetAura(condition, self_auraFound)
+ local baseDamageMultiplier = self_auraFound.baseDamageMultiplier or 1
local damageMultiplier = self_auraFound.damageMultiplier or 1
if start and ending and start <= ending then
- return start, ending, damageMultiplier, start, 0
+ return start, ending, baseDamageMultiplier * damageMultiplier, start, 0
else
return 0, nil, 0, 0, 0
end
@@ -2075,8 +2077,9 @@ OvaleCondition.conditions.lastestimateddamage = function(condition)
local mh = OvaleFuture:GetLastSpellInfo(guid, spellId, "mainHandWeaponDamage") or 1
local oh = OvaleFuture:GetLastSpellInfo(guid, spellId, "offHandWeaponDamage") or 1
local combo = OvaleFuture:GetLastSpellInfo(guid, spellId, "comboPoints") or 1
+ local bdm = OvaleFuture:GetLastSpellInfo(guid, spellId, "baseDamageMultiplier") or 1
local dm = OvaleFuture:GetLastSpellInfo(guid, spellId, "damageMultiplier") or 1
- return 0, nil, OvaleData:GetDamage(spellId, ap, sp, mh, oh, combo) * dm, 0, 0
+ return 0, nil, OvaleData:GetDamage(spellId, ap, sp, mh, oh, combo) * bdm * dm, 0, 0
end
OvaleCondition.conditions.lastspellestimateddamage = OvaleCondition.conditions.lastestimateddamage
@@ -2099,8 +2102,9 @@ OvaleCondition.conditions.lastspellestimateddamage = OvaleCondition.conditions.l
OvaleCondition.conditions.lastdamagemultiplier = function(condition)
local guid = OvaleGUID:GetGUID(GetTarget(condition, "target"))
+ local bdm = OvaleFuture:GetLastSpellInfo(guid, condition[1], "baseDamageMultiplier") or 1
local dm = OvaleFuture:GetLastSpellInfo(guid, condition[1], "damageMultiplier") or 1
- return Compare(dm, condition[2], condition[3])
+ return Compare(bdm * dm, condition[2], condition[3])
end
OvaleCondition.conditions.lastspelldamagemultiplier = OvaleCondition.conditions.lastdamagemultiplier
diff --git a/OvaleFuture.lua b/OvaleFuture.lua
index aca9565..79e9749 100644
--- a/OvaleFuture.lua
+++ b/OvaleFuture.lua
@@ -96,6 +96,29 @@ local function ScoreSpell(spellId)
end
end
+-- Return the spell-specific damage multiplier using the information from SpellDamage{Buff,Debuff} declarations.
+-- This doesn't include the base damage multiplier of the character.
+local function GetDamageMultiplier(spellId)
+ local damageMultiplier = 1
+ if spellId then
+ local si = OvaleData.spellInfo[spellId]
+ if si and si.damageAura then
+ local playerGUID = OvaleGUID:GetGUID("player")
+ for filter, auraList in pairs(si.damageAura) do
+ for auraSpellId, multiplier in pairs(auraList) do
+ local count = select(3, OvaleAura:GetAuraByGUID(playerGUID, auraSpellId, filter, nil, "player"))
+ if count and count > 0 then
+ -- TODO: Try to account for a stacking aura.
+ -- multiplier = 1 + (multiplier - 1) * count
+ damageMultiplier = damageMultiplier * multiplier
+ end
+ end
+ end
+ end
+ end
+ return damageMultiplier
+end
+
local function AddSpellToQueue(spellId, lineId, startTime, endTime, channeled, allowRemove)
local self = OvaleFuture
local spellcast = self_pool:Get()
@@ -117,7 +140,7 @@ local function AddSpellToQueue(spellId, lineId, startTime, endTime, channeled, a
-- Snapshot the current stats for the spellcast.
OvalePaperDoll:SnapshotStats(spellcast)
- spellcast.damageMultiplier = OvaleAura:GetDamageMultiplier(spellId)
+ spellcast.damageMultiplier = GetDamageMultiplier(spellId)
local si = OvaleData.spellInfo[spellId]
if si then
@@ -207,7 +230,7 @@ local function UpdateLastSpellInfo(spellcast)
if self_timeAuraAdded then
if self_timeAuraAdded >= spellcast.start and self_timeAuraAdded - spellcast.stop < 1 then
OvalePaperDoll:SnapshotStats(spellcast)
- spellcast.damageMultiplier = OvaleAura:GetDamageMultiplier(spellId)
+ spellcast.damageMultiplier = GetDamageMultiplier(spellId)
TracePrintf(spellId, " Updated spell info for %s (%d) to snapshot from %f.",
OvaleData:GetSpellName(spellId), spellId, spellcast.snapshotTime)
end
@@ -348,7 +371,7 @@ function OvaleFuture:UNIT_SPELLCAST_SUCCEEDED(event, unit, name, rank, lineId, s
spellcast.allowRemove = true
-- Take a more recent snapshot of the player stats for this cast-time spell.
OvalePaperDoll:SnapshotStats(spellcast)
- spellcast.damageMultiplier = OvaleAura:GetDamageMultiplier(spellId)
+ spellcast.damageMultiplier = GetDamageMultiplier(spellId)
return
end
end
diff --git a/OvalePaperDoll.lua b/OvalePaperDoll.lua
index e93ad35..53fb305 100644
--- a/OvalePaperDoll.lua
+++ b/OvalePaperDoll.lua
@@ -94,7 +94,7 @@ local OVALE_SNAPSHOT_STATS = {
-- normalized weapon damage of mainhand and offhand weapons
mainHandWeaponDamage = "normalized weapon damage (mainhand)",
offHandWeaponDamage = "normalized weapon damage (offhand)",
- damageMultiplier = "damage multiplier",
+ baseDamageMultiplier = "base damage multiplier",
}
--</private-static-properties>
@@ -122,7 +122,7 @@ local function GetSnapshot(t)
for k in pairs(OVALE_SNAPSHOT_STATS) do
newStat[k] = 0
end
- newStat.damageMultiplier = 1
+ newStat.baseDamageMultiplier = 1
end
newStat.snapshotTime = Ovale.now
self_snapshot:InsertFront(newStat)
@@ -301,7 +301,7 @@ function OvalePaperDoll:UpdateDamage(event)
local mainHandAttackSpeed, offHandAttackSpeed = API_UnitAttackSpeed("player")
self.stat = GetSnapshot(Ovale.now)
- self.stat.damageMultiplier = damageMultiplier
+ self.stat.baseDamageMultiplier = damageMultiplier
if self.class == "DRUID" and OvaleStance:IsStance("druid_cat_form") then
-- Cat Form: 100% increased auto-attack damage.
damageMultiplier = damageMultiplier * 2
@@ -347,7 +347,7 @@ function OvalePaperDoll:UpdateDamage(event)
end
Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, "%s @ %f", event, Ovale.now)
- Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f", OVALE_SNAPSHOT_STATS.damageMultiplier, self.stat.damageMultiplier)
+ Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f", OVALE_SNAPSHOT_STATS.baseDamageMultiplier, self.stat.baseDamageMultiplier)
Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f", OVALE_SNAPSHOT_STATS.mainHandWeaponDamage, self.stat.mainHandWeaponDamage)
Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f", OVALE_SNAPSHOT_STATS.offHandWeaponDamage, self.stat.offHandWeaponDamage)
end
@@ -436,7 +436,7 @@ function OvalePaperDoll:Debug(stat)
Ovale:FormatPrint("%s: %f%%", OVALE_SNAPSHOT_STATS.rangedCrit, stat.rangedCrit)
Ovale:FormatPrint("%s: %f%%", OVALE_SNAPSHOT_STATS.rangedHaste, stat.rangedHaste)
Ovale:FormatPrint("%s: %f%%", OVALE_SNAPSHOT_STATS.masteryEffect, stat.masteryEffect)
- Ovale:FormatPrint("%s: %f", OVALE_SNAPSHOT_STATS.damageMultiplier, stat.damageMultiplier)
+ Ovale:FormatPrint("%s: %f", OVALE_SNAPSHOT_STATS.baseDamageMultiplier, stat.baseDamageMultiplier)
Ovale:FormatPrint("%s: %f", OVALE_SNAPSHOT_STATS.mainHandWeaponDamage, stat.mainHandWeaponDamage)
Ovale:FormatPrint("%s: %f", OVALE_SNAPSHOT_STATS.offHandWeaponDamage, stat.offHandWeaponDamage)
end
diff --git a/OvaleState.lua b/OvaleState.lua
index 75f1467..edba394 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -656,17 +656,16 @@ function OvaleState:NewAura(guid, spellId, filter)
end
function OvaleState:GetDamageMultiplier(spellId)
- local damageMultiplier = OvalePaperDoll.stat.damageMultiplier
+ local damageMultiplier = OvalePaperDoll.stat.baseDamageMultiplier
if spellId then
local si = OvaleData.spellInfo[spellId]
if si and si.damageAura then
local playerGUID = OvaleGUID:GetGUID("player")
- local count
for filter, auraList in pairs(si.damageAura) do
for auraSpellId, multiplier in pairs(auraList) do
- count = select(3, self:GetAuraByGUID(playerGUID, auraSpellId, filter, nil, "player"))
+ local count = select(3, self:GetAuraByGUID(playerGUID, auraSpellId, filter, nil, "player"))
if count and count > 0 then
- -- Try to account for a stacking aura.
+ -- TODO: Try to account for a stacking aura.
-- multiplier = 1 + (multiplier - 1) * count
damageMultiplier = damageMultiplier * multiplier
end