Core/Unit: rename IsFocusing method

Port From (https://github.com/TrinityCore/TrinityCore/commit/be4ed9152c1a9c3dab9949eb36d867b763603f60)
This commit is contained in:
hondacrx
2022-01-02 19:25:23 -05:00
parent 32a3480c0f
commit 6ad0b6f159
5 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -254,7 +254,7 @@ namespace Game.AI
{ {
Unit victim = me.SelectVictim(); Unit victim = me.SelectVictim();
if (victim != null) if (victim != null)
if (!me.IsFocusing(null, true) && victim != me.GetVictim()) if (!me.HandleSpellFocus(null, true) && victim != me.GetVictim())
AttackStart(victim); AttackStart(victim);
return me.GetVictim() != null; return me.GetVictim() != null;
+6 -6
View File
@@ -532,7 +532,7 @@ namespace Game.Entities
GetThreatManager().Update(diff); GetThreatManager().Update(diff);
if (m_shouldReacquireTarget && !IsFocusing(null, true)) if (m_shouldReacquireTarget && !HandleSpellFocus(null, true))
{ {
SetTarget(m_suppressedTarget); SetTarget(m_suppressedTarget);
@@ -932,7 +932,7 @@ namespace Game.Entities
if (target && _IsTargetAcceptable(target) && CanCreatureAttack(target)) if (target && _IsTargetAcceptable(target) && CanCreatureAttack(target))
{ {
if (!IsFocusing(null, true)) if (!HandleSpellFocus(null, true))
SetInFront(target); SetInFront(target);
return target; return target;
} }
@@ -1121,7 +1121,7 @@ namespace Game.Entities
return true; return true;
} }
if (IsFocusing(null, true)) if (HandleSpellFocus(null, true))
return true; return true;
if (HasUnitState(UnitState.Casting)) if (HasUnitState(UnitState.Casting))
@@ -2919,7 +2919,7 @@ namespace Game.Entities
public override void SetTarget(ObjectGuid guid) public override void SetTarget(ObjectGuid guid)
{ {
if (IsFocusing(null, true)) if (HandleSpellFocus(null, true))
m_suppressedTarget = guid; m_suppressedTarget = guid;
else else
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Target), guid); SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Target), guid);
@@ -2953,7 +2953,7 @@ namespace Game.Entities
return; return;
// store pre-cast values for target and orientation (used to later restore) // store pre-cast values for target and orientation (used to later restore)
if (!IsFocusing(null, true)) if (!HandleSpellFocus(null, true))
{ // only overwrite these fields if we aren't transitioning from one spell focus to another { // only overwrite these fields if we aren't transitioning from one spell focus to another
m_suppressedTarget = GetTarget(); m_suppressedTarget = GetTarget();
m_suppressedOrientation = GetOrientation(); m_suppressedOrientation = GetOrientation();
@@ -3001,7 +3001,7 @@ namespace Game.Entities
AddUnitState(UnitState.Focusing); AddUnitState(UnitState.Focusing);
} }
public override bool IsFocusing(Spell focusSpell = null, bool withDelay = false) public override bool HandleSpellFocus(Spell focusSpell = null, bool withDelay = false)
{ {
if (!IsAlive()) // dead creatures cannot focus if (!IsAlive()) // dead creatures cannot focus
{ {
+1 -1
View File
@@ -1041,7 +1041,7 @@ namespace Game.Entities
return 0; return 0;
} }
public virtual bool IsFocusing(Spell focusSpell = null, bool withDelay = false) { return false; } public virtual bool HandleSpellFocus(Spell focusSpell = null, bool withDelay = false) { 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
+2 -2
View File
@@ -327,7 +327,7 @@ namespace Game
Unit unit_target2 = spell.m_targets.GetUnitTarget(); Unit unit_target2 = spell.m_targets.GetUnitTarget();
if (unit_target) if (unit_target)
{ {
if (!pet.IsFocusing()) if (!pet.HandleSpellFocus())
pet.SetInFront(unit_target); pet.SetInFront(unit_target);
Player player = unit_target.ToPlayer(); Player player = unit_target.ToPlayer();
if (player) if (player)
@@ -335,7 +335,7 @@ namespace Game
} }
else if (unit_target2) else if (unit_target2)
{ {
if (!pet.IsFocusing()) if (!pet.HandleSpellFocus())
pet.SetInFront(unit_target2); pet.SetInFront(unit_target2);
Player player = unit_target2.ToPlayer(); Player player = unit_target2.ToPlayer();
if (player) if (player)
+1 -1
View File
@@ -3998,7 +3998,7 @@ namespace Game.Spells
{ {
Creature creatureCaster = unitCaster.ToCreature(); Creature creatureCaster = unitCaster.ToCreature();
if (creatureCaster != null) if (creatureCaster != null)
if (!creatureCaster.IsFocusing(this)) if (!creatureCaster.HandleSpellFocus(this))
creatureCaster.FocusTarget(this, Global.ObjAccessor.GetWorldObject(creatureCaster, target.TargetGUID)); creatureCaster.FocusTarget(this, Global.ObjAccessor.GetWorldObject(creatureCaster, target.TargetGUID));
} }
} }