diff --git a/scripts/outlaw.lua b/scripts/outlaw.lua index 95fd7cd..97aa783 100644 --- a/scripts/outlaw.lua +++ b/scripts/outlaw.lua @@ -39,6 +39,7 @@ local InstantPoison = Bastion.SpellBook:GetSpell(315584) local AtrophicPosion = Bastion.SpellBook:GetSpell(381637) local IrideusFragment = Bastion.ItemBook:GetItem(193743) +local Healthstone = Bastion.ItemBook:GetItem(5512) local PurgeTarget = Bastion.UnitManager:CreateCustomUnit('purge', function(unit) local purge = nil @@ -158,6 +159,14 @@ SpecialAPL:AddSpell( end):SetTarget(Player) ) +-- SpecialAPL:AddSpell( +-- Healthstone:UsableIf(function(self) +-- return self:IsKnownAndUsable() and +-- not Player:IsCastingOrChanneling() and +-- Player:GetHealthPercent() < 40 +-- end):SetTarget(Player) +-- ) + SpecialAPL:AddItem( IrideusFragment:UsableIf(function(self) return self:IsEquippedAndUsable() and diff --git a/src/APL/APL.lua b/src/APL/APL.lua index 0338752..d94918a 100644 --- a/src/APL/APL.lua +++ b/src/APL/APL.lua @@ -72,12 +72,12 @@ function APL:Execute() 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.item:UsableIf(actor.usableFunc):Use(actor.target, actor.condition) end -- print("Bastion: APL:Execute: No condition for spell " .. actor.spell:GetName()) - actor.item:UsableIf(actor.usableFunc):Cast(actor.target) + actor.item:UsableIf(actor.usableFunc):Use(actor.target) end if actor.action then -- print("Bastion: APL:Execute: Executing action " .. actor.action) diff --git a/src/Item/Item.lua b/src/Item/Item.lua index 01ddde8..82139df 100644 --- a/src/Item/Item.lua +++ b/src/Item/Item.lua @@ -134,7 +134,8 @@ end -- Check if the Item is Usable function Item:IsEquippedAndUsable() - return (self:IsEquippable() and self:IsEquipped()) or (not self:IsEquippable() and self:IsUsable()) + return ((self:IsEquippable() and self:IsEquipped()) or + (not self:IsEquippable() and self:IsUsable())) and not self:IsOnCooldown() end -- Is equippable @@ -336,8 +337,13 @@ function Item:IsDiseaseDispel() })[self:GetID()] end -function Item:IsItem(Item) - return self:GetID() == Item:GetID() +function Item:IsItem(item) + return self:GetID() == item:GetID() +end + +function Item:GetSpell() + local name, spellID = GetItemSpell(self:GetID()) + return Bastion.SpellBook:GetSpell(spellID) end return Item diff --git a/src/_bastion.lua b/src/_bastion.lua index 0e409dd..e289ab1 100644 --- a/src/_bastion.lua +++ b/src/_bastion.lua @@ -28,8 +28,8 @@ Bastion.Module = Bastion.require("Module") Bastion.UnitManager = Bastion.require("UnitManager"):New() Bastion.EventManager = Bastion.require("EventManager"):New() Bastion.Spell = Bastion.require("Spell") -Bastion.Item = Bastion.require("Item") Bastion.SpellBook = Bastion.require("SpellBook"):New() +Bastion.Item = Bastion.require("Item") Bastion.ItemBook = Bastion.require("ItemBook"):New() Bastion.AuraTable = Bastion.require("AuraTable") Bastion.Class = Bastion.require("Class")