[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

@ -856,6 +856,10 @@ typedef std::set<uint64> GuardianPetList;
#define ATTACK_DISPLAY_DELAY 200
#define MAX_PLAYER_STEALTH_DETECT_RANGE 45.0f // max distance for detection targets by player
// Regeneration defines
#define REGEN_TIME_FULL 2000 // For this time difference is computed regen value
#define REGEN_TIME_PRECISE 500 // Used in Spell::CheckPower for precise regeneration in spell cast time
struct SpellProcEventEntry; // used only privately
class MANGOS_DLL_SPEC Unit : public WorldObject
@ -1423,9 +1427,18 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
uint32 SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; }
void SetLastManaUse(uint32 spellCastTime)
{
if (GetTypeId() == TYPEID_PLAYER && !IsUnderLastManaUseEffect())
{
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
}
m_lastManaUse = spellCastTime;
}
bool IsUnderLastManaUseEffect() const;
uint32 GetRegenTimer() const { return m_regenTimer; }
void SetContestedPvP(Player *attackedPlayer = NULL);
void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellEntry const *spellProto = NULL);