Core/Spells: Autorepeat casting fixes

Port From (https://github.com/TrinityCore/TrinityCore/commit/de592386dcd6ac85feb11d2af85538d62c192696)
This commit is contained in:
hondacrx
2022-06-01 16:28:01 -04:00
parent e9fcfd6f26
commit 95d134b512
5 changed files with 32 additions and 32 deletions
+4 -13
View File
@@ -215,6 +215,8 @@ namespace Game.Entities
void _UpdateSpells(uint diff)
{
_spellHistory.Update();
if (GetCurrentSpell(CurrentSpellTypes.AutoRepeat) != null)
_UpdateAutoRepeatSpell();
@@ -264,8 +266,6 @@ namespace Game.Entities
}
}
}
_spellHistory.Update();
}
public void HandleEmoteCommand(Emote emoteId, Player target = null, uint[] spellVisualKitIds = null, int sequenceVariation = 0)
@@ -1568,17 +1568,11 @@ namespace Game.Entities
// cancel wand shoot
if (autoRepeatSpellInfo.Id != 75)
InterruptSpell(CurrentSpellTypes.AutoRepeat);
m_AutoRepeatFirstCast = true;
return;
}
// apply delay (Auto Shot (spellID 75) not affected)
if (m_AutoRepeatFirstCast && GetAttackTimer(WeaponAttackType.RangedAttack) < 500 && autoRepeatSpellInfo.Id != 75)
SetAttackTimer(WeaponAttackType.RangedAttack, 500);
m_AutoRepeatFirstCast = false;
// castroutine
if (IsAttackReady(WeaponAttackType.RangedAttack))
if (IsAttackReady(WeaponAttackType.RangedAttack) && GetCurrentSpell(CurrentSpellTypes.AutoRepeat).GetState() != SpellState.Preparing)
{
// Check if able to cast
SpellCastResult result = m_currentSpells[CurrentSpellTypes.AutoRepeat].CheckCast(true);
@@ -1593,11 +1587,8 @@ namespace Game.Entities
}
// we want to shoot
Spell spell = new(this, autoRepeatSpellInfo, TriggerCastFlags.FullMask);
Spell spell = new(this, autoRepeatSpellInfo, TriggerCastFlags.IgnoreGCD);
spell.Prepare(m_currentSpells[CurrentSpellTypes.AutoRepeat].m_targets);
// all went good, reset attack
ResetAttackTimer(WeaponAttackType.RangedAttack);
}
}