From 6ad0b6f159c1a723eac6cd3b24750511b47137fd Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 2 Jan 2022 19:25:23 -0500 Subject: [PATCH] Core/Unit: rename IsFocusing method Port From (https://github.com/TrinityCore/TrinityCore/commit/be4ed9152c1a9c3dab9949eb36d867b763603f60) --- Source/Game/AI/CoreAI/CreatureAI.cs | 2 +- Source/Game/Entities/Creature/Creature.cs | 12 ++++++------ Source/Game/Entities/Unit/Unit.Spells.cs | 2 +- Source/Game/Handlers/PetHandler.cs | 4 ++-- Source/Game/Spells/Spell.cs | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/Game/AI/CoreAI/CreatureAI.cs b/Source/Game/AI/CoreAI/CreatureAI.cs index c8ffcff81..c3e2fd181 100644 --- a/Source/Game/AI/CoreAI/CreatureAI.cs +++ b/Source/Game/AI/CoreAI/CreatureAI.cs @@ -254,7 +254,7 @@ namespace Game.AI { Unit victim = me.SelectVictim(); if (victim != null) - if (!me.IsFocusing(null, true) && victim != me.GetVictim()) + if (!me.HandleSpellFocus(null, true) && victim != me.GetVictim()) AttackStart(victim); return me.GetVictim() != null; diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 86b5a5ddd..e25424228 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -532,7 +532,7 @@ namespace Game.Entities GetThreatManager().Update(diff); - if (m_shouldReacquireTarget && !IsFocusing(null, true)) + if (m_shouldReacquireTarget && !HandleSpellFocus(null, true)) { SetTarget(m_suppressedTarget); @@ -932,7 +932,7 @@ namespace Game.Entities if (target && _IsTargetAcceptable(target) && CanCreatureAttack(target)) { - if (!IsFocusing(null, true)) + if (!HandleSpellFocus(null, true)) SetInFront(target); return target; } @@ -1121,7 +1121,7 @@ namespace Game.Entities return true; } - if (IsFocusing(null, true)) + if (HandleSpellFocus(null, true)) return true; if (HasUnitState(UnitState.Casting)) @@ -2919,7 +2919,7 @@ namespace Game.Entities public override void SetTarget(ObjectGuid guid) { - if (IsFocusing(null, true)) + if (HandleSpellFocus(null, true)) m_suppressedTarget = guid; else SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Target), guid); @@ -2953,7 +2953,7 @@ namespace Game.Entities return; // 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 m_suppressedTarget = GetTarget(); m_suppressedOrientation = GetOrientation(); @@ -3001,7 +3001,7 @@ namespace Game.Entities 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 { diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index d78391201..53ff79c87 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -1041,7 +1041,7 @@ namespace Game.Entities 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; } /// /// Check if our current channel spell has attribute SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING diff --git a/Source/Game/Handlers/PetHandler.cs b/Source/Game/Handlers/PetHandler.cs index d36ca6da0..dbb77221c 100644 --- a/Source/Game/Handlers/PetHandler.cs +++ b/Source/Game/Handlers/PetHandler.cs @@ -327,7 +327,7 @@ namespace Game Unit unit_target2 = spell.m_targets.GetUnitTarget(); if (unit_target) { - if (!pet.IsFocusing()) + if (!pet.HandleSpellFocus()) pet.SetInFront(unit_target); Player player = unit_target.ToPlayer(); if (player) @@ -335,7 +335,7 @@ namespace Game } else if (unit_target2) { - if (!pet.IsFocusing()) + if (!pet.HandleSpellFocus()) pet.SetInFront(unit_target2); Player player = unit_target2.ToPlayer(); if (player) diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 05becff37..d298d3314 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -3998,7 +3998,7 @@ namespace Game.Spells { Creature creatureCaster = unitCaster.ToCreature(); if (creatureCaster != null) - if (!creatureCaster.IsFocusing(this)) + if (!creatureCaster.HandleSpellFocus(this)) creatureCaster.FocusTarget(this, Global.ObjAccessor.GetWorldObject(creatureCaster, target.TargetGUID)); } }