Skip to content

Commit

Permalink
Player: Make shapeshift forms which dont override attack speed use we…
Browse files Browse the repository at this point in the history
…apon damage
  • Loading branch information
killerwife committed Nov 6, 2023
1 parent 21d5cd8 commit 7e32c75
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/game/Entities/StatSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, fl
float weapon_mindamage = GetBaseWeaponDamage(attType, MINDAMAGE, index);
float weapon_maxdamage = GetBaseWeaponDamage(attType, MAXDAMAGE, index);

if (IsNoWeaponShapeShift()) // check if player is in shapeshift which doesnt use weapon
if (IsAttackSpeedOverridenShapeShift()) // forms with no override on attack speed use normal weapon damage
{
uint32 lvl = GetLevel();
if (lvl > 60)
Expand Down
10 changes: 10 additions & 0 deletions src/game/Entities/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11278,6 +11278,16 @@ bool Unit::IsNoWeaponShapeShift() const
return false;
}

bool Unit::IsWeaponSpeedOverridenShapeShift() const
{
// Mirroring clientside gameplay logic
if (ShapeshiftForm form = GetShapeshiftForm())
if (SpellShapeshiftFormEntry const* entry = sSpellShapeshiftFormStore.LookupEntry(form))
return entry->attackSpeed > 0;

return false;
}

SpellAuraHolder* Unit::GetSpellAuraHolder(uint32 spellid) const
{
SpellAuraHolderMap::const_iterator itr = m_spellAuraHolders.find(spellid);
Expand Down
3 changes: 2 additions & 1 deletion src/game/Entities/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ class Unit : public WorldObject
*/
bool CanUseEquippedWeapon(WeaponAttackType attackType) const
{
if (IsNoWeaponShapeShift())
if (IsAttackSpeedOverridenShapeShift())
return false;

switch (attackType)
Expand Down Expand Up @@ -2015,6 +2015,7 @@ class Unit : public WorldObject

bool IsShapeShifted() const;
bool IsNoWeaponShapeShift() const;
bool IsAttackSpeedOverridenShapeShift() const;

bool IsInDisallowedMountForm() const
{
Expand Down

0 comments on commit 7e32c75

Please sign in to comment.