From 510a724bc2307d2472a36a4e23b9db037e50d1d5 Mon Sep 17 00:00:00 2001 From: abunai10 Date: Thu, 24 Aug 2023 13:27:43 -0400 Subject: [PATCH] Add Fury support --- dist/Warrior/fury.lua | 154 ++++++++++++++++++++++++++++++++++++++++++ dist/main.lua | 1 + 2 files changed, 155 insertions(+) create mode 100644 dist/Warrior/fury.lua diff --git a/dist/Warrior/fury.lua b/dist/Warrior/fury.lua new file mode 100644 index 0000000..5712e56 --- /dev/null +++ b/dist/Warrior/fury.lua @@ -0,0 +1,154 @@ +local Unlocker, Caffeine = ... + +local OpenFury = Caffeine.Module:New('OpenFury') + +-- Units +local player = Caffeine.UnitManager:Get('player') +local target = Caffeine.UnitManager:Get('target') +local none = Caffeine.UnitManager:Get('none') + +-- Spells +local battle_shout = Caffeine.Globals.SpellBook:GetSpell(6673) +local berserker_stance = Caffeine.Globals.SpellBook:GetSpell(386196) +local charge = Caffeine.Globals.SpellBook:GetSpell(100) +local hamstring = Caffeine.Globals.SpellBook:GetSpell(1715) +local heroic_leap = Caffeine.Globals.SpellBook:GetSpell(6544) +local heroic_throw = Caffeine.Globals.SpellBook:GetSpell(57755) +local impending_victory = Caffeine.Globals.SpellBook:GetSpell(202168) +local pummel = Caffeine.Globals.SpellBook:GetSpell(6552) +local rallying_cry = Caffeine.Globals.SpellBook:GetSpell(97462) +local shield_block = Caffeine.Globals.SpellBook:GetSpell(2565) +local shield_slam = Caffeine.Globals.SpellBook:GetSpell(23922) +local slam = Caffeine.Globals.SpellBook:GetSpell(1464) +local spell_reflection = Caffeine.Globals.SpellBook:GetSpell(23920) +local taunt = Caffeine.Globals.SpellBook:GetSpell(355) +local avatar = Caffeine.Globals.SpellBook:GetSpell(107574) +local bloodthirst = Caffeine.Globals.SpellBook:GetSpell(23881) +local defensive_stance = Caffeine.Globals.SpellBook:GetSpell(386208) +local enraged_regeneration = Caffeine.Globals.SpellBook:GetSpell(184364) +local execute = Caffeine.Globals.SpellBook:GetSpell(280735) +local odyns_fury = Caffeine.Globals.SpellBook:GetSpell(385059) +local raging_blow = Caffeine.Globals.SpellBook:GetSpell(85288) +local rampage = Caffeine.Globals.SpellBook:GetSpell(184367) +local recklessness = Caffeine.Globals.SpellBook:GetSpell(1719) +local whirlwind = Caffeine.Globals.SpellBook:GetSpell(190411) +local spear_of_bastion = Caffeine.Globals.SpellBook:GetSpell(376079) + + +-- Auras +local enrage_buff = Caffeine.Globals.SpellBook:GetSpell(184362) +local whirlwind_buff = Caffeine.Globals.SpellBook:GetSpell(85739) + +-- APLs +local default_apl = Caffeine.APL:New('default') + +--[[ + Talents + BgEAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAChIoEARQICEFIhIQkESSaJRSkgQkkEpEgkIJBAAABEE +]] + +-- Whirlwind to maintain buff (if 2+ targets) +default_apl:AddSpell( + whirlwind:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:GetAuras():FindMy(whirlwind_buff):IsUp() and Player:GetEnemies(8) > 1 + end):SetTarget(None) +) + +-- If not Enraged, use Rampage if available or use Bloodthirst +default_apl:AddSpell( + rampage:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:GetAuras():FindMy(enrage_buff):IsUp() and Player:GetPower() >= 80 + end):SetTarget(Target) +) + +default_apl:AddSpell( + bloodthirst:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:GetAuras():FindMy(enrage_buff):IsUp() + end):SetTarget(Target) +) + +-- Recklessness/Avatar +default_apl:AddSpell( + recklessness:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetAuras():FindMy(enrage_buff):IsUp() + end):SetTarget(None) +) + +default_apl:AddSpell( + avatar:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetAuras():FindMy(enrage_buff):IsUp() + end):SetTarget(None) +) + +-- Spear of Bastion while enraged on CD +default_apl:AddSpell( + spear_of_bastion:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetAuras():FindMy(enrage_buff):IsUp() + end):SetTarget(None):OnCast(function(self) + local loc = Caffeine.UnitManager:FindEnemiesCentroid(4, 20) + self:Click(loc) + end) +) + +-- Odyn's Fury while enraged on CD +default_apl:AddSpell( + odyns_fury:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetAuras():FindMy(enrage_buff):IsUp() + end):SetTarget(Target) +) + +-- Rampage when available +default_apl:AddSpell( + rampage:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetPower() >= 80 + end):SetTarget(Target) +) + +-- Execute when able +default_apl:AddSpell( + execute:CastableIf(function(self) + return self:IsKnownAndUsable() and Target:GetHP() <= 35 + end):SetTarget(Target) +) + +-- Raging Blow if available +default_apl:AddSpell( + raging_blow:CastableIf(function(self) + return self:IsKnownAndUsable() + end):SetTarget(Target) +) + +-- Bloodthirst filler +default_apl:AddSpell( + bloodthirst:CastableIf(function(self) + return self:IsKnownAndUsable() + end):SetTarget(Target) +) + +-- Whirlwind filler +default_apl:AddSpell( + whirlwind:CastableIf(function(self) + return self:IsKnownAndUsable() + end):SetTarget(None) +) + +OpenFury:Sync(function() + if not player:IsFacing(target) and target:Exists() and not target:IsDead() then + Caffeine.Util:FaceUnit(target) + end + + if not player:InMelee(target) and target:Exists() and not target:IsDead() and target:IsHostile() then + local tx, ty, tz = ObjectPosition('target') + local px, py, pz = ObjectPosition('player') + if GetTime() - move_to_timer > 0.5 and FastDistance(px, py, pz, tx, ty, tz) > 5 then + MoveTo(tx, ty, tz) + move_to_timer = GetTime() + end + end + + if player:IsAffectingCombat() and target:Exists() and target:IsHostile() and not target:IsDead() and player:IsFacing(target) then + default_apl:Execute() + end +end) + +Caffeine:Register(OpenFury) \ No newline at end of file diff --git a/dist/main.lua b/dist/main.lua index a3f5e74..bfedb55 100644 --- a/dist/main.lua +++ b/dist/main.lua @@ -4,6 +4,7 @@ local _, class, classID = UnitClass("player") if class == "WARRIOR" then Caffeine:Require('@Warrior/arms') + Caffeine:Require('@Warrior/fury') elseif class == "SHAMAN" then Caffeine:Require('@Shaman/enhancement') end \ No newline at end of file