From ac74c38f0dd449fca0528807a7cba30c13f329d4 Mon Sep 17 00:00:00 2001 From: 4n0n <4n0n@tinkr.site> Date: Wed, 11 Jan 2023 20:18:35 -0600 Subject: [PATCH] Fix damage abilities, TODO work out unit token changes from index? something that resolves a unit to a unitmanager guid --- scripts/restodruid.lua | 17 ++++++++++------- src/UnitManager/UnitManager.lua | 10 +++++++++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/scripts/restodruid.lua b/scripts/restodruid.lua index 564a9dc..29aa90d 100644 --- a/scripts/restodruid.lua +++ b/scripts/restodruid.lua @@ -553,8 +553,9 @@ DefaultAPL:AddSpell( and Player:CanSee(Bastion.UnitManager['target']) and ( not Bastion.UnitManager['target']:GetAuras():FindMy(SunfireAura):IsUp() or - Bastion.UnitManager['target']:GetAuras():FindMy(SunfireAura):GetRemainingTime() <= 5.4) and Bastion.UnitManager['target']:IsHostile() and - Bastion.UnitManager['target']:IsAffectingCombat() + Bastion.UnitManager['target']:GetAuras():FindMy(SunfireAura):GetRemainingTime() <= 5.4) and + Bastion.UnitManager['target']:IsHostile() and + Bastion.UnitManager['target']:IsAffectingCombat() and Player:GetPP() >= 25 end):SetTarget(Bastion.UnitManager['target']) ) @@ -564,8 +565,9 @@ DefaultAPL:AddSpell( and Player:CanSee(Bastion.UnitManager['target']) and ( not Bastion.UnitManager['target']:GetAuras():FindMy(MoonfireAura):IsUp() or - Bastion.UnitManager['target']:GetAuras():FindMy(MoonfireAura):GetRemainingTime() <= 5.4) and Bastion.UnitManager['target']:IsHostile() and - Bastion.UnitManager['target']:IsAffectingCombat() + Bastion.UnitManager['target']:GetAuras():FindMy(MoonfireAura):GetRemainingTime() <= 5.4) and + Bastion.UnitManager['target']:IsHostile() and + Bastion.UnitManager['target']:IsAffectingCombat() and Player:GetPP() >= 25 end):SetTarget(Bastion.UnitManager['target']) ) @@ -573,15 +575,16 @@ DefaultAPL:AddSpell( Starsurge:CastableIf(function(self) return Bastion.UnitManager['target']:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:CanSee(Bastion.UnitManager['target']) and Bastion.UnitManager['target']:IsHostile() and - Bastion.UnitManager['target']:IsAffectingCombat() + Bastion.UnitManager['target']:IsAffectingCombat() and Player:GetPP() >= 25 end):SetTarget(Bastion.UnitManager['target']) ) DefaultAPL:AddSpell( Wrath:CastableIf(function(self) return Bastion.UnitManager['target']:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() - and Player:CanSee(Bastion.UnitManager['target']) and not Player:IsMoving() and Bastion.UnitManager['target']:IsHostile() and - Bastion.UnitManager['target']:IsAffectingCombat() + and Player:CanSee(Bastion.UnitManager['target']) and not Player:IsMoving() and + Bastion.UnitManager['target']:IsHostile() and + Bastion.UnitManager['target']:IsAffectingCombat() and Player:GetPP() >= 25 end):SetTarget(Bastion.UnitManager['target']) ) diff --git a/src/UnitManager/UnitManager.lua b/src/UnitManager/UnitManager.lua index 5102f13..0de373c 100644 --- a/src/UnitManager/UnitManager.lua +++ b/src/UnitManager/UnitManager.lua @@ -56,6 +56,10 @@ local UnitManager = { } function UnitManager:__index(k) + if k == 'none' then + return self:Get('none') + end + if UnitManager[k] then return UnitManager[k] end @@ -112,7 +116,11 @@ function UnitManager:Get(token) local tguid = ObjectGUID(token) if self.objects[tguid] == nil then - self.objects[tguid] = Unit:New(Object(tguid)) + if token == 'none' then + self.objects[tguid] = Unit:New(token) + else + self.objects[tguid] = Unit:New(Object(tguid)) + end end return self.objects[tguid]