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 AvengersShield = Bastion.SpellBook:GetSpell(31935)
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 BlessedHammer = Bastion.SpellBook:GetSpell(204019)
local AutoAttack = Bastion.SpellBook:GetSpell(6603)
@ -121,14 +121,18 @@ local function CombatRotation()
-- Handle SoR specially if DuskAndDawn is known.
if OfDuskAndDawn:IsKnown() then
-- If Blessing of Dawn isnt up, or will expire soon then wait for 5 HP to cast it.
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
return ShieldOfTheRighteous:Cast(Target)
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
return ShieldOfTheRighteous:Cast(Target)
local HpToSor = 3
if Player:GetAuras():FindMy(BlessingOfTheDusk):IsUp() and Player:GetAuras():FindMy(BlessingOfTheDusk):GetRemainingTime() > 5 then
HpToSor = 5
end
if Player:GetPower(HolyPower) > 3 then
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
else
-- If Dusk And Dawn isnt known, rip SoR normally.
@ -147,12 +151,15 @@ local function CombatRotation()
end
-- 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)
end
-- 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.
if Player:GetEnemies(10) == 1 and AvengersShield:IsKnownAndUsable() and AvengersShieldTarget:Exists() then
@ -160,12 +167,11 @@ local function CombatRotation()
end
-- 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)
end
if WoGTarget:Exists() and not Player:IsCastingOrChanneling() then
print('FOUND WoG TARGET')
if Player:GetAuras():FindMy(ShinningLight):IsUp() and WoGTarget:Exists() and not Player:IsCastingOrChanneling() then
return WoG:Cast(WoGTarget)
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.modules = {}
---@type table<string, { duration: number, requestTime: number }>
Bastion.pausedModules = {}
Bastion.Enabled = false
Bastion.EventManager:RegisterWoWEvent('UNIT_AURA', function(unit, auras)
@ -142,10 +144,19 @@ Bastion.Ticker = C_Timer.NewTicker(0.1, function()
Bastion.CombatTimer:Reset()
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
Bastion.ObjectManager:Refresh()
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)
@ -261,25 +272,21 @@ Command:Register('mplus', 'Toggle m+ module on/off', function(args)
Bastion:Print("casts")
end)
Command:Register('queue', 'Queue a spell or macro', function(args)
local queuedId = args[2]
local isUsable = IsSpellKnown(queuedId)
if isUsable then
local QueuedSpell = Bastion.SpellBook:GetSpell(queuedId)
if QueuedSpell == nil then
print('Unable to queue invalid spell')
else
if QueuedSpell:IsKnownAndUsable() then
print(QueuedSpell:GetName())
else
print("Cant queue unlearned spell ", queuedId)
end
Command:Register('pause', 'Pause a module for X seconds', function (args)
if Bastion.Enabled then
local duration = args[3]
local moduleName = args[2]
local RequestedModule = Bastion:FindModule(moduleName)
if RequestedModule and not Bastion.pausedModules[moduleName] then
Bastion:Print("Pausing module ", moduleName, " for ", duration)
Bastion.pausedModules[moduleName] = { duration = duration, requestTime = GetTime() }
elseif not Bastion.pausedModules[moduleName] then
Bastion:Print("Unable to find module ", moduleName)
end
else
print('Unable to queue invalid spell')
end
end)
Command:Register('missed', 'Dump the list of immune kidney shot spells', function()

Loading…
Cancel
Save