Add basic damage apl to resto, update subtlety to better handle variables

4n0n-patch-1
4n0n 2 years ago
parent 3ce09d1002
commit 0db6aad180
  1. 163
      scripts/restodruid.lua
  2. 108
      scripts/subtlety.lua
  3. 5
      src/Unit/Unit.lua
  4. 2
      src/UnitManager/UnitManager.lua

@ -107,6 +107,8 @@ local RakeAura = Bastion.SpellBook:GetSpell(155722)
local Starsurge = Bastion.SpellBook:GetSpell(197626) local Starsurge = Bastion.SpellBook:GetSpell(197626)
local NaturesVigil = Bastion.SpellBook:GetSpell(124974) local NaturesVigil = Bastion.SpellBook:GetSpell(124974)
local SpringBlossoms = Bastion.SpellBook:GetSpell(207386) local SpringBlossoms = Bastion.SpellBook:GetSpell(207386)
local RakeDebuff = Bastion.SpellBook:GetSpell(155722)
local Lowest = Bastion.UnitManager:CreateCustomUnit('lowest', function(unit) local Lowest = Bastion.UnitManager:CreateCustomUnit('lowest', function(unit)
local lowest = nil local lowest = nil
@ -385,6 +387,104 @@ local Explosive = Bastion.UnitManager:CreateCustomUnit('explosive', function(uni
return explosive return explosive
end) end)
local RakeTarget = Bastion.UnitManager:CreateCustomUnit('rake', function(unit)
local rakeTarget = nil
Bastion.UnitManager:EnumEnemies(function(unit)
if unit:IsDead() then
return false
end
if not Player:CanSee(unit) then
return false
end
if Player:GetDistance(unit) > 40 then
return false
end
if not unit:IsDead() and Player:CanSee(unit) and unit:InCombatOdds() > 80 and unit:InMelee(Player) and
Player:IsFacing(unit) and
(
not unit:GetAuras():FindMy(RakeDebuff):IsUp() or
unit:GetAuras():FindMy(RakeDebuff):GetRemainingTime() <= 3.6) then
rakeTarget = unit
end
end)
if rakeTarget == nil then
rakeTarget = None
end
return rakeTarget
end)
local MoonfireTarget = Bastion.UnitManager:CreateCustomUnit('moonfire', function(unit)
local moonfireTarget = nil
Bastion.UnitManager:EnumEnemies(function(unit)
if unit:IsDead() then
return false
end
if not Player:CanSee(unit) then
return false
end
if Player:GetDistance(unit) > 40 then
return false
end
if not unit:IsDead() and Player:CanSee(unit) and unit:InCombatOdds() > 80 and
(
not unit:GetAuras():FindMy(MoonfireAura):IsUp() or
unit:GetAuras():FindMy(MoonfireAura):GetRemainingTime() <= 3.6) then
moonfireTarget = unit
end
end)
if moonfireTarget == nil then
moonfireTarget = None
end
return moonfireTarget
end)
local SunfireTarget = Bastion.UnitManager:CreateCustomUnit('sunfire', function(unit)
local sunfireTarget = nil
Bastion.UnitManager:EnumEnemies(function(unit)
if unit:IsDead() then
return false
end
if not Player:CanSee(unit) then
return false
end
if Player:GetDistance(unit) > 40 then
return false
end
if not unit:IsDead() and Player:CanSee(unit) and unit:InCombatOdds() > 80 and
(
not unit:GetAuras():FindMy(SunfireAura):IsUp() or
unit:GetAuras():FindMy(SunfireAura):GetRemainingTime() <= 3.6) then
sunfireTarget = unit
end
end)
if sunfireTarget == nil then
sunfireTarget = None
end
return sunfireTarget
end)
local RestoCommands = Bastion.Command:New('resto') local RestoCommands = Bastion.Command:New('resto')
local PLACE_EFFLO = false local PLACE_EFFLO = false
@ -397,6 +497,29 @@ end)
local DefaultAPL = Bastion.APL:New('default') local DefaultAPL = Bastion.APL:New('default')
local DamageAPL = Bastion.APL:New('damage') local DamageAPL = Bastion.APL:New('damage')
DamageAPL:AddSpell(
Rake:CastableIf(function(self)
return RakeTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and
(
not RakeTarget:GetAuras():FindMy(RakeDebuff):IsUp() or
RakeTarget:GetAuras():FindMy(RakeDebuff):GetRemainingTime() <= 3.6)
end):SetTarget(RakeTarget)
)
DamageAPL:AddSpell(
FerociousBite:CastableIf(function(self)
return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and
Player:GetComboPoints() >= 5
end):SetTarget(Target)
)
DamageAPL:AddSpell(
Shred:CastableIf(function(self)
return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and
Player:GetComboPoints() < 5
end):SetTarget(Target)
)
DefaultAPL:AddSpell( DefaultAPL:AddSpell(
Moonfire:CastableIf(function(self) Moonfire:CastableIf(function(self)
return Explosive:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() return Explosive:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
@ -413,12 +536,20 @@ DefaultAPL:AddSpell(
end) end)
) )
CatForm:OnCast(function(self)
if not Player:GetAuras():FindMy(Prowl):IsUp() and not Player:IsAffectingCombat() then
Prowl:Cast(Player)
end
end)
DefaultAPL:AddAction( DefaultAPL:AddAction(
'cat_form_shift', 'cat_form_shift',
function() function()
if IsShiftKeyDown() and not Player:GetAuras():FindMy(CatForm):IsUp() and not Player:IsCastingOrChanneling() then if (IsShiftKeyDown() or not Player:IsAffectingCombat()) and not Player:IsMounted() and
not Player:GetAuras():FindMy(CatForm):IsUp() and
not Player:IsCastingOrChanneling() then
CatForm:Cast(Player) CatForm:Cast(Player)
elseif not IsShiftKeyDown() and Player:GetAuras():FindMy(CatForm):IsUp() then elseif (not IsShiftKeyDown() and Player:IsAffectingCombat()) and Player:GetAuras():FindMy(CatForm):IsUp() then
CancelShapeshiftForm() CancelShapeshiftForm()
end end
end end
@ -585,26 +716,26 @@ DefaultAPL:AddSpell(
DefaultAPL:AddSpell( DefaultAPL:AddSpell(
Sunfire:CastableIf(function(self) Sunfire:CastableIf(function(self)
return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() return SunfireTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Player:CanSee(Target) and and Player:CanSee(SunfireTarget) and
( (
not Target:GetAuras():FindMy(SunfireAura):IsUp() or not SunfireTarget:GetAuras():FindMy(SunfireAura):IsUp() or
Target:GetAuras():FindMy(SunfireAura):GetRemainingTime() <= 5.4) and SunfireTarget:GetAuras():FindMy(SunfireAura):GetRemainingTime() <= 5.4) and
Target:IsHostile() and SunfireTarget:IsHostile() and
Target:IsAffectingCombat() and Player:GetPP() >= 25 SunfireTarget:IsAffectingCombat() and Player:GetPP() >= 25
end):SetTarget(Target) end):SetTarget(SunfireTarget)
) )
DefaultAPL:AddSpell( DefaultAPL:AddSpell(
Moonfire:CastableIf(function(self) Moonfire:CastableIf(function(self)
return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() return MoonfireTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling()
and Player:CanSee(Target) and and Player:CanSee(MoonfireTarget) and
( (
not Target:GetAuras():FindMy(MoonfireAura):IsUp() or not MoonfireTarget:GetAuras():FindMy(MoonfireAura):IsUp() or
Target:GetAuras():FindMy(MoonfireAura):GetRemainingTime() <= 5.4) and MoonfireTarget:GetAuras():FindMy(MoonfireAura):GetRemainingTime() <= 5.4) and
Target:IsHostile() and MoonfireTarget:IsHostile() and
Target:IsAffectingCombat() and Player:GetPP() >= 25 MoonfireTarget:IsAffectingCombat() and Player:GetPP() >= 25
end):SetTarget(Target) end):SetTarget(MoonfireTarget)
) )
DefaultAPL:AddSpell( DefaultAPL:AddSpell(

@ -992,8 +992,6 @@ local RuptureTarget = Bastion.UnitManager:CreateCustomUnit('rupture', function()
end) end)
local function GetRimeDuration(topCard) local function GetRimeDuration(topCard)
-- // card order is [ 2 3 4 5 6 7 8 A ]
if topCard == RimeCards.Two then if topCard == RimeCards.Two then
return 0 return 0
elseif topCard == RimeCards.Three then elseif topCard == RimeCards.Three then
@ -1248,6 +1246,52 @@ DefaultAPL:AddVariable(
-- # Account for ShT reaction time by ignoring low-CP animacharged matches in the 0.5s preceeding a potential ShT proc -- # Account for ShT reaction time by ignoring low-CP animacharged matches in the 0.5s preceeding a potential ShT proc
-- actions+=/variable,name=effective_combo_points,value=effective_combo_points -- actions+=/variable,name=effective_combo_points,value=effective_combo_points
-- DefaultAPL:AddVariable(
-- 'effective_combo_points',
-- function()
-- local cur = Player:GetComboPoints() or 0
-- if not EchoingReprimand:IsKnown() then
-- return cur
-- end
-- if cur < 2 or cur > 5 then
-- return cur
-- end
-- if Player:GetAuras():FindMy(EchoingReprimand):IsUp() or Player:GetAuras():FindMy(EchoingReprimand2):IsUp() or
-- Player:GetAuras():FindMy(EchoingReprimand3):IsUp() or
-- Player:GetAuras():FindMy(EchoingReprimand4):IsUp() or
-- Player:GetAuras():FindMy(EchoingReprimand5):IsUp()
-- then
-- return 7
-- end
-- return cur
-- end
-- )
-- -- actions+=/variable,name=effective_combo_points,if=talent.echoing_reprimand.enabled&effective_combo_points>combo_points&combo_points.deficit>2&time_to_sht.4.plus<0.5&!variable.is_next_cp_animacharged,value=combo_points
-- DefaultAPL:AddVariable(
-- 'effective_combo_points',
-- function()
-- if not EchoingReprimand:IsKnown() then
-- return 0
-- end
-- local cur = Player:GetComboPoints() or 0
-- local deficit = Player:GetComboPointsDeficit() or 0
-- if cur > Player:GetComboPoints() and deficit > 2 and
-- Player:GetAuras():FindMy(EchoingReprimand4):GetRemainingTime() < 0.5 and
-- not DefaultAPL:GetVariable('is_next_cp_animacharged')
-- then
-- return cur
-- end
-- return 0
-- end
-- )
DefaultAPL:AddVariable( DefaultAPL:AddVariable(
'effective_combo_points', 'effective_combo_points',
function() function()
@ -1268,14 +1312,6 @@ DefaultAPL:AddVariable(
return 7 return 7
end end
return cur
end
)
-- actions+=/variable,name=effective_combo_points,if=talent.echoing_reprimand.enabled&effective_combo_points>combo_points&combo_points.deficit>2&time_to_sht.4.plus<0.5&!variable.is_next_cp_animacharged,value=combo_points
DefaultAPL:AddVariable(
'effective_combo_points',
function()
if not EchoingReprimand:IsKnown() then if not EchoingReprimand:IsKnown() then
return 0 return 0
end end
@ -1290,10 +1326,10 @@ DefaultAPL:AddVariable(
return cur return cur
end end
return 0 -- return 0
return cur
end end
) )
-- # Check CDs at first -- # Check CDs at first
-- actions+=/call_action_list,name=cds -- actions+=/call_action_list,name=cds
DefaultAPL:AddAPL( DefaultAPL:AddAPL(
@ -1995,31 +2031,41 @@ StealthCDsAPL:AddSpell(
-- # CP thresholds for entering Shadow Dance Default to start dance with 0 or 1 combo point -- # CP thresholds for entering Shadow Dance Default to start dance with 0 or 1 combo point
-- actions.stealth_cds+=/variable,name=shd_combo_points,value=combo_points<=1 -- actions.stealth_cds+=/variable,name=shd_combo_points,value=combo_points<=1
StealthCDsAPL:AddVariable( -- StealthCDsAPL:AddVariable(
'shd_combo_points', -- 'shd_combo_points',
function(self) -- function(self)
return Player:GetComboPoints() <= 1 -- return Player:GetComboPoints() <= 1
end -- end
) -- )
-- -- # Use stealth cooldowns with high combo points when playing shuriken tornado or with high target counts
-- -- actions.stealth_cds+=/variable,name=shd_combo_points,value=combo_points.deficit<=1,if=spell_targets.shuriken_storm>(4-2*talent.shuriken_tornado.enabled)|variable.priority_rotation&spell_targets.shuriken_storm>=4
-- StealthCDsAPL:AddVariable(
-- 'shd_combo_points',
-- function(self)
-- return Player:GetComboPointsDeficit() <= 1 and
-- ((Player:GetEnemies(10) > (4 - 2 * (ShurikenTornado:IsKnown() and 1 or 0))) or
-- (DefaultAPL:GetVariable('priority_rotation') and
-- Player:GetEnemies(10) >= 4))
-- end
-- )
-- -- # Use stealth cooldowns on any combo point on 4 targets
-- -- actions.stealth_cds+=/variable,name=shd_combo_points,value=1,if=spell_targets.shuriken_storm=(4-talent.seal_fate)
-- StealthCDsAPL:AddVariable(
-- 'shd_combo_points',
-- function(self)
-- return Player:GetEnemies(10) == (4 - (SealFate:IsKnown() and 1 or 0))
-- end
-- )
-- # Use stealth cooldowns with high combo points when playing shuriken tornado or with high target counts
-- actions.stealth_cds+=/variable,name=shd_combo_points,value=combo_points.deficit<=1,if=spell_targets.shuriken_storm>(4-2*talent.shuriken_tornado.enabled)|variable.priority_rotation&spell_targets.shuriken_storm>=4
StealthCDsAPL:AddVariable( StealthCDsAPL:AddVariable(
'shd_combo_points', 'shd_combo_points',
function(self) function(self)
return Player:GetComboPointsDeficit() <= 1 and return (Player:GetComboPoints() <= 1) or (Player:GetComboPointsDeficit() <= 1 and
((Player:GetEnemies(10) > (4 - 2 * (ShurikenTornado:IsKnown() and 1 or 0))) or ((Player:GetEnemies(10) > (4 - 2 * (ShurikenTornado:IsKnown() and 1 or 0))) or
(DefaultAPL:GetVariable('priority_rotation') and (DefaultAPL:GetVariable('priority_rotation') and
Player:GetEnemies(10) >= 4)) Player:GetEnemies(10) >= 4))) or (Player:GetEnemies(10) == (4 - (SealFate:IsKnown() and 1 or 0)))
end
)
-- # Use stealth cooldowns on any combo point on 4 targets
-- actions.stealth_cds+=/variable,name=shd_combo_points,value=1,if=spell_targets.shuriken_storm=(4-talent.seal_fate)
StealthCDsAPL:AddVariable(
'shd_combo_points',
function(self)
return Player:GetEnemies(10) == (4 - (SealFate:IsKnown() and 1 or 0))
end end
) )

@ -41,6 +41,11 @@ function Unit:__eq(other)
end end
-- tostring -- tostring
---ToString
---
---```lua
---print(Unit:New('player'))
---```
---@return string ---@return string
function Unit:__tostring() function Unit:__tostring()
return "Bastion.__Unit(" .. tostring(self:GetOMToken()) .. ")" .. " - " .. (self:GetName() or '') return "Bastion.__Unit(" .. tostring(self:GetOMToken()) .. ")" .. " - " .. (self:GetName() or '')

@ -182,7 +182,7 @@ function UnitManager:CreateCustomUnit(token, cb)
return cachedUnit return cachedUnit
end end
-- Enum Friends (party/raid members) ---@description Enumerates all friendly units in the battlefield
---@param cb fun(unit: Unit):boolean ---@param cb fun(unit: Unit):boolean
---@return nil ---@return nil
function UnitManager:EnumFriends(cb) function UnitManager:EnumFriends(cb)

Loading…
Cancel
Save