Aura emmy lua doc

main
4n0n 2 years ago
parent acf0b82ea3
commit 1ce1d193e1
  1. 40
      src/Aura/Aura.lua

@ -1,3 +1,5 @@
-- Document with emmy lua: https://emmylua.github.io/
local Tinkr, Bastion = ...
-- Create a new Aura class
@ -19,6 +21,8 @@ function Aura:__index(k)
end
-- Equals
---@param other Aura|Spell
---@return boolean
function Aura:__eq(other)
if getmetatable(other) == Aura then
return self:GetSpell():GetID() == other:GetSpell():GetID()
@ -31,11 +35,16 @@ function Aura:__eq(other)
return false
end
-- tostring
---@return string
function Aura:__tostring()
return "Bastion.__Aura(" .. self:GetSpell():GetID() .. ")" .. " - " .. (self:GetName() or "''")
end
-- Constructor
---@param unit Unit
---@param index number
---@param type string
function Aura:New(unit, index, type)
if unit == nil then
local self = setmetatable({}, Aura)
@ -68,7 +77,8 @@ function Aura:New(unit, index, type)
end
local name, icon, count, dispelType, duration, expirationTime, source, isStealable, nameplateShowPersonal,
spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod = UnitAura(unit:GetOMToken(), index, type)
spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod = UnitAura(unit:GetOMToken(), index,
type)
local self = setmetatable({}, Aura)
self.aura = {
@ -98,6 +108,9 @@ function Aura:New(unit, index, type)
return self
end
-- Constructor
---@param unitAuraInfo UnitAuraInfo
---@return Aura
function Aura:CreateFromUnitAuraInfo(unitAuraInfo)
local self = setmetatable({}, Aura)
self.aura = {
@ -128,56 +141,67 @@ function Aura:CreateFromUnitAuraInfo(unitAuraInfo)
end
-- Check if the aura is valid
---@return boolean
function Aura:IsValid()
return self.aura.name ~= nil
end
-- Check if the aura is up
---@return boolean
function Aura:IsUp()
return self:IsValid() and (self:GetDuration() == 0 or self:GetRemainingTime() > 0)
end
-- Check if the aura is down
---@return boolean
function Aura:IsDown()
return not self:IsUp()
end
-- Get the auras index
---@return number
function Aura:GetIndex()
return self.aura.index
end
-- Get the auras type
---@return string
function Aura:GetType()
return self.aura.type
end
-- Get the auras name
---@return string
function Aura:GetName()
return self.aura.name
end
-- Get the auras icon
---@return string
function Aura:GetIcon()
return self.aura.icon
end
-- Get the auras count
---@return number
function Aura:GetCount()
return self.aura.count
end
-- Get the auras dispel type
---@return string
function Aura:GetDispelType()
return self.aura.dispelType
end
-- Get the auras duration
---@return number
function Aura:GetDuration()
return self.aura.duration
end
-- Get the auras remaining time
---@return number
function Aura:GetRemainingTime()
local remainingTime = self.aura.expirationTime - GetTime()
@ -189,71 +213,85 @@ function Aura:GetRemainingTime()
end
-- Get the auras expiration time
---@return number
function Aura:GetExpirationTime()
return self.aura.expirationTime
end
-- Get the auras source
---@return Unit
function Aura:GetSource()
return Bastion.UnitManager[self.aura.source]
end
-- Get the auras stealable status
---@return boolean
function Aura:GetIsStealable()
return self.aura.isStealable
end
-- Get the auras nameplate show personal status
---@return boolean
function Aura:GetNameplateShowPersonal()
return self.aura.nameplateShowPersonal
end
-- Get the auras spell id
---@return Spell
function Aura:GetSpell()
return Bastion.SpellBook:GetSpell(self.aura.spellId)
end
-- Get the auras can apply aura status
---@return boolean
function Aura:GetCanApplyAura()
return self.aura.canApplyAura
end
-- Get the auras is boss debuff status
---@return boolean
function Aura:GetIsBossDebuff()
return self.aura.isBossDebuff
end
-- Get the auras cast by player status
---@return boolean
function Aura:GetCastByPlayer()
return self.aura.castByPlayer
end
-- Get the auras nameplate show all status
---@return boolean
function Aura:GetNameplateShowAll()
return self.aura.nameplateShowAll
end
-- Get the auras time mod
---@return number
function Aura:GetTimeMod()
return self.aura.timeMod
end
-- Check if the aura is a buff
---@return boolean
function Aura:IsBuff()
return self.aura.type == "HELPFUL"
end
-- Check if the aura is a debuff
---@return boolean
function Aura:IsDebuff()
return self.aura.type == "HARMFUL"
end
-- Get aura instance id
---@return number
function Aura:GetAuraInstanceID()
return self.aura.auraInstanceID
end
-- Check if the aura is dispelable by a spell
---@param spell Spell
function Aura:IsDispelableBySpell(spell)
if self:GetDispelType() == nil then
return false

Loading…
Cancel
Save