Core/Spells: Fixed spells that scale value with master not being affected by SpellModOp::Points and SpellModOp::PointsIndex spellmods

Port From (https://github.com/TrinityCore/TrinityCore/commit/bb67a4279145c37c2106d2bd7a54b14186502602)
This commit is contained in:
Hondacrx
2025-08-09 21:31:29 -04:00
parent 13554e08ab
commit 59cfc97e15
3 changed files with 23 additions and 23 deletions
+5 -11
View File
@@ -1640,19 +1640,13 @@ namespace Game.Entities
if (chrSpec == null) if (chrSpec == null)
return; return;
foreach (uint masterySpellId in chrSpec.MasterySpellID) foreach (var (_, aura) in GetOwnedAuras())
{ {
Aura aura = GetAura(masterySpellId); if (aura.GetCasterGUID() == GetGUID() && aura.GetSpellInfo().HasAttribute(SpellAttr8.MasteryAffectsPoints))
if (aura != null)
{ {
foreach (var spellEffectInfo in aura.GetSpellInfo().GetEffects()) foreach (var auraEff in aura.GetAuraEffects())
{ if (MathFunctions.fuzzyEq(auraEff.GetSpellEffectInfo().BonusCoefficient, 0.0f))
float mult = spellEffectInfo.BonusCoefficient; auraEff.RecalculateAmount(this);
if (MathFunctions.fuzzyEq(mult, 0.0f))
continue;
aura.GetEffect(spellEffectInfo.EffectIndex).ChangeAmount((int)(value * mult));
}
} }
} }
} }
+6 -9
View File
@@ -58,13 +58,10 @@ namespace Game.Spells
public int CalculateAmount(Unit caster) public int CalculateAmount(Unit caster)
{ {
// default amount calculation Unit unitOwner = GetBase().GetOwner().ToUnit();
int amount = 0;
if (!m_spellInfo.HasAttribute(SpellAttr8.MasteryAffectsPoints) || MathFunctions.fuzzyEq(GetSpellEffectInfo().BonusCoefficient, 0.0f)) // default amount calculation
amount = GetSpellEffectInfo().CalcValue(caster, m_baseAmount, GetBase().GetOwner().ToUnit(), GetBase().GetCastItemId(), GetBase().GetCastItemLevel()); int amount = GetSpellEffectInfo().CalcValue(caster, m_baseAmount, unitOwner, GetBase().GetCastItemId(), GetBase().GetCastItemLevel());
else if (caster != null && caster.IsTypeId(TypeId.Player))
amount = (int)(caster.ToPlayer().m_activePlayerData.Mastery * GetSpellEffectInfo().BonusCoefficient);
// custom amount calculations go here // custom amount calculations go here
switch (GetAuraType()) switch (GetAuraType())
@@ -79,7 +76,7 @@ namespace Game.Spells
m_canBeRecalculated = false; m_canBeRecalculated = false;
if (m_spellInfo.ProcFlags == null) if (m_spellInfo.ProcFlags == null)
break; break;
amount = (int)(GetBase().GetUnitOwner().CountPctFromMaxHealth(10)); amount = (int)unitOwner.CountPctFromMaxHealth(10);
break; break;
case AuraType.SchoolAbsorb: case AuraType.SchoolAbsorb:
case AuraType.ManaShield: case AuraType.ManaShield:
@@ -91,7 +88,7 @@ namespace Game.Spells
if (mountEntry != null) if (mountEntry != null)
mountType = mountEntry.MountTypeID; mountType = mountEntry.MountTypeID;
var mountCapability = GetBase().GetUnitOwner().GetMountCapability(mountType); var mountCapability = unitOwner.GetMountCapability(mountType);
if (mountCapability != null) if (mountCapability != null)
amount = (int)mountCapability.Id; amount = (int)mountCapability.Id;
break; break;
@@ -106,7 +103,7 @@ namespace Game.Spells
if (GetSpellInfo().HasAttribute(SpellAttr10.RollingPeriodic)) if (GetSpellInfo().HasAttribute(SpellAttr10.RollingPeriodic))
{ {
var periodicAuras = GetBase().GetUnitOwner().GetAuraEffectsByType(GetAuraType()); var periodicAuras = unitOwner.GetAuraEffectsByType(GetAuraType());
uint totalTicks = GetTotalTicks(); uint totalTicks = GetTotalTicks();
if (totalTicks != 0) if (totalTicks != 0)
{ {
+12 -3
View File
@@ -4123,6 +4123,7 @@ namespace Game.Spells
value += level * basePointsPerLevel; value += level * basePointsPerLevel;
} }
} }
// random damage // random damage
if (casterUnit != null) if (casterUnit != null)
{ {
@@ -4133,11 +4134,19 @@ namespace Game.Spells
if (comboPoints != 0) if (comboPoints != 0)
value += comboDamage * comboPoints; value += comboDamage * comboPoints;
} }
if (caster != null)
value = caster.ApplyEffectModifiers(_spellInfo, EffectIndex, value);
} }
if (_spellInfo.HasAttribute(SpellAttr8.MasteryAffectsPoints))
{
Player playerCaster = caster?.ToPlayer();
if (playerCaster != null)
value += playerCaster.m_activePlayerData.Mastery * BonusCoefficient;
}
if (caster != null)
value = caster.ApplyEffectModifiers(_spellInfo, EffectIndex, value);
return (int)Math.Round(value); return (int)Math.Round(value);
} }