Core/Creature: add a spell-focus-check method.

Port From (https://github.com/TrinityCore/TrinityCore/commit/44e9572a77061a8ddf04940f8e76f6585ad4ca05)
This commit is contained in:
hondacrx
2022-01-02 19:31:22 -05:00
parent 6a42e70544
commit 45fba1e81a
2 changed files with 70 additions and 66 deletions
+3 -1
View File
@@ -1121,7 +1121,7 @@ namespace Game.Entities
return true; return true;
} }
if (HandleSpellFocus(null, true)) if (HasSpellFocusTarget())
return true; return true;
if (HasUnitState(UnitState.Casting)) if (HasUnitState(UnitState.Casting))
@@ -3059,6 +3059,8 @@ namespace Game.Entities
_spellFocusDelay = (!IsPet() && withDelay) ? GameTime.GetGameTimeMS() : 0; // don't allow re-target right away to prevent visual bugs _spellFocusDelay = (!IsPet() && withDelay) ? GameTime.GetGameTimeMS() : 0; // don't allow re-target right away to prevent visual bugs
} }
public override bool HasSpellFocusTarget() { return IsAlive() && (_focusSpell != null || _spellFocusDelay != 0); }
public void MustReacquireTarget() { _shouldReacquireSpellFocusTarget = true; } // flags the Creature for forced (client displayed) target reacquisition in the next Update call public void MustReacquireTarget() { _shouldReacquireSpellFocusTarget = true; } // flags the Creature for forced (client displayed) target reacquisition in the next Update call
public void DoNotReacquireTarget() public void DoNotReacquireTarget()
+2
View File
@@ -1043,6 +1043,8 @@ namespace Game.Entities
public virtual bool HandleSpellFocus(Spell focusSpell = null, bool withDelay = false) { return false; } public virtual bool HandleSpellFocus(Spell focusSpell = null, bool withDelay = false) { return false; }
public virtual bool HasSpellFocusTarget() { return false; }
/// <summary> /// <summary>
/// Check if our current channel spell has attribute SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING /// Check if our current channel spell has attribute SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING
/// </summary> /// </summary>