4n0n bug fixes and dispel updates

4n0n updates to unit.lua
added spell list to curse/magic/poison/disease checks
main
Ofrex 2 years ago
parent 42403b6395
commit 3501714102
  1. 43
      src/Spell/Spell.lua
  2. 17
      src/Unit/Unit.lua

@ -7,6 +7,7 @@ local Spell = {
PreCastFunc = false,
OnCastFunc = false,
PostCastFunc = false,
lastCastAttempt = 0,
wasLooking = false,
lastCastAt = 0,
conditions = {},
@ -305,6 +306,15 @@ function Spell:GetTimeSinceLastCast()
return GetTime() - self:GetLastCastTime()
end
-- Get the time since the last cast attempt
---@return number
function Spell:GetTimeSinceLastCastAttempt()
if not self.lastCastAttempt then
return math.huge
end
return GetTime() - self.lastCastAttempt
end
-- Get the spells charges
---@return number
function Spell:GetCharges()
@ -404,7 +414,19 @@ end
---@return boolean
function Spell:IsMagicDispel()
return ({
[88423] = true
[88423] = true, -- Druid - Natures Cure
[115310] = true, -- Monk - Revival
[77130] = true, -- Shaman - Purify Spirit
[383016] = true, -- Shaman - Improved Purify Spirit
[115450] = true, -- Monk - Detox
[388874] = true, -- Monk - Improved Detox
[4987] = true, -- Paladin - Cleanse
[393024] = true, -- Paladin - Improved Cleanse
[527] = true, -- Priest - Purify
[390632] = true, -- Priest - Improved Purify
[89808] = true, -- Warlock - Singe Magic - Imp Spell
[278326] = true, -- Demon Hunter - Consume Magic
[393278] = true -- Druid - Improved Natures Cure
})[self:GetID()]
end
@ -412,7 +434,11 @@ end
---@return boolean
function Spell:IsCurseDispel()
return ({
[88423] = true
[393278] = true, -- Druid - Improved Natures Cure
[2782] = true, -- Druid - Remove Corruption
[475] = true, -- Mage - Remove Curse
[383016] = true, -- Shaman - Improved Purify Spirit
[51886] = true -- Shaman - Cleanse Spirit
})[self:GetID()]
end
@ -420,7 +446,11 @@ end
---@return boolean
function Spell:IsPoisonDispel()
return ({
[88423] = true
[393278] = true, -- Druid - Improved Natures Cure
[115310] = true, -- Monk - Revival
[388874] = true, -- Monk - Improved Detox
[393024] = true, -- Paladin - Improved Cleanse
[213644] = true -- Paladin - Cleanse Toxins
})[self:GetID()]
end
@ -428,7 +458,12 @@ end
---@return boolean
function Spell:IsDiseaseDispel()
return ({
[115310] = true, -- Monk - Revival
[388874] = true, -- Monk - Improved Detox
[393024] = true, -- Paladin - Improved Cleanse
[213644] = true, -- Paladin - Cleanse Toxins
[390632] = true, -- Priest - Improved Purify
[213634] = true -- Priest - Purify Disease
})[self:GetID()]
end

@ -447,8 +447,8 @@ end
-- Check if unit is interruptible
---@param percent number
---@return boolean
function Unit:IsInterruptibleAt(percent)
if not self:IsInterruptible() then
function Unit:IsInterruptibleAt(percent, ignoreInterruptible)
if not ignoreInterruptible and not self:IsInterruptible() then
return false
end
@ -642,15 +642,22 @@ end
---@param unit Unit
---@return boolean
function Unit:InMelee(unit)
local x, y, z = ObjectPosition(self:GetOMToken())
local x2, y2, z2 = ObjectPosition(unit:GetOMToken())
local x, y, z = ObjectPosition(self.unit)
local x2, y2, z2 = ObjectPosition(unit.unit)
if not x or not x2 then
return false
end
local scr = ObjectCombatReach(self.unit)
local ucr = ObjectCombatReach(unit.unit)
if not scr or not ucr then
return false
end
local dist = math.sqrt((x - x2) ^ 2 + (y - y2) ^ 2 + (z - z2) ^ 2)
local maxDist = math.max((ObjectCombatReach(self:GetOMToken()) + 1.3333) + ObjectCombatReach(unit:GetOMToken()), 5.0)
local maxDist = math.max((scr + 1.3333) + ucr, 5.0)
maxDist = maxDist + 1.0 + self:GetMeleeBoost()
return dist <= maxDist

Loading…
Cancel
Save