diff options
author | Yehonal <yehonal.azeroth@gmail.com> | 2017-11-16 22:29:59 +0000 |
---|---|---|
committer | Yehonal <yehonal.azeroth@gmail.com> | 2017-11-20 11:36:46 +0100 |
commit | 3e9ffa3e33f99cc020061c6557a3806408fd5f5c (patch) | |
tree | 55cbf5a02cf9797c5d3b31d51548a56f8560b694 /src/game/Entities/Unit/Unit.cpp | |
parent | bc726a2f1631a2bc6bc4622d90a464e51cd2b38d (diff) |
Implemented GetPhaseByAuras removing redundant code (DRY)
Diffstat (limited to 'src/game/Entities/Unit/Unit.cpp')
-rw-r--r-- | src/game/Entities/Unit/Unit.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/game/Entities/Unit/Unit.cpp b/src/game/Entities/Unit/Unit.cpp index d6e453c5a5..40cc595000 100644 --- a/src/game/Entities/Unit/Unit.cpp +++ b/src/game/Entities/Unit/Unit.cpp @@ -17556,6 +17556,17 @@ float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, i return missChance; } +uint32 Unit::GetPhaseByAuras() const +{ + uint32 currentPhase = 0; + AuraEffectList const& phases = GetAuraEffectsByType(SPELL_AURA_PHASE); + if (!phases.empty()) + for (AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr) + currentPhase |= (*itr)->GetMiscValue(); + + return currentPhase; +} + void Unit::SetPhaseMask(uint32 newPhaseMask, bool update) { if (newPhaseMask == GetPhaseMask()) |