27 lines
1.0 KiB
Lua
27 lines
1.0 KiB
Lua
function()
|
|
local AP = UnitPower("player") --Get astral power and max power
|
|
local maxAP = UnitPowerMax("player")
|
|
local APgains = --Define AP gained by spells
|
|
{
|
|
["New Moon"] = 10,
|
|
["Half Moon"] = 20,
|
|
["Full Moon"] = 40,
|
|
["Lunar Strike"] = 12,
|
|
["Solar Wrath"] = 8
|
|
}
|
|
local buff = UnitBuff("player", "Blessing of Elune") --Find 25% increase if present
|
|
local casting = UnitCastingInfo("player") --Get spell currently being cast if any
|
|
if casting then --If there's a spell being cast
|
|
local plusAP = AP + APgains[casting] --Add AP gained by spell currently cast to current AP to "predict" AP
|
|
if buff then
|
|
if casting == "Lunar Strike" or casting == "Solar Wrath" then --If either spell affected by buff is being cast add 25% to it's ap gained
|
|
local plusAP = AP + APgains[casting]
|
|
plusAP = math.floor(plusAP + APgains[casting] * 0.25) --Get the 25% of 8 or 12 and add it to 8 or 12
|
|
end
|
|
end
|
|
return maxAP - plusAP, maxAP, 1
|
|
end
|
|
if not casting then
|
|
return maxAP - AP, maxAP, 1
|
|
end
|
|
end |