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 21, 2023
1 parent 0c846fb commit 34cdef0
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
Expand Up @@ -430,7 +430,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
Expand Up @@ -12205,6 +12205,16 @@ bool Unit::IsNoWeaponShapeShift() const
return false;
}

bool Unit::IsAttackSpeedOverridenShapeShift() 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
Expand Up @@ -1268,7 +1268,7 @@ class Unit : public WorldObject
*/
bool CanUseEquippedWeapon(WeaponAttackType attackType) const
{
if (IsNoWeaponShapeShift())
if (IsAttackSpeedOverridenShapeShift())
return false;

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

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

bool IsInDisallowedMountForm() const
{
Expand Down

0 comments on commit 34cdef0

Please sign in to comment.