Core/Units: fixed a crash when creatures are having their attack speed increased via aura

This commit is contained in:
Ovahlord committed 2021-11-28 15:11:23 +01:00
1 parent d9d428e5f4
commit a8301ba5f6
2 files changed
+4 -3

No files matched your search

+3 -3
View File
@@ -8812,7 +8812,7 @@ int32 Unit::ModifyPower(Powers power, int32 dVal, bool withPowerUpdate /*= true*
return gain;
}
inline float GetBasePowerRegen(uint32 powerBarId, Powers powerType, bool isInCombat)
/*static */ float Unit::GetBasePowerRegen(uint32 powerBarId, Powers powerType, bool isInCombat)
{
if (powerType != POWER_ALTERNATE_POWER)
{
@@ -11338,8 +11338,8 @@ void ApplyPercentModFloatVar(float& var, float val, bool apply)
void Unit::ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
{
float amount = GetFloatValue(UNIT_FIELD_BASEATTACKTIME + att);
float hasteAmount = GetFloatValue(PLAYER_FIELD_MOD_HASTE);
float rangedHasteAmount = GetFloatValue(PLAYER_FIELD_MOD_RANGED_HASTE);
float hasteAmount = GetTypeId() == TYPEID_PLAYER ? GetFloatValue(PLAYER_FIELD_MOD_HASTE) : 0.f;
float rangedHasteAmount = GetTypeId() == TYPEID_PLAYER ? GetFloatValue(PLAYER_FIELD_MOD_RANGED_HASTE) : 0.f;
float remainingTimePct = (float)m_attackTimer[att] / (GetAttackTime(att) * m_modAttackSpeedPct[att]);
if (val > 0.f)
+1
View File
@@ -975,6 +975,7 @@ class TC_GAME_API Unit : public WorldObject
// returns the change in power
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate = true);
static float GetBasePowerRegen(uint32 powerBarId, Powers powerType, bool isInCombat);
float GetPowerRegen(Powers powerType, bool isInCombat) const;
virtual void RegenerateHealth() { }