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:
@@ -1640,19 +1640,13 @@ namespace Game.Entities
|
||||
if (chrSpec == null)
|
||||
return;
|
||||
|
||||
foreach (uint masterySpellId in chrSpec.MasterySpellID)
|
||||
foreach (var (_, aura) in GetOwnedAuras())
|
||||
{
|
||||
Aura aura = GetAura(masterySpellId);
|
||||
if (aura != null)
|
||||
if (aura.GetCasterGUID() == GetGUID() && aura.GetSpellInfo().HasAttribute(SpellAttr8.MasteryAffectsPoints))
|
||||
{
|
||||
foreach (var spellEffectInfo in aura.GetSpellInfo().GetEffects())
|
||||
{
|
||||
float mult = spellEffectInfo.BonusCoefficient;
|
||||
if (MathFunctions.fuzzyEq(mult, 0.0f))
|
||||
continue;
|
||||
|
||||
aura.GetEffect(spellEffectInfo.EffectIndex).ChangeAmount((int)(value * mult));
|
||||
}
|
||||
foreach (var auraEff in aura.GetAuraEffects())
|
||||
if (MathFunctions.fuzzyEq(auraEff.GetSpellEffectInfo().BonusCoefficient, 0.0f))
|
||||
auraEff.RecalculateAmount(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,13 +58,10 @@ namespace Game.Spells
|
||||
|
||||
public int CalculateAmount(Unit caster)
|
||||
{
|
||||
// default amount calculation
|
||||
int amount = 0;
|
||||
Unit unitOwner = GetBase().GetOwner().ToUnit();
|
||||
|
||||
if (!m_spellInfo.HasAttribute(SpellAttr8.MasteryAffectsPoints) || MathFunctions.fuzzyEq(GetSpellEffectInfo().BonusCoefficient, 0.0f))
|
||||
amount = GetSpellEffectInfo().CalcValue(caster, m_baseAmount, GetBase().GetOwner().ToUnit(), GetBase().GetCastItemId(), GetBase().GetCastItemLevel());
|
||||
else if (caster != null && caster.IsTypeId(TypeId.Player))
|
||||
amount = (int)(caster.ToPlayer().m_activePlayerData.Mastery * GetSpellEffectInfo().BonusCoefficient);
|
||||
// default amount calculation
|
||||
int amount = GetSpellEffectInfo().CalcValue(caster, m_baseAmount, unitOwner, GetBase().GetCastItemId(), GetBase().GetCastItemLevel());
|
||||
|
||||
// custom amount calculations go here
|
||||
switch (GetAuraType())
|
||||
@@ -79,7 +76,7 @@ namespace Game.Spells
|
||||
m_canBeRecalculated = false;
|
||||
if (m_spellInfo.ProcFlags == null)
|
||||
break;
|
||||
amount = (int)(GetBase().GetUnitOwner().CountPctFromMaxHealth(10));
|
||||
amount = (int)unitOwner.CountPctFromMaxHealth(10);
|
||||
break;
|
||||
case AuraType.SchoolAbsorb:
|
||||
case AuraType.ManaShield:
|
||||
@@ -91,7 +88,7 @@ namespace Game.Spells
|
||||
if (mountEntry != null)
|
||||
mountType = mountEntry.MountTypeID;
|
||||
|
||||
var mountCapability = GetBase().GetUnitOwner().GetMountCapability(mountType);
|
||||
var mountCapability = unitOwner.GetMountCapability(mountType);
|
||||
if (mountCapability != null)
|
||||
amount = (int)mountCapability.Id;
|
||||
break;
|
||||
@@ -106,7 +103,7 @@ namespace Game.Spells
|
||||
|
||||
if (GetSpellInfo().HasAttribute(SpellAttr10.RollingPeriodic))
|
||||
{
|
||||
var periodicAuras = GetBase().GetUnitOwner().GetAuraEffectsByType(GetAuraType());
|
||||
var periodicAuras = unitOwner.GetAuraEffectsByType(GetAuraType());
|
||||
uint totalTicks = GetTotalTicks();
|
||||
if (totalTicks != 0)
|
||||
{
|
||||
|
||||
@@ -4123,6 +4123,7 @@ namespace Game.Spells
|
||||
value += level * basePointsPerLevel;
|
||||
}
|
||||
}
|
||||
|
||||
// random damage
|
||||
if (casterUnit != null)
|
||||
{
|
||||
@@ -4133,11 +4134,19 @@ namespace Game.Spells
|
||||
if (comboPoints != 0)
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user