Update nameplate enumeration, need to figure out a way to prevent it from breaking if nameplatenum is not where the units are (1,2,3 fall off, 4,5 stay nameplate4-5

notifications
4n0n 2 years ago
parent 3b9046955c
commit dcfb50374d
  1. 33
      scripts/outlaw.lua
  2. 18
      src/APL/APL.lua
  3. 2
      src/Item/Item.lua
  4. 16
      src/Unit/Unit.lua
  5. 2
      src/UnitManager/UnitManager.lua

@ -35,6 +35,10 @@ local MarkedForDeath = Bastion.SpellBook:GetSpell(137619)
local CrimsonVial = Bastion.SpellBook:GetSpell(185311)
local Shiv = Bastion.SpellBook:GetSpell(5938)
local KidneyShot = Bastion.SpellBook:GetSpell(408)
local InstantPoison = Bastion.SpellBook:GetSpell(315584)
local AtrophicPosion = Bastion.SpellBook:GetSpell(381637)
local IrideusFragment = Bastion.ItemBook:GetItem(193743)
local PurgeTarget = Bastion.UnitManager:CreateCustomUnit('purge', function(unit)
local purge = nil
@ -138,6 +142,29 @@ SpecialAPL:AddSpell(
end):SetTarget(PurgeTarget)
)
SpecialAPL:AddSpell(
InstantPoison:CastableIf(function(self)
return self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and
not Player:GetAuras():FindMy(InstantPoison):IsUp() and not Player:IsMoving()
end):SetTarget(Player)
)
SpecialAPL:AddSpell(
AtrophicPosion:CastableIf(function(self)
return self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and
not Player:GetAuras():FindMy(AtrophicPosion):IsUp() and not Player:IsMoving()
end):SetTarget(Player)
)
SpecialAPL:AddItem(
IrideusFragment:UsableIf(function(self)
return self:IsEquippedAndUsable() and
not Player:IsCastingOrChanneling() and (Player:GetMeleeAttackers() > 2 or Target:IsBoss())
end):SetTarget(Player)
)
-- Adrenaline Rush on cooldown.
DefaultAPL:AddSpell(
AdrenalineRush:CastableIf(function(self)
@ -169,8 +196,7 @@ DefaultAPL:AddSpell(
if Player:GetAuras():FindMy(TrueBearing):IsUp() then
numBuffs = numBuffs + 1
end
return Target:Exists() and Player:InMelee(Target) and
self:IsKnownAndUsable() and
return self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and
((not Player:GetAuras():FindMy(Broadside):IsUp() and
not Player:GetAuras():FindMy(TrueBearing):IsUp()) or numBuffs < 2)
@ -321,8 +347,7 @@ AOEAPL:AddSpell(
if Player:GetAuras():FindMy(TrueBearing):IsUp() then
numBuffs = numBuffs + 1
end
return Target:Exists() and Player:InMelee(Target) and
self:IsKnownAndUsable() and
return self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and
((not Player:GetAuras():FindMy(Broadside):IsUp() and
not Player:GetAuras():FindMy(TrueBearing):IsUp()) or numBuffs < 2)

@ -37,6 +37,14 @@ function APL:AddSpell(spell, condition)
table.insert(self.apl, { spell = spell, condition = condition, castableFunc = castableFunc, target = target })
end
-- Add an item to the APL
function APL:AddItem(item, condition)
local usableFunc = item.UsableIfFunc
local target = item:GetTarget()
table.insert(self.apl, { item = item, condition = condition, usableFunc = usableFunc, target = target })
end
-- Add an APL to the APL (for sub APLs)
function APL:AddAPL(apl, condition)
table.insert(self.apl, { apl = apl, condition = condition })
@ -61,6 +69,16 @@ function APL:Execute()
-- print("Bastion: APL:Execute: No condition for spell " .. actor.spell:GetName())
actor.spell:CastableIf(actor.castableFunc):Cast(actor.target)
end
if actor.item then
if actor.condition then
-- print("Bastion: APL:Execute: Condition for spell " .. actor.spell:GetName())
actor.item:UsableIf(actor.usableFunc):Cast(actor.target,
actor.condition)
end
-- print("Bastion: APL:Execute: No condition for spell " .. actor.spell:GetName())
actor.item:UsableIf(actor.usableFunc):Cast(actor.target)
end
if actor.action then
-- print("Bastion: APL:Execute: Executing action " .. actor.action)
actor.cb(self)

@ -148,7 +148,7 @@ function Item:Usable()
return self:GetUsableFunction()(self)
end
return self:IsKnownAndUsable()
return self:IsEquippedAndUsable()
end
-- Set a script to check if the Item is Usable

@ -144,7 +144,7 @@ end
-- IsEnemy
function Unit:IsEnemy()
return UnitCanAttack("player", self.unit) and (UnitIsPVP("player") or not UnitIsPlayer(self.unit))
return UnitCanAttack("player", self.unit)
end
-- Is the unit a hostile unit
@ -154,7 +154,19 @@ end
-- Is the unit a boss
function Unit:IsBoss()
return UnitClassification(self.unit) == "worldboss"
if UnitClassification(self.unit) == "worldboss" then
return true
end
for i = 1, 5 do
local bossGUID = UnitGUID("boss" .. i)
if self:GetGUID() == bossGUID then
return true
end
end
return false
end
-- Is the unit a target

@ -234,7 +234,7 @@ end
-- Enum enemies (nameplates)
function UnitManager:EnumNameplates(cb)
local n = GetNumNameplates()
local n = 30
for i = 1, n do
local unit = self:Get('nameplate' .. i)
if unit:IsValid() then

Loading…
Cancel
Save