Core/Spells: Autorepeat casting fixes
Port From (https://github.com/TrinityCore/TrinityCore/commit/de592386dcd6ac85feb11d2af85538d62c192696)
This commit is contained in:
@@ -92,7 +92,6 @@ namespace Game.Entities
|
||||
SpellAuraInterruptFlags m_interruptMask;
|
||||
SpellAuraInterruptFlags2 m_interruptMask2;
|
||||
protected int m_procDeep;
|
||||
bool m_AutoRepeatFirstCast;
|
||||
SpellHistory _spellHistory;
|
||||
|
||||
//Auras
|
||||
|
||||
@@ -1627,14 +1627,13 @@ namespace Game.Entities
|
||||
if (pSpell == GetCurrentSpell(CSpellType)) // avoid breaking self
|
||||
return;
|
||||
|
||||
// break same type spell if it is not delayed
|
||||
InterruptSpell(CSpellType, false);
|
||||
|
||||
// special breakage effects:
|
||||
switch (CSpellType)
|
||||
{
|
||||
case CurrentSpellTypes.Generic:
|
||||
{
|
||||
InterruptSpell(CurrentSpellTypes.Generic, false);
|
||||
|
||||
// generic spells always break channeled not delayed spells
|
||||
if (GetCurrentSpell(CurrentSpellTypes.Channeled) != null && !GetCurrentSpell(CurrentSpellTypes.Channeled).GetSpellInfo().HasAttribute(SpellAttr5.AllowActionsDuringChannel))
|
||||
InterruptSpell(CurrentSpellTypes.Channeled, false);
|
||||
@@ -1645,7 +1644,6 @@ namespace Game.Entities
|
||||
// break autorepeat if not Auto Shot
|
||||
if (m_currentSpells[CurrentSpellTypes.AutoRepeat].m_spellInfo.Id != 75)
|
||||
InterruptSpell(CurrentSpellTypes.AutoRepeat);
|
||||
m_AutoRepeatFirstCast = true;
|
||||
}
|
||||
if (pSpell.m_spellInfo.CalcCastTime() > 0)
|
||||
AddUnitState(UnitState.Casting);
|
||||
@@ -1668,6 +1666,9 @@ namespace Game.Entities
|
||||
}
|
||||
case CurrentSpellTypes.AutoRepeat:
|
||||
{
|
||||
if (GetCurrentSpell(CSpellType) && GetCurrentSpell(CSpellType).GetState() == SpellState.Idle)
|
||||
GetCurrentSpell(CSpellType).SetState(SpellState.Finished);
|
||||
|
||||
// only Auto Shoot does not break anything
|
||||
if (pSpell.m_spellInfo.Id != 75)
|
||||
{
|
||||
@@ -1675,9 +1676,6 @@ namespace Game.Entities
|
||||
InterruptSpell(CurrentSpellTypes.Generic, false);
|
||||
InterruptSpell(CurrentSpellTypes.Channeled, false);
|
||||
}
|
||||
// special action: set first cast flag
|
||||
m_AutoRepeatFirstCast = true;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user