Core/Spells: Fixed PROC_HIT_DISPEL and PROC_HIT_INTERRUPT on procs using PROC_SPELL_PHASE_HIT phase

Port From (https://github.com/TrinityCore/TrinityCore/commit/0706a114bbfd786434921bf95d0fbd6a5596fcb3)
This commit is contained in:
Hondacrx
2025-03-10 21:07:34 -04:00
parent 0d831c3273
commit af43ed5519
3 changed files with 15 additions and 15 deletions
+10 -10
View File
@@ -8839,6 +8839,7 @@ namespace Game.Spells
public int[] AuraBasePoints = new int[SpellConst.MaxEffects];
public bool Positive = true;
public UnitAura HitAura;
public ProcFlagsHit ProcHitMask;
Unit _spellHitTarget; // changed for example by reflect
bool _enablePVP; // need to enable PVP at DoDamageAndTriggers?
@@ -8943,7 +8944,6 @@ namespace Game.Spells
ProcFlagsInit procAttacker = spell.m_procAttacker;
ProcFlagsInit procVictim = spell.m_procVictim;
ProcFlagsSpellType procSpellType = ProcFlagsSpellType.None;
ProcFlagsHit hitMask = ProcFlagsHit.None;
// Spells with this flag cannot trigger if effect is cast on self
bool canEffectTrigger = spell.unitTarget.CanProc();
@@ -9028,11 +9028,11 @@ namespace Game.Spells
int addhealth = spell.m_healing;
if (IsCrit)
{
hitMask |= ProcFlagsHit.Critical;
ProcHitMask |= ProcFlagsHit.Critical;
addhealth = Unit.SpellCriticalHealingBonus(caster, spell.m_spellInfo, addhealth, null);
}
else
hitMask |= ProcFlagsHit.Normal;
ProcHitMask |= ProcFlagsHit.Normal;
healInfo = new(caster, spell.unitTarget, (uint)addhealth, spell.m_spellInfo, spell.m_spellInfo.GetSchoolMask());
caster.HealBySpell(healInfo, IsCrit);
@@ -9052,7 +9052,7 @@ namespace Game.Spells
// Check damage immunity
if (spell.unitTarget.IsImmunedToDamage(caster, spell.m_spellInfo))
{
hitMask = ProcFlagsHit.Immune;
ProcHitMask = ProcFlagsHit.Immune;
spell.m_damage = 0;
// no packet found in sniffs
@@ -9065,7 +9065,7 @@ namespace Game.Spells
caster.CalculateSpellDamageTaken(damageInfo, spell.m_damage, spell.m_spellInfo, spell.m_attackType, IsCrit, MissCondition == SpellMissInfo.Block, spell);
Unit.DealDamageMods(damageInfo.attacker, damageInfo.target, ref damageInfo.damage, ref damageInfo.absorb);
hitMask |= Unit.CreateProcHitMask(damageInfo, MissCondition);
ProcHitMask |= Unit.CreateProcHitMask(damageInfo, MissCondition);
procVictim.Or(ProcFlags.TakeAnyDamage);
spell.m_damage = (int)damageInfo.damage;
@@ -9087,7 +9087,7 @@ namespace Game.Spells
// Do triggers for unit
if (canEffectTrigger)
{
spellDamageInfo = new(damageInfo, DamageEffectType.SpellDirect, spell.m_attackType, hitMask);
spellDamageInfo = new(damageInfo, DamageEffectType.SpellDirect, spell.m_attackType, ProcHitMask);
procSpellType |= ProcFlagsSpellType.Damage;
}
}
@@ -9097,11 +9097,11 @@ namespace Game.Spells
{
// Fill base damage struct (unitTarget - is real spell target)
SpellNonMeleeDamage damageInfo = new(caster, spell.unitTarget, spell.m_spellInfo, spell.m_SpellVisual, spell.m_spellSchoolMask);
hitMask |= Unit.CreateProcHitMask(damageInfo, MissCondition);
ProcHitMask |= Unit.CreateProcHitMask(damageInfo, MissCondition);
// Do triggers for unit
if (canEffectTrigger)
{
spellDamageInfo = new(damageInfo, DamageEffectType.NoDamage, spell.m_attackType, hitMask);
spellDamageInfo = new(damageInfo, DamageEffectType.NoDamage, spell.m_attackType, ProcHitMask);
procSpellType |= ProcFlagsSpellType.NoDmgHeal;
}
@@ -9117,7 +9117,7 @@ namespace Game.Spells
// Do triggers for unit
if (canEffectTrigger)
{
Unit.ProcSkillsAndAuras(caster, spell.unitTarget, procAttacker, procVictim, procSpellType, ProcFlagsSpellPhase.Hit, hitMask, spell, spellDamageInfo, healInfo);
Unit.ProcSkillsAndAuras(caster, spell.unitTarget, procAttacker, procVictim, procSpellType, ProcFlagsSpellPhase.Hit, ProcHitMask, spell, spellDamageInfo, healInfo);
// item spells (spell hit of non-damage spell may also activate items, for example seal of corruption hidden hit)
if (caster.IsPlayer() && procSpellType.HasAnyFlag(ProcFlagsSpellType.Damage | ProcFlagsSpellType.NoDmgHeal))
@@ -9129,7 +9129,7 @@ namespace Game.Spells
}
// set hitmask for finish procs
spell.m_hitMask |= hitMask;
spell.m_hitMask |= ProcHitMask;
spell.m_procSpellType |= procSpellType;
// _spellHitTarget can be null if spell is missed in DoSpellHitOnUnit
+4 -4
View File
@@ -1795,7 +1795,7 @@ namespace Game.Spells
CallScriptSuccessfulDispel(effectInfo.EffectIndex);
m_hitMask |= ProcFlagsHit.Dispel;
m_UniqueTargetInfo.Find(p => p.TargetGUID == unitTarget.GetGUID()).ProcHitMask |= ProcFlagsHit.Dispel;
}
[SpellEffectHandler(SpellEffectName.DualWield)]
@@ -2571,7 +2571,7 @@ namespace Game.Spells
int duration = m_spellInfo.GetDuration();
duration = unitTarget.ModSpellDuration(m_spellInfo, unitTarget, duration, false, 1u << (int)effectInfo.EffectIndex);
unitTarget.GetSpellHistory().LockSpellSchool(curSpellInfo.GetSchoolMask(), TimeSpan.FromMilliseconds(duration));
m_hitMask |= ProcFlagsHit.Interrupt;
m_UniqueTargetInfo.Find(p => p.TargetGUID == unitTarget.GetGUID()).ProcHitMask |= ProcFlagsHit.Interrupt;
SendSpellInterruptLog(unitTarget, curSpellInfo.Id);
unitTarget.InterruptSpell(i, false);
}
@@ -3882,7 +3882,7 @@ namespace Game.Spells
dispel_list.RemoveAt(0);
}
m_hitMask |= ProcFlagsHit.Dispel;
m_UniqueTargetInfo.Find(p => p.TargetGUID == unitTarget.GetGUID()).ProcHitMask |= ProcFlagsHit.Dispel;
}
[SpellEffectHandler(SpellEffectName.ResurrectPet)]
@@ -4444,7 +4444,7 @@ namespace Game.Spells
}
m_caster.SendMessageToSet(spellDispellLog, true);
m_hitMask |= ProcFlagsHit.Dispel;
m_UniqueTargetInfo.Find(p => p.TargetGUID == unitTarget.GetGUID()).ProcHitMask |= ProcFlagsHit.Dispel;
}
[SpellEffectHandler(SpellEffectName.KillCredit)]
+1 -1
View File
@@ -1005,7 +1005,7 @@ namespace Game.Spells
GetCooldownDurations(spellInfo, itemId, ref notUsed, ref categoryId, ref notUsed);
}
void GetCooldownDurations(SpellInfo spellInfo, uint itemId, ref TimeSpan cooldown, ref uint categoryId, ref TimeSpan categoryCooldown)
public static void GetCooldownDurations(SpellInfo spellInfo, uint itemId, ref TimeSpan cooldown, ref uint categoryId, ref TimeSpan categoryCooldown)
{
TimeSpan tmpCooldown = TimeSpan.MinValue;
uint tmpCategoryId = 0;