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

4n0n-patch-1
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
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 PLACE_EFFLO = false
@ -372,6 +397,12 @@ end)
local DefaultAPL = Bastion.APL:New('default')
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(
Efflorescence:CastableIf(function(self)
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
end
if not unit:IsAffectingCombat() then
return false
end
if not Player:IsFacing(unit) then
return false
end
@ -422,7 +418,7 @@ DefaultAPL:AddSpell(
(Player:GetComboPoints(Target) >= 5 and
Player:GetAuras():FindMy(ShadowDanceAura):IsUp())) and (
not Target:GetAuras():FindMy(Rupture):IsUp() or
Target:GetAuras():FindMy(Rupture):GetRemainingTime() < 12
Target:GetAuras():FindMy(Rupture):GetRemainingTime() < 6
)
end):SetTarget(Target)
)
@ -555,9 +551,7 @@ AOEAPL:AddSpell(
return Target:Exists() and Player:InMelee(Target) and
self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and
(Player:GetComboPoints(Target) >= 6 or
(Player:GetComboPoints(Target) >= 5 and
Player:GetAuras():FindMy(ShadowDanceAura):IsUp())) and
(Player:GetComboPoints(Target) >= 5) and
(
not Player:GetAuras():FindMy(SliceAndDice):IsUp() or
Player:GetAuras():FindMy(SliceAndDice):GetRemainingTime() < 6
@ -571,11 +565,9 @@ AOEAPL:AddSpell(
return Target:Exists() and Player:InMelee(Target) and
self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and
(Player:GetComboPoints(Target) >= 6 or
(Player:GetComboPoints(Target) >= 5 and
Player:GetAuras():FindMy(ShadowDanceAura):IsUp())) and (
(Player:GetComboPoints(Target) >= 5) and (
not Target:GetAuras():FindMy(Rupture):IsUp() or
Target:GetAuras():FindMy(Rupture):GetRemainingTime() < 12
Target:GetAuras():FindMy(Rupture):GetRemainingTime() < 6
)
end):SetTarget(Target)
)
@ -586,9 +578,7 @@ AOEAPL:AddSpell(
return RuptureTarget:Exists() and Player:InMelee(RuptureTarget) and
self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and
(Player:GetComboPoints(RuptureTarget) >= 6 or
(Player:GetComboPoints(RuptureTarget) >= 5 and
Player:GetAuras():FindMy(ShadowDanceAura):IsUp())) and (
(Player:GetComboPoints(RuptureTarget) >= 6) and (
not RuptureTarget:GetAuras():FindMy(Rupture):IsUp() or
RuptureTarget:GetAuras():FindMy(Rupture):GetRemainingTime() < 6
)
@ -600,9 +590,7 @@ AOEAPL:AddSpell(
return Target:Exists() and Player:InMelee(Target) and
self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and
(Player:GetComboPoints(Target) >= 6 or
(Player:GetComboPoints(Target) >= 5 and
Player:GetAuras():FindMy(ShadowDanceAura):IsUp()))
(Player:GetComboPoints(Target) >= 5)
end):SetTarget(Target)
)
@ -612,6 +600,7 @@ AOEAPL:AddSpell(
return Target:Exists() and Player:InMelee(Target) and
self:IsKnownAndUsable() and
not Player:IsCastingOrChanneling() and
(Player:GetComboPoints(Target) >= 5) and
(Player:GetMeleeAttackers() >= 3 or
(Player:GetMeleeAttackers() >= 2 and
DarkBrew:IsKnown()))

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

@ -6,7 +6,7 @@ local Item = {
PreUseFunc = false,
OnUseFunc = false,
wasLooking = false,
lastUseAt = 0,
lastUseAttempt = 0,
conditions = {},
target = false,
}
@ -40,6 +40,13 @@ function Item:New(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
end
@ -108,7 +115,7 @@ function Item:Use(unit, condition)
Bastion:Debug("Using", self)
-- Set the last Use time
self.lastUseAt = GetTime()
self.lastUseAttempt = GetTime()
-- Call post Use function
if self:GetOnUseFunction() then
@ -116,6 +123,16 @@ function Item:Use(unit, condition)
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
function Item:IsEquipped()
return IsEquippedItem(self:GetID())
@ -238,7 +255,7 @@ end
-- Get the last use time
function Item:GetLastUseTime()
return self.lastUseAt
return Bastion.SpellBook:GetSpell(self:GetID()):GetLastCastTime()
end
-- Get time since last use
@ -342,8 +359,11 @@ function Item:IsItem(item)
end
function Item:GetSpell()
local name, spellID = GetItemSpell(self:GetID())
return Bastion.SpellBook:GetSpell(spellID)
if self.spellID then
return Bastion.SpellBook:GetSpell(self.spellID)
end
return nil
end
return Item

Loading…
Cancel
Save