Implemented GetPhaseByAuras removing redundant code (DRY)

This commit is contained in:
Yehonal 2017-11-16 22:29:59 +00:00
parent bc726a2f16
commit 3e9ffa3e33
4 changed files with 19 additions and 23 deletions

View file

@ -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())