From 0449c889512aefd1bb3e7dff1350e82e653a18d6 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 14 Sep 2023 02:59:06 -0400 Subject: [PATCH] Core/Spells: Damage and healing bonus calculation fixes * Spells with SPELL_DAMAGE_CLASS_NONE are now allowed to benefit from spellmods * Fixed SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE and SPELL_AURA_MOD_HEALING_DONE_PCT_VERSUS_TARGET_HEALTH not working for players Port From (https://github.com/TrinityCore/TrinityCore/commit/ac1c0419441a6c0b1a049a3197a35c754e00ea6e) --- Source/Game/Entities/Unit/Unit.Spells.cs | 28 +++++++----------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index a13f50068..5bd29a11f 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -123,17 +123,11 @@ namespace Game.Entities APbonus += GetTotalAttackPowerValue(attType); DoneTotal += (int)(stack * ApCoeffMod * APbonus); } - else - { - // No bonus damage for SPELL_DAMAGE_CLASS_NONE class spells by default - if (spellProto.DmgClass == SpellDmgClass.None) - return (int)Math.Max(pdamage * DoneTotalMod, 0.0f); - } // Default calculation - float coeff = spellEffectInfo.BonusCoefficient; if (DoneAdvertisedBenefit != 0) { + float coeff = spellEffectInfo.BonusCoefficient; Player modOwner1 = GetSpellModOwner(); if (modOwner1) { @@ -448,7 +442,6 @@ namespace Game.Entities DoneAdvertisedBenefit += (uint)((Guardian)this).GetBonusDamage(); // Check for table values - float coeff = spellEffectInfo.BonusCoefficient; if (spellEffectInfo.BonusCoefficientFromAP > 0.0f) { WeaponAttackType attType = (spellProto.IsRangedWeaponSpell() && spellProto.DmgClass != SpellDmgClass.Melee) ? WeaponAttackType.RangedAttack : WeaponAttackType.BaseAttack; @@ -457,16 +450,11 @@ namespace Game.Entities DoneTotal += (int)(spellEffectInfo.BonusCoefficientFromAP * stack * APbonus); } - else if (coeff <= 0.0f) // no AP and no SP coefs, skip - { - // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default - if (spellProto.DmgClass == SpellDmgClass.None) - return (int)Math.Max(healamount * DoneTotalMod, 0.0f); - } // Default calculation if (DoneAdvertisedBenefit != 0) { + float coeff = spellEffectInfo.BonusCoefficient; Player modOwner = GetSpellModOwner(); if (modOwner) { @@ -529,6 +517,9 @@ namespace Game.Entities if (spellProto.SpellFamilyName == SpellFamilyNames.Potion) return 1.0f; + float DoneTotalMod = 1.0f; + + // Healing done percent Player thisPlayer = ToPlayer(); if (thisPlayer != null) { @@ -537,10 +528,10 @@ namespace Game.Entities if (((int)spellProto.GetSchoolMask() & (1 << i)) != 0) maxModDamagePercentSchool = Math.Max(maxModDamagePercentSchool, thisPlayer.m_activePlayerData.ModHealingDonePercent[i]); - return maxModDamagePercentSchool; + DoneTotalMod *= maxModDamagePercentSchool; } - - float DoneTotalMod = 1.0f; + else // SPELL_AURA_MOD_HEALING_DONE_PERCENT is included in m_activePlayerData->ModHealingDonePercent for players + DoneTotalMod *= GetTotalAuraMultiplier(AuraType.ModHealingDonePercent); // bonus against aurastate DoneTotalMod *= GetTotalAuraMultiplier(AuraType.ModDamageDoneVersusAurastate, aurEff => @@ -548,9 +539,6 @@ namespace Game.Entities return victim.HasAuraState((AuraStateType)aurEff.GetMiscValue()); }); - // Healing done percent - DoneTotalMod *= GetTotalAuraMultiplier(AuraType.ModHealingDonePercent); - // bonus from missing health of target float healthPctDiff = 100.0f - victim.GetHealthPct(); foreach (AuraEffect healingDonePctVsTargetHealth in GetAuraEffectsByType(AuraType.ModHealingDonePctVersusTargetHealth))