Better SoR logic, add pause command

main
Ryan Crockett 2 years ago
parent 82af0e2e38
commit 1786febbb2
  1. 34
      scripts/paladin/paladin_protection.lua
  2. 50
      src/Queue/Queue.lua
  3. 43
      src/_bastion.lua

@ -15,7 +15,7 @@ local ConsecrateAura = Bastion.SpellBook:GetSpell(188370)
local Judgement = Bastion.SpellBook:GetSpell(275779) local Judgement = Bastion.SpellBook:GetSpell(275779)
local AvengersShield = Bastion.SpellBook:GetSpell(31935) local AvengersShield = Bastion.SpellBook:GetSpell(31935)
local OfDuskAndDawn = Bastion.SpellBook:GetSpell(385125) local OfDuskAndDawn = Bastion.SpellBook:GetSpell(385125)
local BlessingOfTheDawn = Bastion.SpellBook:GetSpell(385127) local BlessingOfTheDusk = Bastion.SpellBook:GetSpell(385126)
local ShieldOfTheRighteous = Bastion.SpellBook:GetSpell(53600) local ShieldOfTheRighteous = Bastion.SpellBook:GetSpell(53600)
local BlessedHammer = Bastion.SpellBook:GetSpell(204019) local BlessedHammer = Bastion.SpellBook:GetSpell(204019)
local AutoAttack = Bastion.SpellBook:GetSpell(6603) local AutoAttack = Bastion.SpellBook:GetSpell(6603)
@ -121,14 +121,18 @@ local function CombatRotation()
-- Handle SoR specially if DuskAndDawn is known. -- Handle SoR specially if DuskAndDawn is known.
if OfDuskAndDawn:IsKnown() then if OfDuskAndDawn:IsKnown() then
-- If Blessing of Dawn isnt up, or will expire soon then wait for 5 HP to cast it. local HpToSor = 3
if not Player:GetAuras():FindMy(BlessingOfTheDawn):IsUp() or Player:GetAuras():FindMy(BlessingOfTheDawn):GetRemainingTime() < 7 then
if Player:GetPower(HolyPower) > 4 and ShieldOfTheRighteous:IsKnownAndUsable() and ShieldOfTheRighteous:IsInRange(Target) and not Player:IsCastingOrChanneling() then if Player:GetAuras():FindMy(BlessingOfTheDusk):IsUp() and Player:GetAuras():FindMy(BlessingOfTheDusk):GetRemainingTime() > 5 then
return ShieldOfTheRighteous:Cast(Target) HpToSor = 5
end end
-- If Blessing of Dawn is up, cast SoR at 3 or more HP
elseif Player:GetPower(HolyPower) >= 3 and not Player:IsCastingOrChanneling() and ShieldOfTheRighteous:IsKnownAndUsable() and ShieldOfTheRighteous:IsInRange(Target) then if Player:GetPower(HolyPower) > 3 then
return ShieldOfTheRighteous:Cast(Target) HpToSor = 5
end
if Player:GetPower(HolyPower) == HpToSor and ShieldOfTheRighteous:IsKnownAndUsable() and ShieldOfTheRighteous:IsInRange(Target) and not Player:IsCastingOrChanneling() then
return ShieldOfTheRighteous:Cast(Target)
end end
else else
-- If Dusk And Dawn isnt known, rip SoR normally. -- If Dusk And Dawn isnt known, rip SoR normally.
@ -147,12 +151,15 @@ local function CombatRotation()
end end
-- Judgement -- Judgement
if Judgement:IsKnownAndUsable() and Target:Exists() and not Player:IsCastingOrChanneling() and Judgement:IsInRange(Target) then if Judgement:IsKnownAndUsable() and Player:GetPower(HolyPower) < 5 and Target:Exists() and Judgement:IsInRange(Target) then
return Judgement:Cast(Target) return Judgement:Cast(Target)
end end
-- Hammer of Wrath -- Hammer of Wrath
if HammerOfWrath() then return true end if HammerOfWrath() then
print("HOW!")
return true
end
-- Avengers shield with lower prio than Judgement in ST. Prefer targets that are casting. -- Avengers shield with lower prio than Judgement in ST. Prefer targets that are casting.
if Player:GetEnemies(10) == 1 and AvengersShield:IsKnownAndUsable() and AvengersShieldTarget:Exists() then if Player:GetEnemies(10) == 1 and AvengersShield:IsKnownAndUsable() and AvengersShieldTarget:Exists() then
@ -160,12 +167,11 @@ local function CombatRotation()
end end
-- Blessed Hammer if there are more than 1 enemy in 10 yds. -- Blessed Hammer if there are more than 1 enemy in 10 yds.
if BlessedHammer:IsKnownAndUsable() and Player:GetEnemies(10) >= 1 then if BlessedHammer:IsKnownAndUsable() and Player:GetPower(HolyPower) < 5 and Player:GetEnemies(10) >= 1 then
return BlessedHammer:Cast(Player) return BlessedHammer:Cast(Player)
end end
if WoGTarget:Exists() and not Player:IsCastingOrChanneling() then if Player:GetAuras():FindMy(ShinningLight):IsUp() and WoGTarget:Exists() and not Player:IsCastingOrChanneling() then
print('FOUND WoG TARGET')
return WoG:Cast(WoGTarget) return WoG:Cast(WoGTarget)
end end

@ -1,50 +0,0 @@
local Tinkr, _Bastion = ...
---@type Bastion
local Bastion = _Bastion
-- Create a new Queue class
---@class Queue
local Queue = {
---@type table<number, { spell: number, unit: Unit }>
queued = {}
}
Queue.__index = Queue
-- Constructor
---@return Queue
function Queue:New()
local self = setmetatable({}, Queue)
self.queued = {}
return self
end
-- Add an spell to the queue
---@param id number
---@param unit "mouseover"|"target"|"player"
---@return boolean
function Queue:Add(id, unit)
local isUsable = IsSpellKnown(id)
if not isUsable then
return false
end
local _unit = nil
if unit == 'mouseover' then
_unit = Bastion.UnitManager:Get('mouseover')
elseif unit == 'target' then
_unit = Bastion.UnitManager:Get('target')
else
_unit = Bastion.UnitManager:Get('player')
end
if not _unit == nil and self.queued[id] == nil then
self.queued[id]['spell'] = id
self.queued[id]['unit'] = _unit
return true
end
return false
end

@ -64,6 +64,8 @@ Bastion.MythicPlusUtils = Bastion.require("MythicPlusUtils"):New()
Bastion.Notifications = Bastion.NotificationsList:New() Bastion.Notifications = Bastion.NotificationsList:New()
Bastion.modules = {} Bastion.modules = {}
---@type table<string, { duration: number, requestTime: number }>
Bastion.pausedModules = {}
Bastion.Enabled = false Bastion.Enabled = false
Bastion.EventManager:RegisterWoWEvent('UNIT_AURA', function(unit, auras) Bastion.EventManager:RegisterWoWEvent('UNIT_AURA', function(unit, auras)
@ -142,10 +144,19 @@ Bastion.Ticker = C_Timer.NewTicker(0.1, function()
Bastion.CombatTimer:Reset() Bastion.CombatTimer:Reset()
end end
for k, v in pairs(Bastion.pausedModules) do
if (v.duration + v.requestTime) < GetTime() then
Bastion:Print('Module ', k, ' unpaused.')
Bastion.pausedModules[k] = nil
end
end
if Bastion.Enabled then if Bastion.Enabled then
Bastion.ObjectManager:Refresh() Bastion.ObjectManager:Refresh()
for i = 1, #Bastion.modules do for i = 1, #Bastion.modules do
Bastion.modules[i]:Tick() if not Bastion.pausedModules[Bastion.modules[i].name] then
Bastion.modules[i]:Tick()
end
end end
end end
end) end)
@ -261,25 +272,21 @@ Command:Register('mplus', 'Toggle m+ module on/off', function(args)
Bastion:Print("casts") Bastion:Print("casts")
end) end)
Command:Register('queue', 'Queue a spell or macro', function(args) Command:Register('pause', 'Pause a module for X seconds', function (args)
local queuedId = args[2] if Bastion.Enabled then
local duration = args[3]
local isUsable = IsSpellKnown(queuedId) local moduleName = args[2]
if isUsable then local RequestedModule = Bastion:FindModule(moduleName)
local QueuedSpell = Bastion.SpellBook:GetSpell(queuedId)
if QueuedSpell == nil then if RequestedModule and not Bastion.pausedModules[moduleName] then
print('Unable to queue invalid spell') Bastion:Print("Pausing module ", moduleName, " for ", duration)
else Bastion.pausedModules[moduleName] = { duration = duration, requestTime = GetTime() }
if QueuedSpell:IsKnownAndUsable() then elseif not Bastion.pausedModules[moduleName] then
print(QueuedSpell:GetName()) Bastion:Print("Unable to find module ", moduleName)
else
print("Cant queue unlearned spell ", queuedId)
end
end end
else
print('Unable to queue invalid spell')
end end
end) end)
Command:Register('missed', 'Dump the list of immune kidney shot spells', function() Command:Register('missed', 'Dump the list of immune kidney shot spells', function()

Loading…
Cancel
Save