Core/Spells: Fix some issues with channeled spells and aura duration mods

Port From (https://github.com/TrinityCore/TrinityCore/commit/b2de3efb4b3e023874b6e28dd3a0a82b2c735ca8)
This commit is contained in:
hondacrx
2021-09-09 10:23:51 -04:00
parent ed98f4a2a4
commit 4573123717
2 changed files with 76 additions and 65 deletions
+11 -5
View File
@@ -721,7 +721,12 @@ namespace Game.Spells
}
}
int CalcMaxDuration(Unit caster)
public int CalcMaxDuration(Unit caster)
{
return CalcMaxDuration(GetSpellInfo(), caster);
}
public static int CalcMaxDuration(SpellInfo spellInfo, WorldObject caster)
{
Player modOwner = null;
int maxDuration;
@@ -729,17 +734,18 @@ namespace Game.Spells
if (caster != null)
{
modOwner = caster.GetSpellModOwner();
maxDuration = caster.CalcSpellDuration(m_spellInfo);
maxDuration = caster.CalcSpellDuration(spellInfo);
}
else
maxDuration = m_spellInfo.GetDuration();
maxDuration = spellInfo.GetDuration();
if (IsPassive() && m_spellInfo.DurationEntry == null)
if (spellInfo.IsPassive() && spellInfo.DurationEntry == null)
maxDuration = -1;
// IsPermanent() checks max duration (which we are supposed to calculate here)
if (maxDuration != -1 && modOwner != null)
modOwner.ApplySpellMod(GetSpellInfo(), SpellModOp.Duration, ref maxDuration);
modOwner.ApplySpellMod(spellInfo, SpellModOp.Duration, ref maxDuration);
return maxDuration;
}