Created
May 19, 2011 14:38
-
-
Save SeTM/980888 to your computer and use it in GitHub Desktop.
This file contains 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
void Unit::CalculateAuraPeriodicTime(SpellEntry const* spellProto, uint32* periodicTime) | |
{ | |
bool applyHaste = (spellProto->AttributesEx5 & SPELL_ATTR_EX5_AFFECTED_BY_HASTE) != 0; | |
if (!applyHaste) | |
{ | |
Unit::AuraList const& mModByHaste = GetAurasByType(SPELL_AURA_MOD_PERIODIC_HASTE); | |
for (Unit::AuraList::const_iterator itr = mModByHaste.begin(); itr != mModByHaste.end(); ++itr) | |
{ | |
if ((*itr)->isAffectedOnSpell(spellProto)) | |
{ | |
applyHaste = true; | |
break; | |
} | |
} | |
} | |
Player* modOwner = GetSpellModOwner(); | |
uint32 _periodicTime = periodicTime ? *periodicTime : 0; | |
if (_periodicTime) | |
{ | |
int32 ticks = GetSpellDuration(spellProto) / _periodicTime; | |
if (modOwner) | |
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_ACTIVATION_TIME, _periodicTime); | |
// Calculate new periodic timer | |
if (applyHaste) | |
_periodicTime = ticks == 0 ? _periodicTime : CalculateSpellDuration(spellProto, this) / ticks; | |
*periodicTime = _periodicTime; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment