Core/Unit: rename IsFocusing method

Workaround prework till actual facing system rework arrives

(cherry picked from commit ec9f15a5ff)
This commit is contained in:
ccrs
2019-08-03 17:45:06 +02:00
committed by Shauren
parent d2a3bae862
commit be4ed9152c
8 changed files with 14 additions and 14 deletions

View File

@@ -256,7 +256,7 @@ bool CreatureAI::UpdateVictim()
if (!me->HasReactState(REACT_PASSIVE))
{
if (Unit* victim = me->SelectVictim())
if (!me->IsFocusing(nullptr, true) && victim != me->GetVictim())
if (!me->HandleSpellFocus(nullptr, true) && victim != me->GetVictim())
AttackStart(victim);
return me->GetVictim() != nullptr;

View File

@@ -801,7 +801,7 @@ void Creature::Update(uint32 diff)
GetThreatManager().Update(diff);
if (m_shouldReacquireTarget && !IsFocusing(nullptr, true))
if (m_shouldReacquireTarget && !HandleSpellFocus(nullptr, true))
{
SetTarget(m_suppressedTarget);
@@ -1220,7 +1220,7 @@ Unit* Creature::SelectVictim()
if (target && _IsTargetAcceptable(target) && CanCreatureAttack(target))
{
if (!IsFocusing(nullptr, true))
if (!HandleSpellFocus(nullptr, true))
SetInFront(target);
return target;
}
@@ -3194,7 +3194,7 @@ void Creature::SetDisplayFromModel(uint32 modelIdx)
void Creature::SetTarget(ObjectGuid const& guid)
{
if (IsFocusing(nullptr, true))
if (HandleSpellFocus(nullptr, true))
m_suppressedTarget = guid;
else
SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Target), guid);
@@ -3228,7 +3228,7 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
return;
// store pre-cast values for target and orientation (used to later restore)
if (!IsFocusing(nullptr, true))
if (!HandleSpellFocus(nullptr, true))
{ // only overwrite these fields if we aren't transitioning from one spell focus to another
m_suppressedTarget = GetTarget();
m_suppressedOrientation = GetOrientation();
@@ -3278,7 +3278,7 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
AddUnitState(UNIT_STATE_FOCUSING);
}
bool Creature::IsFocusing(Spell const* focusSpell, bool withDelay)
bool Creature::HandleSpellFocus(Spell const* focusSpell, bool withDelay)
{
if (!IsAlive()) // dead creatures cannot focus
{
@@ -3345,7 +3345,7 @@ bool Creature::IsMovementPreventedByCasting() const
return false;
}
if (const_cast<Creature*>(this)->IsFocusing(nullptr, true))
if (const_cast<Creature*>(this)->HandleSpellFocus(nullptr, true))
return true;
if (HasUnitState(UNIT_STATE_CASTING))

View File

@@ -351,7 +351,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
void MustReacquireTarget() { m_shouldReacquireTarget = true; } // flags the Creature for forced (client displayed) target reacquisition in the next ::Update call
void DoNotReacquireTarget() { m_shouldReacquireTarget = false; m_suppressedTarget = ObjectGuid::Empty; SetTarget(ObjectGuid::Empty); m_suppressedOrientation = 0.0f; }
void FocusTarget(Spell const* focusSpell, WorldObject const* target);
bool IsFocusing(Spell const* focusSpell = nullptr, bool withDelay = false) override;
bool HandleSpellFocus(Spell const* focusSpell = nullptr, bool withDelay = false) override;
void ReleaseFocus(Spell const* focusSpell = nullptr, bool withDelay = true);
bool IsMovementPreventedByCasting() const override;

View File

@@ -1503,7 +1503,7 @@ class TC_GAME_API Unit : public WorldObject
virtual SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo) const;
uint32 GetCastSpellXSpellVisualId(SpellInfo const* spellInfo) const override;
virtual bool IsFocusing(Spell const* /*focusSpell*/ = nullptr, bool /*withDelay*/ = false) { return false; }
virtual bool HandleSpellFocus(Spell const* /*focusSpell*/ = nullptr, bool /*withDelay*/ = false) { return false; }
virtual bool IsMovementPreventedByCasting() const;
bool CanCastSpellWhileMoving(SpellInfo const* spellInfo) const;

View File

@@ -337,14 +337,14 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
{
if (unit_target)
{
if (!pet->IsFocusing())
if (!pet->HandleSpellFocus())
pet->SetInFront(unit_target);
if (Player* player = unit_target->ToPlayer())
pet->SendUpdateToPlayer(player);
}
else if (Unit* unit_target2 = spell->m_targets.GetUnitTarget())
{
if (!pet->IsFocusing())
if (!pet->HandleSpellFocus())
pet->SetInFront(unit_target2);
if (Player* player = unit_target2->ToPlayer())
pet->SendUpdateToPlayer(player);

View File

@@ -4778,7 +4778,7 @@ void Spell::SendChannelStart(uint32 duration)
if (m_UniqueTargetInfo.size() == 1 && m_UniqueGOTargetInfo.empty())
if(target.TargetGUID != unitCaster->GetGUID())
if (Creature* creatureCaster = unitCaster->ToCreature())
if (!creatureCaster->IsFocusing(this))
if (!creatureCaster->HandleSpellFocus(this))
creatureCaster->FocusTarget(this, ObjectAccessor::GetWorldObject(*creatureCaster, target.TargetGUID));
}

View File

@@ -1363,7 +1363,7 @@ class npc_the_lich_king_escape_hor : public CreatureScript
if (!me->HasReactState(REACT_PASSIVE))
{
if (Unit* victim = me->SelectVictim())
if (!me->IsFocusing(nullptr, true) && victim != me->GetVictim())
if (!me->HandleSpellFocus(nullptr, true) && victim != me->GetVictim())
AttackStart(victim);
return me->GetVictim() != nullptr;
}

View File

@@ -630,7 +630,7 @@ protected:
if (!me->HasReactState(REACT_PASSIVE))
{
if (Unit* victim = me->SelectVictim())
if (!me->IsFocusing(nullptr, true) && victim != me->GetVictim())
if (!me->HandleSpellFocus(nullptr, true) && victim != me->GetVictim())
AttackStart(victim);
return me->GetVictim() != nullptr;