From f25097a00af3b2dc44aedff4567dae399f6ab137 Mon Sep 17 00:00:00 2001 From: Prithu Date: Thu, 13 Apr 2017 02:02:44 +1000 Subject: [PATCH] Fix druid feral form receiving a large damage boost to auto attacks when wielding multi-damage type weapons (#326) * Fixed druid feral form damage scaling incorrectly with weapons that have multiple damage types * Prevent druids gaining double or more damage value on weapons with more than one damage type * Re-worded feral damage count commenting to coincide with Player::CalculateMinMaxDamage change --- src/game/Objects/Unit.cpp | 13 +++++++++---- src/game/StatSystem.cpp | 23 ++++++++++++++++++----- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/game/Objects/Unit.cpp b/src/game/Objects/Unit.cpp index b17079c96..1cf6ed986 100644 --- a/src/game/Objects/Unit.cpp +++ b/src/game/Objects/Unit.cpp @@ -1546,15 +1546,20 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da } bool immune = true; + bool feral = IsInFeralForm(); - for (uint8 i = 0; i < m_weaponDamageCount[damageInfo->attackType]; i++) + // Only get one damage type for feral druids so they don't receive incorrect benefits + // from weapons with multiple types of damage + uint8 actualDamageCount = feral ? 1 : m_weaponDamageCount[damageInfo->attackType]; + for (uint8 i = 0; i < actualDamageCount; i++) { SubDamageInfo *subDamage = &damageInfo->subDamage[i]; - - subDamage->damageSchoolMask = GetTypeId() == TYPEID_PLAYER + + // feral only allowed melee school + subDamage->damageSchoolMask = GetTypeId() == TYPEID_PLAYER && !feral ? GetSchoolMask(GetWeaponDamageSchool(damageInfo->attackType, i)) : GetMeleeDamageSchoolMask(); - + if (damageInfo->target->IsImmuneToDamage(subDamage->damageSchoolMask)) { subDamage->damage = 0; diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index 7f3907931..74781823c 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -395,12 +395,25 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, fl if (IsInFeralForm()) // check if player is druid and in cat or bear forms, non main hand attacks not allowed for this mode so not check attack type { - uint32 lvl = getLevel(); - if (lvl > 60) - lvl = 60; + /* Druids don't use weapons so a weapon damage index > 0 + should not affect their damage. Fixes crazy druid scaling + when using melee weapons with two or more damage types on it */ + if (index > 0) + { + // Note that CalculateDamage will pull max_damage up to 5.0f, + // so they'll still get some extra damage... + weapon_mindamage = 0.0f; + weapon_maxdamage = 0.0f; + } + else + { + uint32 lvl = getLevel(); + if (lvl > 60) + lvl = 60; - weapon_mindamage = lvl * 0.85f * att_speed; - weapon_maxdamage = lvl * 1.25f * att_speed; + weapon_mindamage = lvl * 0.85f * att_speed; + weapon_maxdamage = lvl * 1.25f * att_speed; + } } else if (!CanUseEquippedWeapon(attType)) // check if player not in form but still can't use weapon (broken/etc) {