Hello people. I am trying to make a haste mod where if you add more haste your attack speed time is getting lower and you hit faster. The increasement of the haste and the speed is working pretty well but i want to make a cap ,like if your haste is more than 1600, your attack speed to be LOWEST, i mean 0.00 and you hit the fastest. This is the increasement formula code:
void Player::ApplyRatingMod(CombatRating combatRating, int32 value, bool apply)
{
float oldRating = m_baseRatingValue[combatRating];
m_baseRatingValue[combatRating] += (apply ? value : -value);
// explicit affected values
float const multiplier = GetRatingMultiplier(combatRating);
float const oldVal = oldRating * multiplier;
float const newVal = m_baseRatingValue[combatRating] * multiplier;
float const oldValh = (oldRating * multiplier) * 62.0f;
float const newValh = (m_baseRatingValue[combatRating] * multiplier) * 62.0f;
//Player* player;
switch (combatRating)
{
case CR_HASTE_MELEE:
ApplyAttackTimePercentMod(BASE_ATTACK, oldValh, false);
ApplyAttackTimePercentMod(OFF_ATTACK, oldValh, false);
ApplyAttackTimePercentMod(BASE_ATTACK, newValh, true);
ApplyAttackTimePercentMod(OFF_ATTACK, newValh, true);
break;
case CR_HASTE_RANGED:
ApplyAttackTimePercentMod(RANGED_ATTACK, oldValh, false);
ApplyAttackTimePercentMod(RANGED_ATTACK, newValh, true);
break;
case CR_HASTE_SPELL:
ApplyCastTimePercentMod(oldValh, false);
ApplyCastTimePercentMod(newValh, true);
break;
default:
break;
}
And this is the code where i dont know what i m doing for the > 1600 cap and i know that my method is not right. Code :
void Object::SetStatInt32Value(uint16 index, int32 value)
{
if (value < 0)
value = 0;
if (index == 28 || index == 29 || index == 30 || index == 36 && value > 1600)
value = 30000;
SetUInt32Value(index, uint32(value));
}
index 28 is melee haste, 29 spell , 30 ranged and 36 is the global haste if im not wrong.
So please can you help me with it ?