From 2dd7fcba0c37b85f90aae6eb3240829abbeae65e Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 9 Feb 2021 13:35:37 -0500 Subject: [PATCH] Core/Auras: Handle SPELL_AURA_MOD_AUTOATTACK_DAMAGE Port From (https://github.com/TrinityCore/TrinityCore/commit/964340bb764baab75830cfe298d1346ceae84c61) --- .../Framework/Constants/Spells/SpellAuraConst.cs | 2 +- Source/Game/Entities/Unit/Unit.Combat.cs | 15 +++++++++++---- Source/Game/Spells/Auras/AuraEffect.cs | 1 - 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Source/Framework/Constants/Spells/SpellAuraConst.cs b/Source/Framework/Constants/Spells/SpellAuraConst.cs index ba6844d7c..12d24a92b 100644 --- a/Source/Framework/Constants/Spells/SpellAuraConst.cs +++ b/Source/Framework/Constants/Spells/SpellAuraConst.cs @@ -365,7 +365,7 @@ namespace Framework.Constants ModSpellCategoryCooldown = 341, ModMeleeRangedHaste2 = 342, ModMeleeDamageFromCaster = 343, - ModAutoattackDamage = 344, + ModAutoAttackDamage = 344, BypassArmorForCaster = 345, EnableAltPower = 346, // Nyi ModSpellCooldownByHaste = 347, diff --git a/Source/Game/Entities/Unit/Unit.Combat.cs b/Source/Game/Entities/Unit/Unit.Combat.cs index 6e95125a1..f97c39049 100644 --- a/Source/Game/Entities/Unit/Unit.Combat.cs +++ b/Source/Game/Entities/Unit/Unit.Combat.cs @@ -2830,11 +2830,12 @@ namespace Game.Entities // Done total percent damage auras float DoneTotalMod = 1.0f; - // Some spells don't benefit from pct done mods - if (spellProto != null && !spellProto.HasAttribute(SpellAttr6.NoDonePctDamageMods)) + + if (spellProto != null) { + // Some spells don't benefit from pct done mods // mods for SPELL_SCHOOL_MASK_NORMAL are already factored in base melee damage calculation - if (!spellProto.GetSchoolMask().HasAnyFlag(SpellSchoolMask.Normal)) + if (!spellProto.HasAttribute(SpellAttr6.NoDonePctDamageMods) && !spellProto.GetSchoolMask().HasAnyFlag(SpellSchoolMask.Normal)) { float maxModDamagePercentSchool = 0.0f; Player thisPlayer = ToPlayer(); @@ -2851,9 +2852,15 @@ namespace Game.Entities DoneTotalMod *= maxModDamagePercentSchool; } + else + { + // melee attack + foreach (AuraEffect autoAttackDamage in GetAuraEffectsByType(AuraType.ModAutoAttackDamage)) + MathFunctions.AddPct(ref DoneTotalMod, autoAttackDamage.GetAmount()); + } } - DoneTotalMod *= GetTotalAuraMultiplierByMiscMask(AuraType.ModDamageDoneVersus, (uint)creatureTypeMask); + DoneTotalMod *= GetTotalAuraMultiplierByMiscMask(AuraType.ModDamageDoneVersus, creatureTypeMask); // bonus against aurastate DoneTotalMod *= GetTotalAuraMultiplier(AuraType.ModDamageDoneVersusAurastate, aurEff => diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 2b54d8dcd..9e970e166 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -979,7 +979,6 @@ namespace Game.Spells [AuraEffectHandler(AuraType.Unk335)] [AuraEffectHandler(AuraType.MountRestrictions)] [AuraEffectHandler(AuraType.ModResurrectedHealthByGuildMember)] - [AuraEffectHandler(AuraType.ModAutoattackDamage)] [AuraEffectHandler(AuraType.ModSpellCooldownByHaste)] [AuraEffectHandler(AuraType.ModGatheringItemsGainedPercent)] [AuraEffectHandler(AuraType.Unk351)]