Basic rotations that work
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OkRotations/DiscPriest.lua

295 lines
9.8 KiB

local Tinkr, Bastion = ...
local DiscPriestModule = Bastion.Module:New('DiscPriest')
local Player = Bastion.UnitManager:Get('player')
local Target = Bastion.UnitManager:Get('target')
-- Initialize SpellBook
local SpellBook = Bastion.SpellBook:New()
-- Spells
local PowerWordShield = SpellBook:GetSpell(17)
local PurgeTheWicked = SpellBook:GetSpell(204197)
local Penance = SpellBook:GetSpell(47540)
local PowerWordRadiance = SpellBook:GetSpell(194509)
local Shadowfiend = SpellBook:GetSpell(34433)
local Mindbender = SpellBook:GetSpell(123040)
local Rapture = SpellBook:GetSpell(47536)
local PainSuppression = SpellBook:GetSpell(33206)
local PowerWordBarrier = SpellBook:GetSpell(62618)
local Schism = SpellBook:GetSpell(214621)
local ShadowCovenant = SpellBook:GetSpell(314867)
local MindBlast = SpellBook:GetSpell(8092)
local ShadowWordDeath = SpellBook:GetSpell(32379)
local Smite = SpellBook:GetSpell(585)
local FlashHeal = SpellBook:GetSpell(2061)
local Renew = SpellBook:GetSpell(139)
local Fade = SpellBook:GetSpell(586)
local DesperatePrayer = SpellBook:GetSpell(19236)
local VoidwraithTalent = SpellBook:GetSpell(406786)
local Voidwraith = SpellBook:GetSpell(406786)
-- Buffs and Debuffs
local Atonement = SpellBook:GetSpell(194384)
local PurgeTheWickedDebuff = SpellBook:GetSpell(204213)
local PowerOfTheDarkSide = SpellBook:GetSpell(198068)
local ShadowCovenantBuff = SpellBook:GetSpell(322105)
local WeakenedSoul = SpellBook:GetSpell(6788)
-- Custom Units
local Lowest = Bastion.UnitManager:CreateCustomUnit('lowest', function(unit)
local lowest = nil
local lowestHP = math.huge
Bastion.UnitManager:EnumFriends(function(unit)
if unit:IsDead() or Player:GetDistance(unit) > 40 or not Player:CanSee(unit) then
return false
end
local hp = unit:GetHP()
if hp < lowestHP then
lowest = unit
lowestHP = hp
end
end)
return lowest or Player
end)
local Tank = Bastion.UnitManager:CreateCustomUnit('tank', function(unit)
local tank = nil
Bastion.UnitManager:EnumFriends(function(unit)
if Player:GetDistance(unit) > 40 or not Player:CanSee(unit) or unit:IsDead() then
return false
end
if unit:IsTank() then
tank = unit
return true
end
end)
return tank or Player
end)
local AtoneTarget = Bastion.UnitManager:CreateCustomUnit('atonetarget', function(unit)
local target = nil
local lowestAtonementTime = math.huge
Bastion.UnitManager:EnumFriends(function(unit)
if unit:IsDead() or Player:GetDistance(unit) > 40 or not Player:CanSee(unit) then
return false
end
local atonementBuff = unit:GetAuras():FindMy(Atonement)
if not atonementBuff:IsUp() then
target = unit
return true
elseif atonementBuff:GetRemainingTime() < lowestAtonementTime then
target = unit
lowestAtonementTime = atonementBuff:GetRemainingTime()
end
end)
return target or Player
end)
local PurgeTheWickedTarget = Bastion.UnitManager:CreateCustomUnit('purgethewickedtarget', function(unit)
local target = nil
Bastion.UnitManager:EnumEnemies(function(unit)
if unit:IsAffectingCombat() and Player:IsWithinCombatDistance(unit, 40) and Player:CanSee(unit) then
local aura = unit:GetAuras():FindMy(PurgeTheWickedDebuff)
if not aura:IsUp() then
target = unit
return true
end
end
end)
return target or Target
end)
-- APLs
local DefaultAPL = Bastion.APL:New('default')
local CooldownAPL = Bastion.APL:New('cooldown')
local DefensiveAPL = Bastion.APL:New('defensive')
local DpsAPL = Bastion.APL:New('dps')
-- Helper Functions
local function ShouldUseRadiance()
local countWithoutAtonement = 0
Bastion.UnitManager:EnumFriends(function(unit)
if not unit:IsDead() and Player:GetDistance(unit) <= 40 and Player:CanSee(unit) and not unit:GetAuras():FindMy(Atonement):IsUp() then
countWithoutAtonement = countWithoutAtonement + 1
end
end)
return countWithoutAtonement >= 3
end
-- Default APL
DefaultAPL:AddSpell(
PowerWordShield:CastableIf(function(self)
return AtoneTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and not AtoneTarget:GetAuras():FindMy(PowerWordShield):IsUp()
and not AtoneTarget:GetAuras():FindMy(WeakenedSoul):IsUp()
end):SetTarget(AtoneTarget)
)
DefaultAPL:AddSpell(
PowerWordRadiance:CastableIf(function(self)
return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and ShouldUseRadiance()
end):SetTarget(Player)
)
DefaultAPL:AddSpell(
Renew:CastableIf(function(self)
return Lowest:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Lowest:GetHP() < 90 and not Lowest:GetAuras():FindMy(Renew):IsUp()
end):SetTarget(Lowest)
)
DefaultAPL:AddSpell(
FlashHeal:CastableIf(function(self)
return Lowest:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Lowest:GetHP() < 70 and not Lowest:GetAuras():FindMy(Atonement):IsUp()
end):SetTarget(Lowest)
)
-- Cooldown APL
CooldownAPL:AddSpell(
Rapture:CastableIf(function(self)
return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Player:GetPartyHPAround(40, 75) >= 3
end):SetTarget(Player)
)
CooldownAPL:AddSpell(
PowerWordBarrier:CastableIf(function(self)
return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Player:GetPartyHPAround(40, 70) >= 3
end):SetTarget(Player)
)
CooldownAPL:AddSpell(
ShadowCovenant:CastableIf(function(self)
return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Player:GetPartyHPAround(40, 80) >= 3
end):SetTarget(Player)
)
CooldownAPL:AddSpell(
Shadowfiend:CastableIf(function(self)
return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and not VoidwraithTalent:IsKnownAndUsable()
end):SetTarget(Target)
)
CooldownAPL:AddSpell(
Voidwraith:CastableIf(function(self)
return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
end):SetTarget(Target)
)
-- Defensive APL
DefensiveAPL:AddSpell(
Fade:CastableIf(function(self)
return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Player:GetHP() < 90
end):SetTarget(Player)
)
DefensiveAPL:AddSpell(
DesperatePrayer:CastableIf(function(self)
return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Player:GetHP() < 50
end):SetTarget(Player)
)
DefensiveAPL:AddSpell(
PainSuppression:CastableIf(function(self)
return Tank:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Tank:GetHP() < 40
end):SetTarget(Tank)
)
-- DPS APL
DpsAPL:AddSpell(
PurgeTheWicked:CastableIf(function(self)
return PurgeTheWickedTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and not PurgeTheWickedTarget:GetAuras():FindMy(PurgeTheWickedDebuff):IsUp()
and Player:IsWithinCombatDistance(PurgeTheWickedTarget, 40)
end):SetTarget(PurgeTheWickedTarget)
)
DpsAPL:AddSpell(
Schism:CastableIf(function(self)
return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Player:IsWithinCombatDistance(Target, 40)
end):SetTarget(Target)
)
DpsAPL:AddSpell(
Penance:CastableIf(function(self)
return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Player:IsWithinCombatDistance(Target, 40)
end):SetTarget(Target)
)
DpsAPL:AddSpell(
MindBlast:CastableIf(function(self)
return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Player:IsWithinCombatDistance(Target, 40)
end):SetTarget(Target)
)
DpsAPL:AddSpell(
ShadowWordDeath:CastableIf(function(self)
return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Target:GetHP() < 20 and Player:IsWithinCombatDistance(Target, 40)
end):SetTarget(Target)
)
DpsAPL:AddSpell(
Smite:CastableIf(function(self)
return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Player:IsWithinCombatDistance(Target, 40)
end):SetTarget(Target)
)
-- Module Sync
DiscPriestModule:Sync(function()
if Player:IsMounted() then
return
end
DefensiveAPL:Execute()
if Player:IsAffectingCombat() then
CooldownAPL:Execute()
DefaultAPL:Execute()
DpsAPL:Execute()
else
-- Out of combat healing and preparation
if AtoneTarget:Exists() and not AtoneTarget:GetAuras():FindMy(Atonement):IsUp() then
if not AtoneTarget:GetAuras():FindMy(PowerWordShield):IsUp() and not AtoneTarget:GetAuras():FindMy(WeakenedSoul):IsUp() then
PowerWordShield:Cast(AtoneTarget)
elseif AtoneTarget:GetHP() < 90 and not AtoneTarget:GetAuras():FindMy(Renew):IsUp() then
Renew:Cast(AtoneTarget)
elseif AtoneTarget:GetHP() < 80 then
FlashHeal:Cast(AtoneTarget)
end
end
-- Apply Purge the Wicked to main target if not in combat and about to pull
if Target:Exists() and Target:IsEnemy() and PurgeTheWicked:IsKnownAndUsable() and not Player:IsCastingOrChanneling() then
if not Target:GetAuras():FindMy(PurgeTheWickedDebuff):IsUp() and Player:IsWithinCombatDistance(Target, 40) then
PurgeTheWicked:Cast(Target)
end
end
end
end)
Bastion:Register(DiscPriestModule)