Skip to content

Commit

Permalink
feat(Range): Default to not shading the icon on friendlies or player …
Browse files Browse the repository at this point in the history
…targets
  • Loading branch information
Cilraaz committed May 21, 2024
1 parent 2950248 commit 2adc946
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions HeroLib/Class/Unit/Range.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ function Unit:IsInRange(Distance)
local Identifier = Distance -- Considering the Distance can change if it doesn't exist we use the one passed as argument for the cache
local IsInRange = UnitInfoIsInRange[Identifier]
if IsInRange == nil then
-- For now, if we're in combat and trying to range check a friendly, just return false.
-- For now, if we're in combat and trying to range check a friendly unit or enemy player, just return true to avoid icon shading.
-- TODO: Come up with friendly tracking while in combat.
if InCombatLockdown() and (self:IsAPlayer() or not Player:CanAttack(self)) then return false end
if InCombatLockdown() and (self:IsAPlayer() or not Player:CanAttack(self)) then return true end
-- Select the hostile or friendly range table
local RangeTableByReaction = RangeTableByType.Ranged
local RangeTable = Player:CanAttack(self) and RangeTableByReaction.Hostile or RangeTableByReaction.Friendly
Expand Down Expand Up @@ -146,9 +146,9 @@ function Unit:IsInMeleeRange(Distance)
local GUID = self:GUID()
if not GUID then return false end

-- Again, if in combat and target is friendly, return false for now.
-- Again, if in combat and target is friendly unit or enemy player, return true to avoid icon shading.
-- TODO: Come up with friendly tracking while in combat.
if InCombatLockdown() and (self:IsAPlayer() or not Player:CanAttack(self)) then return false end
if InCombatLockdown() and (self:IsAPlayer() or not Player:CanAttack(self)) then return true end

local RangeTableByReaction = RangeTableByType.Melee
local RangeTable = Player:CanAttack(self) and RangeTableByReaction.Hostile or RangeTableByReaction.Friendly
Expand Down

0 comments on commit 2adc946

Please sign in to comment.