Core/Units: also allow creatures to generate rage from auto attacks and use their base attack time as base to calculate the generated amount
This commit is contained in:
1 parent
ba10718ea7
commit
9a4a902636
1 file changed
+11
-10
@@ -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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user