aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Creature
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2017-04-27 19:40:23 +0200
committerccrs <ccrs@users.noreply.github.com>2017-04-27 19:40:23 +0200
commit5a2f0ce29e29d934c200f617fec6dad619fab9a5 (patch)
tree6c97c9d932be47f8c81a859974b60c9008b02a13 /src/server/game/Entities/Creature
parent67a6e619088be3e441175e6c3cc8a13a8f097e5f (diff)
Core/Unit: revert 3ea46e57af
After discussion we realized, ariel and me, that Creature and Unit IsMovementPreventedByCasting() have not the same checks (order matters)
Diffstat (limited to 'src/server/game/Entities/Creature')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp20
-rw-r--r--src/server/game/Entities/Creature/Creature.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 07ab65ac093..375997fe636 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -3103,6 +3103,26 @@ 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);
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index f5cbf4c46c4..cb02c437d2f 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -717,6 +717,8 @@ 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; }