Core/Spells: Updated silence flags for 9.0 and rename unit flag to its new meaning

Port From (https://github.com/TrinityCore/TrinityCore/commit/3400c5a52c8ea35e56d57326f904dc0127c33048)
This commit is contained in:
hondacrx
2023-03-13 02:36:50 -04:00
parent 1e8a62fb26
commit cd249ac67a
6 changed files with 19 additions and 10 deletions
+8 -5
View File
@@ -1832,7 +1832,7 @@ namespace Game.Spells
if (apply)
{
target.SetUnitFlag(UnitFlags.Silenced);
target.SetSilencedSchoolMask((SpellSchoolMask)GetMiscValue());
// call functions which may have additional effects after changing state of unit
// Stop cast only spells vs PreventionType & SPELL_PREVENTION_TYPE_SILENCE
@@ -1847,11 +1847,14 @@ namespace Game.Spells
}
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (target.HasAuraType(AuraType.ModSilence) || target.HasAuraType(AuraType.ModPacifySilence))
return;
int silencedSchoolMask = 0;
foreach (AuraEffect auraEffect in target.GetAuraEffectsByType(AuraType.ModSilence))
silencedSchoolMask |= auraEffect.GetMiscValue();
target.RemoveUnitFlag(UnitFlags.Silenced);
foreach (AuraEffect auraEffect in target.GetAuraEffectsByType(AuraType.ModPacifySilence))
silencedSchoolMask |= auraEffect.GetMiscValue();
target.ReplaceAllSilencedSchoolMask((SpellSchoolMask)silencedSchoolMask);
}
}
+1 -1
View File
@@ -5909,7 +5909,7 @@ namespace Game.Spells
else if ((m_spellInfo.Mechanic & Mechanics.ImmuneShield) != 0 && m_caster.IsUnit() && m_caster.ToUnit().HasAuraWithMechanic(1 << (int)Mechanics.Banish))
result = SpellCastResult.Stunned;
}
else if (unitflag.HasAnyFlag(UnitFlags.Silenced) && m_spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.Silence) && !CheckSpellCancelsSilence(ref param1))
else if (unitCaster.IsSilenced(m_spellSchoolMask) && (m_spellInfo.PreventionType & SpellPreventionType.Silence) != 0 && !CheckSpellCancelsSilence(ref param1))
result = SpellCastResult.Silenced;
else if (unitflag.HasAnyFlag(UnitFlags.Pacified) && m_spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.Pacify) && !CheckSpellCancelsPacify(ref param1))
result = SpellCastResult.Pacified;