Core/Spells: Implemented SpellValueMod duration
Port From (https://github.com/TrinityCore/TrinityCore/commit/a048475cb037a3a3672723c1f2ab32a343142927)
This commit is contained in:
@@ -396,7 +396,8 @@ namespace Framework.Constants
|
|||||||
MaxTargets,
|
MaxTargets,
|
||||||
AuraStack,
|
AuraStack,
|
||||||
CritChance,
|
CritChance,
|
||||||
DurationPct
|
DurationPct,
|
||||||
|
Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CombatRating
|
public enum CombatRating
|
||||||
|
|||||||
@@ -2048,7 +2048,9 @@ namespace Game.Spells
|
|||||||
|
|
||||||
spellAura.SetDiminishGroup(hitInfo.DRGroup);
|
spellAura.SetDiminishGroup(hitInfo.DRGroup);
|
||||||
|
|
||||||
hitInfo.AuraDuration = caster.ModSpellDuration(m_spellInfo, unit, hitInfo.AuraDuration, hitInfo.Positive, spellAura.GetEffectMask());
|
if (!m_spellValue.Duration.HasValue)
|
||||||
|
{
|
||||||
|
hitInfo.AuraDuration *= caster.ModSpellDuration(m_spellInfo, unit, hitInfo.AuraDuration, hitInfo.Positive, spellAura.GetEffectMask());
|
||||||
|
|
||||||
if (hitInfo.AuraDuration > 0)
|
if (hitInfo.AuraDuration > 0)
|
||||||
{
|
{
|
||||||
@@ -2076,6 +2078,9 @@ namespace Game.Spells
|
|||||||
hitInfo.AuraDuration = (int)(origDuration * m_originalCaster.m_unitData.ModCastingSpeed);
|
hitInfo.AuraDuration = (int)(origDuration * m_originalCaster.m_unitData.ModCastingSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
hitInfo.AuraDuration = m_spellValue.Duration.Value;
|
||||||
|
|
||||||
if (hitInfo.AuraDuration != spellAura.GetMaxDuration())
|
if (hitInfo.AuraDuration != spellAura.GetMaxDuration())
|
||||||
{
|
{
|
||||||
@@ -2799,7 +2804,9 @@ namespace Game.Spells
|
|||||||
if (m_spellInfo.IsChanneled())
|
if (m_spellInfo.IsChanneled())
|
||||||
{
|
{
|
||||||
int duration = m_spellInfo.GetDuration();
|
int duration = m_spellInfo.GetDuration();
|
||||||
if (duration > 0)
|
if (duration > 0 || m_spellValue.Duration.HasValue)
|
||||||
|
{
|
||||||
|
if (!m_spellValue.Duration.HasValue)
|
||||||
{
|
{
|
||||||
// First mod_duration then haste - see Missile Barrage
|
// First mod_duration then haste - see Missile Barrage
|
||||||
// Apply duration mod
|
// Apply duration mod
|
||||||
@@ -2811,11 +2818,15 @@ namespace Game.Spells
|
|||||||
|
|
||||||
// Apply haste mods
|
// Apply haste mods
|
||||||
m_caster.ModSpellDurationTime(m_spellInfo, ref duration, this);
|
m_caster.ModSpellDurationTime(m_spellInfo, ref duration, this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
duration = m_spellValue.Duration.Value;
|
||||||
|
|
||||||
|
m_channeledDuration = duration;
|
||||||
SendChannelStart((uint)duration);
|
SendChannelStart((uint)duration);
|
||||||
}
|
}
|
||||||
else if (duration == -1)
|
else if (duration == -1)
|
||||||
SendChannelStart((uint)duration);
|
SendChannelStart(unchecked((uint)duration));
|
||||||
|
|
||||||
if (duration != 0)
|
if (duration != 0)
|
||||||
{
|
{
|
||||||
@@ -6424,7 +6435,10 @@ namespace Game.Spells
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//check pushback reduce
|
//check pushback reduce
|
||||||
int delaytime = MathFunctions.CalculatePct(m_spellInfo.GetDuration(), 25); // channeling delay is normally 25% of its time per hit
|
// should be affected by modifiers, not take the dbc duration.
|
||||||
|
int duration = ((m_channeledDuration > 0) ? m_channeledDuration : m_spellInfo.GetDuration());
|
||||||
|
|
||||||
|
int delaytime = MathFunctions.CalculatePct(duration, 25); // channeling delay is normally 25% of its time per hit
|
||||||
int delayReduce = 100; // must be initialized to 100 for percent modifiers
|
int delayReduce = 100; // must be initialized to 100 for percent modifiers
|
||||||
|
|
||||||
Player player = unitCaster.GetSpellModOwner();
|
Player player = unitCaster.GetSpellModOwner();
|
||||||
@@ -6879,6 +6893,9 @@ namespace Game.Spells
|
|||||||
case SpellValueMod.DurationPct:
|
case SpellValueMod.DurationPct:
|
||||||
m_spellValue.DurationMul = (float)value / 100.0f;
|
m_spellValue.DurationMul = (float)value / 100.0f;
|
||||||
break;
|
break;
|
||||||
|
case SpellValueMod.Duration:
|
||||||
|
m_spellValue.Duration.Set(value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7415,6 +7432,7 @@ namespace Game.Spells
|
|||||||
|
|
||||||
List<SpellPowerCost> m_powerCost = new();
|
List<SpellPowerCost> m_powerCost = new();
|
||||||
int m_casttime; // Calculated spell cast time initialized only in Spell.prepare
|
int m_casttime; // Calculated spell cast time initialized only in Spell.prepare
|
||||||
|
int m_channeledDuration; // Calculated channeled spell duration in order to calculate correct pushback.
|
||||||
bool m_canReflect; // can reflect this spell?
|
bool m_canReflect; // can reflect this spell?
|
||||||
bool m_autoRepeat;
|
bool m_autoRepeat;
|
||||||
byte m_runesState;
|
byte m_runesState;
|
||||||
@@ -8073,6 +8091,7 @@ namespace Game.Spells
|
|||||||
public int AuraStackAmount;
|
public int AuraStackAmount;
|
||||||
public float DurationMul;
|
public float DurationMul;
|
||||||
public float CriticalChance;
|
public float CriticalChance;
|
||||||
|
public Optional<int> Duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spell modifier (used for modify other spells)
|
// Spell modifier (used for modify other spells)
|
||||||
|
|||||||
Reference in New Issue
Block a user