Bastion aims to serve as a highly performant, simplisitic, and expandable World of Warcraft data visualization framework.
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.
Bastion/references/paladin/shared/hammer-of-wrath.lua

69 lines
1.6 KiB

local Tinkr, _Bastion = ...
---@type Bastion
local Bastion = _Bastion
local Player = Bastion.UnitManager:Get('player')
local Target = Bastion.UnitManager:Get('target')
local None = Bastion.UnitManager:Get('none')
local _HammerOfWrath = Bastion.SpellBook:GetSpell(24275)
local AvengingWrath = Bastion.SpellBook:GetSpell(389539)
local HammerOfWrathTarget = Bastion.UnitManager:CreateCustomUnit('hammerofwrath', function()
if not _HammerOfWrath:IsKnownAndUsable() then return None end
if Player:GetAuras():FindMy(AvengingWrath):IsUp() and _HammerOfWrath:IsKnownAndUsable() and Target:Exists() and Target:IsEnemy() and Target:IsAffectingCombat() and _HammerOfWrath:IsInRange(Target) then
return Target
end
local how = nil
Bastion.UnitManager:EnumEnemies(function(unit)
if unit:IsDead() then
return false
end
if not Player:CanSee(unit) then
return false
end
if not Player:IsFacing(unit) then
return false
end
if not _HammerOfWrath:IsInRange(unit) then
return false
end
if Player:GetAuras():FindMy(AvengingWrath):IsUp() then
how = unit
return true
end
if unit:GetHealthPercent() <= 20 then
how = unit
return true
end
return false
end)
if how == nil then
how = None
end
return how
end)
---@alias HammerOfWrath fun():boolean
---@type HammerOfWrath
function HammerOfWrath()
if HammerOfWrathTarget:Exists() and not Player:IsCastingOrChanneling() then
return _HammerOfWrath:Cast(HammerOfWrathTarget)
end
return false
end
return HammerOfWrath