mirror of
https://github.com/Bluewhale1337/HealBotBlue.git
synced 2026-09-11 09:50:21 +00:00
feature: implemented delayed spell casting logic to handle auto-unshift requirements for Druid forms
This commit is contained in:
@@ -77,6 +77,36 @@ function HealBot_OnUpdate(this, arg1)
|
|||||||
end
|
end
|
||||||
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
|
-- Process Dirty Queue for MVC View
|
||||||
local unitsToRefresh = {}
|
local unitsToRefresh = {}
|
||||||
for unitID in pairs(HealBot_View_DirtyUnits) do
|
for unitID in pairs(HealBot_View_DirtyUnits) do
|
||||||
|
|||||||
@@ -298,13 +298,20 @@ function HealBot_CastSpellOnFriend(spell, target)
|
|||||||
local targetEnemy = UnitCanAttack("player", "target");
|
local targetEnemy = UnitCanAttack("player", "target");
|
||||||
local oldTarget = UnitName("target");
|
local oldTarget = UnitName("target");
|
||||||
|
|
||||||
|
local formCancelled = false
|
||||||
if HealBot_UnitClass("player") == "DRUID" and HealBot_Config.AutoUnshift == 1 then
|
if HealBot_UnitClass("player") == "DRUID" and HealBot_Config.AutoUnshift == 1 then
|
||||||
local currentForm = HealBot_GetShapeshiftForm()
|
local currentForm = HealBot_GetShapeshiftForm()
|
||||||
if currentForm then
|
if currentForm then
|
||||||
CastShapeshiftForm(currentForm);
|
CastShapeshiftForm(currentForm);
|
||||||
|
formCancelled = true
|
||||||
end
|
end
|
||||||
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
|
if oldTarget ~= UnitName(target) then
|
||||||
TargetUnit(target);
|
TargetUnit(target);
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user