Add some CDs

main
Ryan Crockett 2 years ago
parent 0c92f0a236
commit 2c7447c410
  1. 24
      scripts/frost/frost-gui.lua
  2. 26
      scripts/frost/frost.lua
  3. 31
      src/ToggleManager/ToggleManager.lua

@ -7,35 +7,29 @@ local IcyVeins = Bastion.SpellBook:GetSpell(12472)
local FrozenOrb = Bastion.SpellBook:GetSpell(84714)
local Blizzard = Bastion.SpellBook:GetSpell(190356)
local FrostOptions = {
CdsEnabled = false,
FrozenOrbEnabled = false,
AutoAOE = true
}
Bastion.ToggleManager:Add({
id = 'Frost_CdsEnabled',
icon = IcyVeins:GetIcon(),
state = FrostOptions.CdsEnabled
state = false
})
Bastion.ToggleManager:Add({
id = 'Frost_FrozenOrbEnabled',
icon = FrozenOrb:GetIcon(),
state = FrostOptions.FrozenOrbEnabled
state = false
})
Bastion.ToggleManager:Add({
id = 'Frost_AutoAOE',
icon = Blizzard:GetIcon(),
state = FrostOptions.AutoAOE
state = true
})
---@alias GetFrostOption fun(option: "CdsEnabled" | "FrozenOrbEnabled" | 'AutoAOE'): boolean
---@type GetFrostOption
local function GetFrostOption(option)
return FrostOptions[option]
return Bastion.ToggleManager:GetState("Frost_" .. option)
end
local Command = Bastion.Command:New('frost')
@ -46,10 +40,20 @@ end)
Command:Register('cds', 'Toggle bastion on/off', function()
Bastion.ToggleManager:Toggle("Frost_CdsEnabled")
if GetFrostOption("FrozenOrbEnabled") and not GetFrostOption("CdsEnabled") then
Bastion.ToggleManager:Toggle("Frost_FrozenOrbEnabled")
elseif not GetFrostOption("FrozenOrbEnabled") and GetFrostOption("CdsEnabled") then
Bastion.ToggleManager:Toggle("Frost_FrozenOrbEnabled")
end
end)
Command:Register('orb', 'Toggle bastion on/off', function()
Bastion.ToggleManager:Toggle("Frost_FrozenOrbEnabled")
if not GetFrostOption("FrozenOrbEnabled") and GetFrostOption("CdsEnabled") then
Bastion.ToggleManager:Toggle("Frost_CdsEnabled")
end
end)
return GetFrostOption

@ -83,14 +83,38 @@ local IceLanceTarget = Bastion.UnitManager:CreateCustomUnit('icelance', function
return icelance_target
end)
local FrozenOrbTarget = Bastion.UnitManager:CreateCustomUnit('frozen_orb', function()
local unit = Bastion.UnitManager:GetEnemyWithMostEnemies(11)
if not unit then
if Target:Exists() and Target:GetDistance(Player) <= 40 then
unit = Target
else
unit = None
end
end
return unit
end)
---@return boolean
local function CombatRotation()
local targetCount = GetRangedTargetCount(40)
if GetFrostOption("CdsEnabled") and IcyVeins:IsKnown() and not Player:IsCastingOrChanneling() then
if GetFrostOption("CdsEnabled") and IcyVeins:IsKnown() and not Player:IsCastingOrChanneling() and not Player:IsMoving() then
IcyVeins:Cast(Player)
end
if GetFrostOption("CdsEnabled") and RuneOfPower:IsKnownAndUsable() and not Player:GetAuras():FindMy(RuneOfPower):IsUp() and not Player:IsMoving() then
return RuneOfPower:Cast(Player)
end
if FrozenOrb:IsKnownAndUsable() and GetFrostOption("FrozenOrbEnabled") and FrozenOrbTarget:Exists() then
FaceObject(FrozenOrbTarget:GetGUID())
return FrozenOrb:Cast(Player)
end
if IceLance:IsKnownAndUsable() and IceLanceTarget:Exists() then
return IceLance:Cast(IceLanceTarget)
end

@ -67,15 +67,16 @@ function ToggleManager:Refresh()
Texture:SetDesaturated(true)
end
self.toggles[toggle.id].texture = Texture
else
local desaturation = toggle.texture:GetDesaturation()
if not toggle.state and desaturation == 0 then
toggle.texture:SetDesaturated(true)
elseif toggle.state and desaturation == 1 then
toggle.texture:SetDesaturated(false)
end
end
-- else
-- local desaturation = toggle.texture:GetDesaturation()
-- if not toggle.state and desaturation == 0 then
-- toggle.texture:SetDesaturated(true)
-- elseif toggle.state and desaturation == 1 then
-- toggle.texture:SetDesaturated(false)
-- end
-- end
end
end
@ -83,7 +84,21 @@ end
function ToggleManager:Toggle(id)
if self.toggles[id] then
self.toggles[id].state = not self.toggles[id].state
local desaturation = self.toggles[id].texture:GetDesaturation()
if not self.toggles[id].state and desaturation == 0 then
self.toggles[id].texture:SetDesaturated(true)
elseif self.toggles[id].state and desaturation == 1 then
self.toggles[id].texture:SetDesaturated(false)
end
end
end
---@param id string
---@return boolean
function ToggleManager:GetState(id)
if self.toggles[id] then return self.toggles[id].state else return false end
end
return ToggleManager

Loading…
Cancel
Save