Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Core/Units: also allow creatures to generate rage from auto attacks a…
Browse files Browse the repository at this point in the history
…nd use their base attack time as base to calculate the generated amount
  • Loading branch information
Ovahlord committed Dec 12, 2023
1 parent ba10718 commit 9a4a902
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1903,20 +1903,21 @@ static float GetArmorReduction(float armor, uint8 attackerLevel)
// Calculates the normalized rage amount per weapon swing
inline static uint32 CalcMeleeAttackRageGain(Unit const* attacker, Unit const* victim, WeaponAttackType attType)
{
Player const* playerAttacker = attacker->ToPlayer();
if (!playerAttacker)
return 0;

float attackDelay = [&]()
{
if (!playerAttacker->IsInFeralForm())
if (Player const* playerAttacker = attacker->ToPlayer())
{
Item const* weapon = playerAttacker->GetWeaponForAttack(attType);
if (weapon)
return static_cast<float>(weapon->GetTemplate()->GetDelay());
if (!playerAttacker->IsInFeralForm())
{
Item const* weapon = playerAttacker->GetWeaponForAttack(attType);
if (weapon)
return static_cast<float>(weapon->GetTemplate()->GetDelay());
}
else if (SpellShapeshiftFormEntry const* shapeShiftFormEntry = sSpellShapeshiftFormStore.LookupEntry(playerAttacker->GetShapeshiftForm()))
return static_cast<float>(shapeShiftFormEntry->CombatRoundTime);
}
else if (SpellShapeshiftFormEntry const* shapeShiftFormEntry = sSpellShapeshiftFormStore.LookupEntry(playerAttacker->GetShapeshiftForm()))
return static_cast<float>(shapeShiftFormEntry->CombatRoundTime);
else if (Creature const* creature = attacker->ToCreature())
return static_cast<float>(creature->GetCreatureTemplate()->BaseAttackTime);

return 0.f;

Expand Down

0 comments on commit 9a4a902

Please sign in to comment.