mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Unit: 229444b74a follow-up
- IsFocusing is made virtual again, so there's no need to keep a duplicated function
This reverts commit 5043639c56.
This commit is contained in:
@@ -3103,26 +3103,6 @@ void Creature::ReleaseFocus(Spell const* focusSpell, bool withDelay)
|
||||
m_focusDelay = (!IsPet() && withDelay) ? GameTime::GetGameTimeMS() : 0; // don't allow re-target right away to prevent visual bugs
|
||||
}
|
||||
|
||||
bool Creature::IsMovementPreventedByCasting() const
|
||||
{
|
||||
// first check if currently a movement allowed channel is active and we're not casting
|
||||
if (Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL])
|
||||
{
|
||||
if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive())
|
||||
if (spell->GetSpellInfo()->IsMoveAllowedChannel())
|
||||
if (HasUnitState(UNIT_STATE_CASTING))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (const_cast<Creature*>(this)->IsFocusing(nullptr, true))
|
||||
return true;
|
||||
|
||||
if (HasUnitState(UNIT_STATE_CASTING))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Creature::StartPickPocketRefillTimer()
|
||||
{
|
||||
_pickpocketLootRestore = time(nullptr) + sWorld->getIntConfig(CONFIG_CREATURE_PICKPOCKET_REFILL);
|
||||
|
||||
@@ -717,8 +717,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
bool IsFocusing(Spell const* focusSpell = nullptr, bool withDelay = false) override;
|
||||
void ReleaseFocus(Spell const* focusSpell = nullptr, bool withDelay = true);
|
||||
|
||||
bool IsMovementPreventedByCasting() const override;
|
||||
|
||||
// Part of Evade mechanics
|
||||
time_t GetLastDamagedTime() const { return _lastDamagedTime; }
|
||||
void SetLastDamagedTime(time_t val) { _lastDamagedTime = val; }
|
||||
|
||||
@@ -3325,6 +3325,9 @@ bool Unit::IsMovementPreventedByCasting() const
|
||||
if (spell->GetSpellInfo()->IsMoveAllowedChannel())
|
||||
return false;
|
||||
|
||||
if (const_cast<Unit*>(this)->IsFocusing(nullptr, true))
|
||||
return false;
|
||||
|
||||
// prohibit movement for all other spell casts
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1903,7 +1903,9 @@ class TC_GAME_API Unit : public WorldObject
|
||||
int32 GetCurrentSpellCastTime(uint32 spell_id) const;
|
||||
|
||||
virtual bool IsFocusing(Spell const* /*focusSpell*/ = nullptr, bool /*withDelay*/ = false) { return false; }
|
||||
virtual bool IsMovementPreventedByCasting() const;
|
||||
|
||||
// Check if our current channel spell has attribute SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING
|
||||
bool IsMovementPreventedByCasting() const;
|
||||
|
||||
SpellHistory* GetSpellHistory() { return m_spellHistory; }
|
||||
SpellHistory const* GetSpellHistory() const { return m_spellHistory; }
|
||||
|
||||
Reference in New Issue
Block a user