Johnny C. Lam [09-18-12 - 00:03]
diff --git a/OvaleCondition.lua b/OvaleCondition.lua
index 570a5dc..38e0898 100644
--- a/OvaleCondition.lua
+++ b/OvaleCondition.lua
@@ -677,46 +677,15 @@ OvaleCondition.conditions=
-- 1: spell id
-- returns: number
damage = function(condition)
- local spellInfo = OvaleData:GetSpellInfo(condition[1])
- if not spellInfo then
- return nil
- end
- local ret = (spellInfo.base or 0)
- if spellInfo.bonuscp then
- ret = ret + (OvaleState.state.combo * spellInfo.bonuscp)
- end
- if spellInfo.bonusholy then
- ret = ret + (OvaleState.state.holy * spellInfo.bonusholy)
- end
- if spellInfo.bonusap then
- ret = ret + spellInfo.bonusap * UnitAttackPower("player")
- end
- if spellInfo.bonusapcp then
- ret = ret + spellInfo.bonusapcp * UnitAttackPower("player") * OvaleState.state.combo
- end
- if spellInfo.bonusapholy then
- ret = ret + spellInfo.bonusapholy * UnitAttackPower("player") * OvaleState.state.holy
- end
- if spellInfo.bonussp then
- ret = ret + spellInfo.bonussp * GetSpellBonusDamage(2)
- end
- if spellInfo.bonusspholy then
- ret = ret + spellInfo.bonusspholy * GetSpellBonusDamage(2) * OvaleState.state.holy
- end
- return 0, nil, ret * OvaleAura:GetDamageMultiplier(condition[1]), 0, 0
+ local spellId = condition[1]
+ local ret = OvaleData:GetDamage(spellId, OvaleState.state.combo, UnitAttackPower("player"), GetSpellBonusDamage(2))
+ return 0, nil, ret * OvaleAura:GetDamageMultiplier(spellId), 0, 0
end,
-- Get the current damage multiplier
-- TODO: use OvaleState
-- returns: number
damagemultiplier = function(condition)
- local ret = OvaleAura:GetDamageMultiplier(condition[1])
- if condition[1] then
- local si = OvaleData:GetSpellInfo(condition[1])
- if si and si.combo == 0 then
- ret = ret * OvaleState.state.combo
- end
- end
- return 0, nil, ret, 0, 0
+ return 0, nil, OvaleAura:GetDamageMultiplier(condition[1]), 0, 0
end,
-- Get the remaining time until the target is dead
-- returns: bool or number
@@ -897,6 +866,14 @@ OvaleCondition.conditions=
end
return compare(OvaleSpellDamage:Get(spellId), condition[2], condition[3])
end,
+ -- Get the last spell estimated damage
+ -- 1: spell id
+ -- returns: number
+ lastspellestimateddamage = function(condition)
+ local spellId = condition[1]
+ local ret = OvaleData:GetDamage(spellId, OvaleFuture.lastSpellCombo[spellId], OvaleFuture.lastSpellAP[spellId], OvaleFuture.lastSpellSP[spellId])
+ return 0, nil, ret * (OvaleFuture.lastSpellDM[spellId] or 0), 0, 0
+ end,
-- Get the last spell damage multiplier
-- 1: the spell id
-- returns: number or bool
@@ -915,6 +892,12 @@ OvaleCondition.conditions=
lastspellspellpower = function(condition)
return compare(OvaleFuture.lastSpellSP[condition[1]], condition[2], condition[3])
end,
+ -- Get the number of combo points consumed by the last spell
+ -- 1: the spell id
+ -- returns: number or bool
+ lastspellcombopoints = function(condition)
+ return compare(OvaleFuture.lastSpellCombo[condition[1]], condition[2], condition[3])
+ end,
-- Get the last spell mastery
-- 1: the spell id
-- returns: number or bool
diff --git a/OvaleData.lua b/OvaleData.lua
index 98d959e..629384a 100644
--- a/OvaleData.lua
+++ b/OvaleData.lua
@@ -450,4 +450,29 @@ function OvaleData:GetComputedSpellCD(spellId)
end
return actionCooldownStart, actionCooldownDuration, actionEnable
end
+
+--Compute the damage of the given spell.
+function OvaleData:GetDamage(spellId, combo, attackPower, spellpower)
+ local si = self.spellInfo[spellId]
+ if not si then
+ return nil
+ end
+ combo = combo or 0
+ attackPower = attackPower or 0
+ spellpower = spellpower or 0
+ local ret = si.base or 0
+ if si.bonuscp then
+ ret = ret + si.bonuscp * combo
+ end
+ if si.bonusap then
+ ret = ret + si.bonusap * attackPower
+ end
+ if si.bonusapcp then
+ ret = ret + si.bonusapcp * attackPower * combo
+ end
+ if si.bonussp then
+ ret = ret + si.bonussp * spellpower
+ end
+ return ret
+end
--</public-static-methods>
diff --git a/OvaleFuture.lua b/OvaleFuture.lua
index 472af71..f0bb7a1 100644
--- a/OvaleFuture.lua
+++ b/OvaleFuture.lua
@@ -13,6 +13,7 @@ OvaleFuture.lastSpellId = nil
OvaleFuture.lastSpellAP = {}
OvaleFuture.lastSpellSP = {}
OvaleFuture.lastSpellDM = {}
+OvaleFuture.lastSpellCombo = {}
OvaleFuture.lastSpellMastery = {}
OvaleFuture.playerGUID = nil
OvaleFuture.nextSpellTarget = nil
@@ -226,12 +227,11 @@ function OvaleFuture:AddSpellToList(spellId, lineId, startTime, endTime, channel
if si then
if si.combo == 0 then
local comboPoints = GetComboPoints("player")
- --Ovale:Print("combo point " .. comboPoints)
if comboPoints > 0 then
- self.lastSpellDM[spellId] = self.lastSpellDM[spellId] * comboPoints
+ self.lastSpellCombo[spellId] = comboPoints
end
end
-
+
if si.aura then
for target, targetInfo in pairs(si.aura) do
for filter, filterInfo in pairs(targetInfo) do
@@ -249,7 +249,7 @@ function OvaleFuture:AddSpellToList(spellId, lineId, startTime, endTime, channel
end
--Ovale:Print("spellInfo found")
- if si and si.buffnocd and UnitBuff("player", GetSpellInfo(si.buffnocd)) then
+ if si.buffnocd and UnitBuff("player", GetSpellInfo(si.buffnocd)) then
newSpell.nocd = true
else
newSpell.nocd = false