diff --git a/Source/Framework/Constants/UnitConst.cs b/Source/Framework/Constants/UnitConst.cs index b1472f22a..fcbbf0e69 100644 --- a/Source/Framework/Constants/UnitConst.cs +++ b/Source/Framework/Constants/UnitConst.cs @@ -500,7 +500,7 @@ namespace Framework.Constants Moving = RoamingMove | ConfusedMove | FleeingMove | ChaseMove | FollowMove | FollowFormationMove, Controlled = Confused | Stunned | Fleeing, LostControl = Controlled | Possessed | Jumping | Charging, - CannotAutoattack = Controlled | Charging | Casting, + CannotAutoattack = Controlled | Charging, Sightless = LostControl | Evade, CannotTurn = LostControl | Rotating | Focusing, NotMove = Root | Stunned | Died | Distracted, diff --git a/Source/Game/AI/CoreAI/UnitAI.cs b/Source/Game/AI/CoreAI/UnitAI.cs index c622525b3..70590dda0 100644 --- a/Source/Game/AI/CoreAI/UnitAI.cs +++ b/Source/Game/AI/CoreAI/UnitAI.cs @@ -54,9 +54,16 @@ namespace Game.AI public void DoMeleeAttackIfReady() { - if (me.HasUnitState(UnitState.Casting) || (me.IsCreature() && !me.ToCreature().CanMelee())) + if (me.IsCreature() && !me.ToCreature().CanMelee()) return; + if (me.HasUnitState(UnitState.Casting)) + { + Spell channeledSpell = me.GetCurrentSpell(CurrentSpellTypes.Channeled); + if (channeledSpell == null || !channeledSpell.GetSpellInfo().HasAttribute(SpellAttr5.AllowActionsDuringChannel)) + return; + } + Unit victim = me.GetVictim(); if (!me.IsWithinMeleeRange(victim)) diff --git a/Source/Game/Entities/Unit/Unit.Combat.cs b/Source/Game/Entities/Unit/Unit.Combat.cs index c8c09e6cf..0090e735b 100644 --- a/Source/Game/Entities/Unit/Unit.Combat.cs +++ b/Source/Game/Entities/Unit/Unit.Combat.cs @@ -506,6 +506,13 @@ namespace Game.Entities if (HasUnitState(UnitState.CannotAutoattack) && !extra) return; + if (HasUnitState(UnitState.Casting)) + { + Spell channeledSpell = GetCurrentSpell(CurrentSpellTypes.Channeled); + if (channeledSpell == null || !channeledSpell.GetSpellInfo().HasAttribute(SpellAttr5.AllowActionsDuringChannel)) + return; + } + if (HasAuraType(AuraType.DisableAttackingExceptAbilities)) return;