Skip to content

Commit

Permalink
add cooldown to proc
Browse files Browse the repository at this point in the history
  • Loading branch information
sogladev committed May 15, 2024
1 parent 8ad1744 commit 25b6102
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,40 +909,32 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader
{
PrepareAuraScript(spell_sindragosa_unchained_magic_AuraScript);

std::map<uint32, uint32> _lastMSTimeForSpell;

bool Validate(SpellInfo const* /*spellInfo*/) override
{
_lastMSTimeForSpell.clear();
return true;
}

bool CheckProc(ProcEventInfo& eventInfo)
bool AfterCheckProc(ProcEventInfo& /*eventInfo*/, bool isTriggeredAtSpellProcEvent)
{
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo)
if (!isTriggeredAtSpellProcEvent)
{
return false;

}
uint32 currMSTime = GameTime::GetGameTimeMS().count();
std::map<uint32, uint32>::iterator itr = _lastMSTimeForSpell.find(spellInfo->Id);
if (itr != _lastMSTimeForSpell.end())
if (_lastMSTime && getMSTimeDiff(_lastMSTime, currMSTime) < 600)
{
uint32 lastMSTime = itr->second;
itr->second = currMSTime;
if (getMSTimeDiff(lastMSTime, currMSTime) < 600)
return false;

return true;
return false;
}

_lastMSTimeForSpell[spellInfo->Id] = currMSTime;
_lastMSTime = currMSTime;
return true;
}

void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_sindragosa_unchained_magic_AuraScript::CheckProc);
DoAfterCheckProc += AuraAfterCheckProcFn(spell_sindragosa_unchained_magic_AuraScript::AfterCheckProc);
}
private:
uint32 _lastMSTime;
};

AuraScript* GetAuraScript() const override
Expand Down

0 comments on commit 25b6102

Please sign in to comment.