feature: implemented delayed spell casting logic to handle auto-unshift requirements for Druid forms

This commit is contained in:
Bluewhale1337
2026-09-01 11:03:11 +02:00
parent e05238a5b2
commit 59ceb3b465
2 changed files with 37 additions and 0 deletions
+30
View File
@@ -77,6 +77,36 @@ function HealBot_OnUpdate(this, arg1)
end
end
if HealBot_PendingShapeshiftCast then
if GetTime() > HealBot_PendingShapeshiftCast.expires then
HealBot_PendingShapeshiftCast = nil
else
-- Only cast once the form has successfully been removed
local currentForm = HealBot_GetShapeshiftForm()
if not currentForm then
local pendingCast = HealBot_PendingShapeshiftCast
HealBot_PendingShapeshiftCast = nil
-- Target the unit if necessary before casting
if pendingCast.oldTarget ~= UnitName(pendingCast.target) then
TargetUnit(pendingCast.target)
end
-- Attempt the cast now that form is cleared
HealBot_StartCasting(pendingCast.spell, pendingCast.target, "direct")
if pendingCast.targetEnemy then
HealBot_TargetRestorePending = { type = "enemy" }
elseif pendingCast.oldTarget and pendingCast.oldTarget ~= UnitName(pendingCast.target) then
HealBot_TargetRestorePending = { type = "friend" }
elseif not pendingCast.oldTarget then
HealBot_TargetRestorePending = { type = "clear" }
end
HealBot_TargetRestoreTimer = 0
end
end
end
-- Process Dirty Queue for MVC View
local unitsToRefresh = {}
for unitID in pairs(HealBot_View_DirtyUnits) do
+7
View File
@@ -298,13 +298,20 @@ function HealBot_CastSpellOnFriend(spell, target)
local targetEnemy = UnitCanAttack("player", "target");
local oldTarget = UnitName("target");
local formCancelled = false
if HealBot_UnitClass("player") == "DRUID" and HealBot_Config.AutoUnshift == 1 then
local currentForm = HealBot_GetShapeshiftForm()
if currentForm then
CastShapeshiftForm(currentForm);
formCancelled = true
end
end
if formCancelled then
HealBot_PendingShapeshiftCast = { spell = spell, target = target, targetEnemy = targetEnemy, oldTarget = oldTarget, expires = GetTime() + 1.0 }
return;
end
if oldTarget ~= UnitName(target) then
TargetUnit(target);
end