From cea7d35b50e046d37dc75a54f0bec8631bcade2f Mon Sep 17 00:00:00 2001 From: Emlembow <36314674+Emlembow@users.noreply.github.com> Date: Sun, 18 Aug 2024 10:51:06 -0700 Subject: [PATCH] Auto-commit: changes committed --- BloodDK.lua | 275 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 BloodDK.lua diff --git a/BloodDK.lua b/BloodDK.lua new file mode 100644 index 0000000..1827a25 --- /dev/null +++ b/BloodDK.lua @@ -0,0 +1,275 @@ +local Tinkr, Bastion = ... +local BloodDKModule = Bastion.Module:New('BloodDeathKnight') +local Player = Bastion.UnitManager:Get('player') +local Target = Bastion.UnitManager:Get('target') +local SpellBook = Bastion.SpellBook:New() + +-- Spells +local DeathStrike = SpellBook:GetSpell(49998) +local Marrowrend = SpellBook:GetSpell(195182) +local HeartStrike = SpellBook:GetSpell(206930) +local BloodBoil = SpellBook:GetSpell(50842) +local DeathAndDecay = SpellBook:GetSpell(43265) +local DancingRuneWeapon = SpellBook:GetSpell(49028) +local Tombstone = SpellBook:GetSpell(219809) +local Bonestorm = SpellBook:GetSpell(194844) +local AbominationLimb = SpellBook:GetSpell(315443) +local EmpowerRuneWeapon = SpellBook:GetSpell(47568) +local DeathsCaress = SpellBook:GetSpell(195292) +local RaiseDead = SpellBook:GetSpell(46585) +local BlindingSleet = SpellBook:GetSpell(207167) +local AntiMagicShell = SpellBook:GetSpell(48707) +local GorefiendGrasp = SpellBook:GetSpell(108199) +local MindFreeze = SpellBook:GetSpell(47528) +local Asphyxiate = SpellBook:GetSpell(221562) +local RaiseAlly = SpellBook:GetSpell(61999) +local AntiMagicZone = SpellBook:GetSpell(51052) +local VampiricBlood = SpellBook:GetSpell(55233) + +-- Buffs +local BoneShield = SpellBook:GetSpell(195181) +local DancingRuneWeaponBuff = SpellBook:GetSpell(81256) + +-- Helper Functions +local function GetEnemiesInRange(range) + local count = 0 + Bastion.UnitManager:EnumEnemies(function(unit) + if unit:GetDistance(Player) <= range then + count = count + 1 + end + end) + return count +end + +local function HasEnoughRunicPower(cost) + return Player:GetPower() >= cost +end + +-- Create APLs +local DefaultAPL = Bastion.APL:New('default') +local CooldownAPL = Bastion.APL:New('cooldown') +local DefensiveAPL = Bastion.APL:New('defensive') +local UtilityAPL = Bastion.APL:New('utility') + +-- Utility APL +UtilityAPL:AddSpell( + BlindingSleet:CastableIf(function(self) + return self:IsKnownAndUsable() and GetEnemiesInRange(12) >= 3 + end):SetTarget(Player) +) + +UtilityAPL:AddSpell( + GorefiendGrasp:CastableIf(function(self) + return self:IsKnownAndUsable() and GetEnemiesInRange(15) >= 3 + end):SetTarget(Target) +) + +UtilityAPL:AddSpell( + MindFreeze:CastableIf(function(self) + return self:IsKnownAndUsable() and Target:IsCasting() and Target:IsInterruptible() + end):SetTarget(Target) +) + +UtilityAPL:AddSpell( + Asphyxiate:CastableIf(function(self) + return self:IsKnownAndUsable() and not Target:IsStunned() + end):SetTarget(Target) +) + +-- Cooldown APL +CooldownAPL:AddSpell( + DancingRuneWeapon:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:GetAuras():FindMy(DancingRuneWeaponBuff):IsUp() + end):SetTarget(Player) +) + +CooldownAPL:AddSpell( + AbominationLimb:CastableIf(function(self) + return self:IsKnownAndUsable() + end):SetTarget(Player) +) + +CooldownAPL:AddSpell( + EmpowerRuneWeapon:CastableIf(function(self) + return self:IsKnownAndUsable() + end):SetTarget(Player) +) + +-- Defensive APL +DefensiveAPL:AddSpell( + AntiMagicShell:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetHP() <= 70 + end):SetTarget(Player) +) + +DefensiveAPL:AddSpell( + AntiMagicZone:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetHP() <= 50 + end):SetTarget(Player) +) + +DefensiveAPL:AddSpell( + VampiricBlood:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetHP() <= 60 + end):SetTarget(Player) +) + +-- Default APL +DefaultAPL:AddSpell( + Marrowrend:CastableIf(function(self) + local boneShieldCount = Player:GetAuras():FindMy(BoneShield):GetCount() + return self:IsKnownAndUsable() and + (boneShieldCount <= 6 or + (boneShieldCount <= 7 and Player:GetAuras():FindMy(BoneShield):GetRemainingTime() < 3)) + end):SetTarget(Target) +) + +DefaultAPL:AddSpell( + DeathStrike:CastableIf(function(self) + return self:IsKnownAndUsable() and HasEnoughRunicPower(45) and Player:GetHP() <= 80 + end):SetTarget(Target) +) + +DefaultAPL:AddSpell( + Tombstone:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetAuras():FindMy(BoneShield):GetCount() > 6 + and not Player:GetAuras():FindMy(DancingRuneWeaponBuff):IsUp() + and Player:GetAuras():FindMy(DeathAndDecay):IsUp() + and DancingRuneWeapon:GetCooldownRemaining() > 0 + end):SetTarget(Player) +) + +DefaultAPL:AddSpell( + Bonestorm:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetAuras():FindMy(BoneShield):GetCount() > 11 + and not Player:GetAuras():FindMy(DancingRuneWeaponBuff):IsUp() + and Player:GetAuras():FindMy(DeathAndDecay):IsUp() + and HasEnoughRunicPower(100) + and DancingRuneWeapon:GetCooldownRemaining() > 0 + end):SetTarget(Player) +) + +DefaultAPL:AddSpell( + DeathAndDecay:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:GetAuras():FindMy(DeathAndDecay):IsUp() + end):SetTarget(Player) +) + +DefaultAPL:AddSpell( + BloodBoil:CastableIf(function(self) + return self:IsKnownAndUsable() and self:GetCharges() > 1 + end):SetTarget(Target) +) + +DefaultAPL:AddSpell( + HeartStrike:CastableIf(function(self) + return self:IsKnownAndUsable() + end):SetTarget(Target) +) + +-- Opener sequence +local OpenerSequence = Bastion.Sequencer:New({ + function(self) + if DeathAndDecay:IsKnownAndUsable() then + DeathAndDecay:Cast(Player) + return true + end + return false + end, + function(self) + if DeathsCaress:IsKnownAndUsable() then + DeathsCaress:Cast(Target) + return true + end + return false + end, + function(self) + if RaiseDead:IsKnownAndUsable() then + RaiseDead:Cast(Player) + return true + end + return false + end, + function(self) + if DancingRuneWeapon:IsKnownAndUsable() then + DancingRuneWeapon:Cast(Player) + return true + end + return false + end, + function(self) + if BloodBoil:IsKnownAndUsable() then + BloodBoil:Cast(Target) + return true + end + return false + end, + function(self) + if Tombstone:IsKnownAndUsable() then + Tombstone:Cast(Player) + return true + end + return false + end, + function(self) + if HeartStrike:IsKnownAndUsable() then + HeartStrike:Cast(Target) + return true + end + return false + end, + function(self) + if DeathStrike:IsKnownAndUsable() then + DeathStrike:Cast(Target) + return true + end + return false + end, + function(self) + if HeartStrike:IsKnownAndUsable() then + HeartStrike:Cast(Target) + return true + end + return false + end, + function(self) + if BloodBoil:IsKnownAndUsable() then + BloodBoil:Cast(Target) + return true + end + return false + end, + function(self) + if DeathStrike:IsKnownAndUsable() then + DeathStrike:Cast(Target) + return true + end + return false + end, + function(self) + if Marrowrend:IsKnownAndUsable() then + Marrowrend:Cast(Target) + return true + end + return false + end, +}, function() + return not Player:IsAffectingCombat() +end) + +DefaultAPL:AddSequence(OpenerSequence, function() + return not Player:IsAffectingCombat() +end) + +BloodDKModule:Sync(function() + if not Player:IsAffectingCombat() then + return + end + + DefensiveAPL:Execute() + UtilityAPL:Execute() + CooldownAPL:Execute() + DefaultAPL:Execute() +end) + +Bastion:Register(BloodDKModule) \ No newline at end of file