Created
January 6, 2019 01:22
-
-
Save Langerz82/f4d20148fd29b2eb680fc7fd531b6076 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp | |
index 0acd39162c..5ed939d4bd 100644 | |
--- a/src/server/game/Entities/Unit/Unit.cpp | |
+++ b/src/server/game/Entities/Unit/Unit.cpp | |
@@ -448,8 +448,11 @@ void Unit::Update(uint32 p_time) | |
ModifyAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, HealthAbovePct(75)); | |
} | |
- UpdateSplineMovement(p_time); | |
- i_motionMaster->Update(p_time); | |
+ if (IsMoveAllowed()) | |
+ { | |
+ UpdateSplineMovement(p_time); | |
+ i_motionMaster->Update(p_time); | |
+ } | |
if (!i_AI && (GetTypeId() != TYPEID_PLAYER || IsCharmed())) | |
UpdateCharmAI(); | |
@@ -3119,6 +3122,24 @@ bool Unit::IsMovementPreventedByCasting() const | |
return true; | |
} | |
+bool Unit::IsMoveAllowed() const | |
+{ | |
+ if (!IsChannelMoveAllowed()) | |
+ return false; | |
+ | |
+ return true; | |
+} | |
+ | |
+bool Unit::IsChannelMoveAllowed() const | |
+{ | |
+ // channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute | |
+ if (Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL]) | |
+ if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive()) | |
+ return spell->GetSpellInfo()->IsMoveAllowedChannel(); | |
+ | |
+ return true; | |
+} | |
+ | |
bool Unit::isInFrontInMap(Unit const* target, float distance, float arc) const | |
{ | |
return IsWithinDistInMap(target, distance) && HasInArc(arc, target); | |
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h | |
index c588ef426f..b53f00c1b1 100644 | |
--- a/src/server/game/Entities/Unit/Unit.h | |
+++ b/src/server/game/Entities/Unit/Unit.h | |
@@ -1431,6 +1431,9 @@ class TC_GAME_API Unit : public WorldObject | |
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask = 0) const; | |
float GetAPMultiplier(WeaponAttackType attType, bool normalized) const; | |
+ bool IsMoveAllowed() const; | |
+ bool IsChannelMoveAllowed() const; | |
+ | |
bool isInFrontInMap(Unit const* target, float distance, float arc = float(M_PI)) const; | |
bool isInBackInMap(Unit const* target, float distance, float arc = float(M_PI)) const; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment