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.
147 lines
4.3 KiB
147 lines
4.3 KiB
5 months ago
|
local Tinkr, Bastion = ...
|
||
|
local ProtWarriorModule = Bastion.Module:New('ProtWarrior')
|
||
|
local Player = Bastion.UnitManager:Get('player')
|
||
|
local Target = Bastion.UnitManager:Get('target')
|
||
|
local SpellBook = Bastion.SpellBook:New()
|
||
|
|
||
|
-- Power type for Rage
|
||
|
local RAGE_POWER_TYPE = 1
|
||
|
|
||
|
-- Spells
|
||
|
local ShieldSlam = SpellBook:GetSpell(23922)
|
||
|
local ThunderClap = SpellBook:GetSpell(6343)
|
||
|
local Revenge = SpellBook:GetSpell(6572)
|
||
|
local IgnorePain = SpellBook:GetSpell(190456)
|
||
|
local ShieldBlock = SpellBook:GetSpell(2565)
|
||
|
local DemoralizingShout = SpellBook:GetSpell(1160)
|
||
|
local Avatar = SpellBook:GetSpell(401150)
|
||
|
local Ravager = SpellBook:GetSpell(228920)
|
||
|
local ShieldCharge = SpellBook:GetSpell(385952)
|
||
|
local HeroicThrow = SpellBook:GetSpell(57755)
|
||
|
local Taunt = SpellBook:GetSpell(355)
|
||
|
local Shockwave = SpellBook:GetSpell(46968)
|
||
|
local BattleShout = SpellBook:GetSpell(6673)
|
||
|
|
||
|
-- Buffs
|
||
|
local ShieldBlockBuff = SpellBook:GetSpell(132404)
|
||
|
local AvatarBuff = SpellBook:GetSpell(401150)
|
||
|
local BattleShoutBuff = SpellBook:GetSpell(6673)
|
||
|
|
||
|
-- Create APLs
|
||
|
local DefaultAPL = Bastion.APL:New('default')
|
||
|
local CooldownAPL = Bastion.APL:New('cooldown')
|
||
|
local DefensiveAPL = Bastion.APL:New('defensive')
|
||
|
local UtilityAPL = Bastion.APL:New('utility')
|
||
|
|
||
|
-- Utility APL
|
||
|
UtilityAPL:AddSpell(
|
||
|
BattleShout:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable() and not Player:GetAuras():FindMy(BattleShoutBuff):IsUp()
|
||
|
end):SetTarget(Player)
|
||
|
)
|
||
|
|
||
|
UtilityAPL:AddSpell(
|
||
|
HeroicThrow:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable() and Target:Exists() and not Player:InMelee(Target)
|
||
|
end):SetTarget(Target)
|
||
|
)
|
||
|
|
||
|
-- Cooldown APL
|
||
|
CooldownAPL:AddSpell(
|
||
|
Avatar:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable() and not Player:GetAuras():FindMy(AvatarBuff):IsUp() and Player:GetEnemies(8) > 2
|
||
|
end):SetTarget(Player)
|
||
|
)
|
||
|
|
||
|
CooldownAPL:AddSpell(
|
||
|
Ravager:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable() and Player:GetEnemies(8) > 2
|
||
|
end):SetTarget(Player)
|
||
|
)
|
||
|
|
||
|
CooldownAPL:AddSpell(
|
||
|
DemoralizingShout:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable() and Player:GetEnemies(8) > 2
|
||
|
end):SetTarget(Player)
|
||
|
)
|
||
|
|
||
|
-- Defensive APL
|
||
|
DefensiveAPL:AddSpell(
|
||
|
ShieldBlock:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable() and not Player:GetAuras():FindMy(ShieldBlockBuff):IsUp() and Player:GetPower(RAGE_POWER_TYPE) >= 30
|
||
|
end):SetTarget(Player)
|
||
|
)
|
||
|
|
||
|
DefensiveAPL:AddSpell(
|
||
|
IgnorePain:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable() and Player:GetPower(RAGE_POWER_TYPE) >= 40 and Player:GetHP() <= 80
|
||
|
end):SetTarget(Player)
|
||
|
)
|
||
|
|
||
|
-- Default APL
|
||
|
DefaultAPL:AddSpell(
|
||
|
ShieldCharge:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable() and Target:Exists() and Player:GetDistance(Target) <= 25
|
||
|
end):SetTarget(Target)
|
||
|
)
|
||
|
|
||
|
DefaultAPL:AddSpell(
|
||
|
ShieldSlam:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable()
|
||
|
end):SetTarget(Target)
|
||
|
)
|
||
|
|
||
|
DefaultAPL:AddSpell(
|
||
|
ThunderClap:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable()
|
||
|
end):SetTarget(Target)
|
||
|
)
|
||
|
|
||
|
DefaultAPL:AddSpell(
|
||
|
Revenge:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable() and Player:GetPower(RAGE_POWER_TYPE) >= 20
|
||
|
end):SetTarget(Target)
|
||
|
)
|
||
|
|
||
|
-- Interrupt APL
|
||
|
local InterruptAPL = Bastion.APL:New('interrupt')
|
||
|
|
||
|
InterruptAPL:AddSpell(
|
||
|
Shockwave:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable() and Target:IsCasting() and not Target:IsInterruptible() and Player:InMelee(Target)
|
||
|
end):SetTarget(Target)
|
||
|
)
|
||
|
|
||
|
InterruptAPL:AddSpell(
|
||
|
Taunt:CastableIf(function(self)
|
||
|
return self:IsKnownAndUsable() and not Player:IsTanking(Target) and Target:Exists()
|
||
|
end):SetTarget(Target)
|
||
|
)
|
||
|
|
||
|
-- Rage Management
|
||
|
local function ManageRage()
|
||
|
if Player:GetPower(RAGE_POWER_TYPE) >= 80 then
|
||
|
if not Player:GetAuras():FindMy(ShieldBlockBuff):IsUp() then
|
||
|
ShieldBlock:Cast(Player)
|
||
|
elseif Player:GetHP() <= 90 then
|
||
|
IgnorePain:Cast(Player)
|
||
|
else
|
||
|
Revenge:Cast(Target)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
ProtWarriorModule:Sync(function()
|
||
|
if not Player:IsAffectingCombat() then
|
||
|
UtilityAPL:Execute()
|
||
|
return
|
||
|
end
|
||
|
|
||
|
ManageRage()
|
||
|
InterruptAPL:Execute()
|
||
|
DefensiveAPL:Execute()
|
||
|
CooldownAPL:Execute()
|
||
|
DefaultAPL:Execute()
|
||
|
end)
|
||
|
|
||
|
Bastion:Register(ProtWarriorModule)
|