[8477] Implemented "on demand" regeneration of power in Spell::CheckPower (limited to 500ms frequency).

Correctly set UNIT_FLAG2_REGENERATE_POWER to notify client to stop/start regen in bar.
thx. also for nos4r2zod

From original patch was removed usage of getMSTime() and rewrited this part.

Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
Trazom 2009-09-06 01:26:19 +02:00 committed by ApoC
parent 7a2df3c309
commit dffa5d43bd
6 changed files with 63 additions and 32 deletions

View file

@ -5039,6 +5039,15 @@ SpellCastResult Spell::CheckPower()
if(m_CastItem)
return SPELL_CAST_OK;
// Do precise power regen on spell cast
if (m_powerCost > 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
{
Player* playerCaster = (Player*)m_caster;
uint32 diff = REGEN_TIME_FULL - m_caster->GetRegenTimer();
if (diff >= REGEN_TIME_PRECISE)
playerCaster->RegenerateAll(diff);
}
// health as power used - need check health amount
if(m_spellInfo->powerType == POWER_HEALTH)
{