Item changes to detect spell usage (item usages based on spell id) / sub fixes for aoe

notifications
4n0n 2 years ago
parent 29e19b931f
commit b94ac8fe8a
  1. 31
      scripts/restodruid.lua
  2. 25
      scripts/subtlety.lua
  3. 7
      src/Aura/Aura.lua
  4. 30
      src/Item/Item.lua

@ -360,6 +360,31 @@ local WildGrowthUnit = Bastion.UnitManager:CreateCustomUnit('wildgrowth', functi
return lowest return lowest
end) end)
local Explosive = Bastion.UnitManager:CreateCustomUnit('explosive', function(unit)
local explosive = nil
Bastion.ObjectManager.explosives:each(function(unit)
if unit:IsDead() then
return false
end
if not Player:CanSee(unit) then
return false
end
if Player:GetDistance(unit) <= 40 then
explosive = unit
return true
end
end)
if explosive == nil then
explosive = None
end
return explosive
end)
local RestoCommands = Bastion.Command:New('resto') local RestoCommands = Bastion.Command:New('resto')
local PLACE_EFFLO = false local PLACE_EFFLO = false
@ -372,6 +397,12 @@ end)
local DefaultAPL = Bastion.APL:New('default') local DefaultAPL = Bastion.APL:New('default')
local DamageAPL = Bastion.APL:New('damage') local DamageAPL = Bastion.APL:New('damage')
DefaultAPL:AddSpell(
Moonfire:CastableIf(function(self)
return Explosive:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
end):SetTarget(Explosive)
)
DefaultAPL:AddSpell( DefaultAPL:AddSpell(
Efflorescence:CastableIf(function(self) Efflorescence:CastableIf(function(self)
return PLACE_EFFLO and Player:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() return PLACE_EFFLO and Player:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()

@ -168,10 +168,6 @@ local RuptureTarget = Bastion.UnitManager:CreateCustomUnit('rupture', function()
return false return false
end end
if not unit:IsAffectingCombat() then
return false
end
if not Player:IsFacing(unit) then if not Player:IsFacing(unit) then
return false return false
end end
@ -422,7 +418,7 @@ DefaultAPL:AddSpell(
(Player:GetComboPoints(Target) >= 5 and (Player:GetComboPoints(Target) >= 5 and
Player:GetAuras():FindMy(ShadowDanceAura):IsUp())) and ( Player:GetAuras():FindMy(ShadowDanceAura):IsUp())) and (
not Target:GetAuras():FindMy(Rupture):IsUp() or not Target:GetAuras():FindMy(Rupture):IsUp() or
Target:GetAuras():FindMy(Rupture):GetRemainingTime() < 12 Target:GetAuras():FindMy(Rupture):GetRemainingTime() < 6
) )
end):SetTarget(Target) end):SetTarget(Target)
) )
@ -555,9 +551,7 @@ AOEAPL:AddSpell(
return Target:Exists() and Player:InMelee(Target) and return Target:Exists() and Player:InMelee(Target) and
self:IsKnownAndUsable() and self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and not Player:IsCastingOrChanneling() and
(Player:GetComboPoints(Target) >= 6 or (Player:GetComboPoints(Target) >= 5) and
(Player:GetComboPoints(Target) >= 5 and
Player:GetAuras():FindMy(ShadowDanceAura):IsUp())) and
( (
not Player:GetAuras():FindMy(SliceAndDice):IsUp() or not Player:GetAuras():FindMy(SliceAndDice):IsUp() or
Player:GetAuras():FindMy(SliceAndDice):GetRemainingTime() < 6 Player:GetAuras():FindMy(SliceAndDice):GetRemainingTime() < 6
@ -571,11 +565,9 @@ AOEAPL:AddSpell(
return Target:Exists() and Player:InMelee(Target) and return Target:Exists() and Player:InMelee(Target) and
self:IsKnownAndUsable() and self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and not Player:IsCastingOrChanneling() and
(Player:GetComboPoints(Target) >= 6 or (Player:GetComboPoints(Target) >= 5) and (
(Player:GetComboPoints(Target) >= 5 and
Player:GetAuras():FindMy(ShadowDanceAura):IsUp())) and (
not Target:GetAuras():FindMy(Rupture):IsUp() or not Target:GetAuras():FindMy(Rupture):IsUp() or
Target:GetAuras():FindMy(Rupture):GetRemainingTime() < 12 Target:GetAuras():FindMy(Rupture):GetRemainingTime() < 6
) )
end):SetTarget(Target) end):SetTarget(Target)
) )
@ -586,9 +578,7 @@ AOEAPL:AddSpell(
return RuptureTarget:Exists() and Player:InMelee(RuptureTarget) and return RuptureTarget:Exists() and Player:InMelee(RuptureTarget) and
self:IsKnownAndUsable() and self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and not Player:IsCastingOrChanneling() and
(Player:GetComboPoints(RuptureTarget) >= 6 or (Player:GetComboPoints(RuptureTarget) >= 6) and (
(Player:GetComboPoints(RuptureTarget) >= 5 and
Player:GetAuras():FindMy(ShadowDanceAura):IsUp())) and (
not RuptureTarget:GetAuras():FindMy(Rupture):IsUp() or not RuptureTarget:GetAuras():FindMy(Rupture):IsUp() or
RuptureTarget:GetAuras():FindMy(Rupture):GetRemainingTime() < 6 RuptureTarget:GetAuras():FindMy(Rupture):GetRemainingTime() < 6
) )
@ -600,9 +590,7 @@ AOEAPL:AddSpell(
return Target:Exists() and Player:InMelee(Target) and return Target:Exists() and Player:InMelee(Target) and
self:IsKnownAndUsable() and self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and not Player:IsCastingOrChanneling() and
(Player:GetComboPoints(Target) >= 6 or (Player:GetComboPoints(Target) >= 5)
(Player:GetComboPoints(Target) >= 5 and
Player:GetAuras():FindMy(ShadowDanceAura):IsUp()))
end):SetTarget(Target) end):SetTarget(Target)
) )
@ -612,6 +600,7 @@ AOEAPL:AddSpell(
return Target:Exists() and Player:InMelee(Target) and return Target:Exists() and Player:InMelee(Target) and
self:IsKnownAndUsable() and self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and not Player:IsCastingOrChanneling() and
(Player:GetComboPoints(Target) >= 5) and
(Player:GetMeleeAttackers() >= 3 or (Player:GetMeleeAttackers() >= 3 or
(Player:GetMeleeAttackers() >= 2 and (Player:GetMeleeAttackers() >= 2 and
DarkBrew:IsKnown())) DarkBrew:IsKnown()))

@ -46,6 +46,7 @@ function Aura:New(unit, index, type)
type = nil, type = nil,
} }
Bastion.SpellBook:GetSpell(self.aura.spellId)
return self return self
end end
@ -74,6 +75,7 @@ function Aura:New(unit, index, type)
index = index, index = index,
type = type, type = type,
} }
Bastion.SpellBook:GetSpell(self.aura.spellId)
return self return self
end end
@ -100,6 +102,9 @@ function Aura:CreateFromUnitAuraInfo(unitAuraInfo)
index = nil, index = nil,
type = unitAuraInfo.isHarmful and "HARMFUL" or "HELPFUL", type = unitAuraInfo.isHarmful and "HARMFUL" or "HELPFUL",
} }
-- Register spell in spellbook
Bastion.SpellBook:GetSpell(self.aura.spellId)
return self return self
end end
@ -186,7 +191,7 @@ end
-- Get the auras spell id -- Get the auras spell id
function Aura:GetSpell() function Aura:GetSpell()
return Bastion.Spell:New(self.aura.spellId) return Bastion.SpellBook:GetSpell(self.aura.spellId)
end end
-- Get the auras can apply aura status -- Get the auras can apply aura status

@ -6,7 +6,7 @@ local Item = {
PreUseFunc = false, PreUseFunc = false,
OnUseFunc = false, OnUseFunc = false,
wasLooking = false, wasLooking = false,
lastUseAt = 0, lastUseAttempt = 0,
conditions = {}, conditions = {},
target = false, target = false,
} }
@ -40,6 +40,13 @@ function Item:New(id)
self.ItemID = id self.ItemID = id
-- Register spell in spellbook
local name, spellID = GetItemSpell(self:GetID())
if spellID then
self.spellID = spellID
Bastion.SpellBook:GetSpell(spellID)
end
return self return self
end end
@ -108,7 +115,7 @@ function Item:Use(unit, condition)
Bastion:Debug("Using", self) Bastion:Debug("Using", self)
-- Set the last Use time -- Set the last Use time
self.lastUseAt = GetTime() self.lastUseAttempt = GetTime()
-- Call post Use function -- Call post Use function
if self:GetOnUseFunction() then if self:GetOnUseFunction() then
@ -116,6 +123,16 @@ function Item:Use(unit, condition)
end end
end end
-- Last use attempt
function Item:GetLastUseAttempt()
return self.lastUseAttempt
end
-- Time since last attepmt
function Item:GetTimeSinceLastUseAttempt()
return GetTime() - self:GetLastUseAttempt()
end
-- Check if the Item is known -- Check if the Item is known
function Item:IsEquipped() function Item:IsEquipped()
return IsEquippedItem(self:GetID()) return IsEquippedItem(self:GetID())
@ -238,7 +255,7 @@ end
-- Get the last use time -- Get the last use time
function Item:GetLastUseTime() function Item:GetLastUseTime()
return self.lastUseAt return Bastion.SpellBook:GetSpell(self:GetID()):GetLastCastTime()
end end
-- Get time since last use -- Get time since last use
@ -342,8 +359,11 @@ function Item:IsItem(item)
end end
function Item:GetSpell() function Item:GetSpell()
local name, spellID = GetItemSpell(self:GetID()) if self.spellID then
return Bastion.SpellBook:GetSpell(spellID) return Bastion.SpellBook:GetSpell(self.spellID)
end
return nil
end end
return Item return Item

Loading…
Cancel
Save