Core/Auras: Implemented SPELL_AURA_CAST_WHILE_WALKING_BY_SPELL_LABEL and SPELL_AURA_CAST_WHILE_WALKING_ALL

Port From (https://github.com/TrinityCore/TrinityCore/commit/3e81db7b9380269d4561eb5deb21fbef26913779)
This commit is contained in:
hondacrx
2021-10-16 18:33:43 -04:00
parent 5ad5b8ef18
commit 68c4407840
4 changed files with 37 additions and 15 deletions
+26 -6
View File
@@ -1051,9 +1051,14 @@ namespace Game.Entities
if (!HasUnitState(UnitState.Casting))
return false;
Spell spell = GetCurrentSpell(CurrentSpellTypes.Generic);
if (spell != null)
if (CanCastSpellWhileMoving(spell.GetSpellInfo()))
return false;
// channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute
Spell spell = m_currentSpells.LookupByKey(CurrentSpellTypes.Channeled);
if (spell)
spell = m_currentSpells.LookupByKey(CurrentSpellTypes.Channeled);
if (spell != null)
if (spell.GetState() != SpellState.Finished && spell.IsChannelActive())
if (spell.GetSpellInfo().IsMoveAllowedChannel())
return false;
@@ -1406,6 +1411,21 @@ namespace Game.Entities
return false;
}
public bool CanCastSpellWhileMoving(SpellInfo spellInfo)
{
if (HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, spellInfo))
return true;
if (HasAuraType(AuraType.CastWhileWalkingAll))
return true;
foreach (uint label in spellInfo.Labels)
if (HasAuraTypeWithMiscvalue(AuraType.CastWhileWalkingBySpellLabel, (int)label))
return true;
return false;
}
public static void ProcSkillsAndAuras(Unit actor, Unit actionTarget, ProcFlags typeMaskActor, ProcFlags typeMaskActionTarget, ProcFlagsSpellType spellTypeMask, ProcFlagsSpellPhase spellPhaseMask, ProcFlagsHit hitMask, Spell spell, DamageInfo damageInfo, HealInfo healInfo)
{
WeaponAttackType attType = damageInfo != null ? damageInfo.GetAttackType() : WeaponAttackType.BaseAttack;
@@ -2777,14 +2797,14 @@ namespace Game.Entities
return dispelList;
}
bool IsInterruptFlagIgnoredForSpell(SpellAuraInterruptFlags flag, Unit unit, SpellInfo spellInfo)
{
return flag == SpellAuraInterruptFlags.Moving && unit.CanCastSpellWhileMoving(spellInfo);
}
bool IsInterruptFlagIgnoredForSpell(SpellAuraInterruptFlags2 flag, Unit unit, SpellInfo spellInfo)
{
return false;
}
bool IsInterruptFlagIgnoredForSpell(SpellAuraInterruptFlags flag, Unit unit, SpellInfo spellInfo)
{
return flag == SpellAuraInterruptFlags.Moving && unit.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, spellInfo);
}
public void RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags flag, uint except = 0)
{
+1 -1
View File
@@ -1465,7 +1465,7 @@ namespace Game.Entities
// check "realtime" interrupts
// don't cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect
if (((IsTypeId(TypeId.Player) && ToPlayer().IsMoving()) || IsNonMeleeSpellCast(false, false, true, autoRepeatSpellInfo.Id == 75)) &&
!HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, autoRepeatSpellInfo))
!CanCastSpellWhileMoving(autoRepeatSpellInfo))
{
// cancel wand shoot
if (autoRepeatSpellInfo.Id != 75)