diff --git a/Source/Game/Entities/Unit/Unit.Fields.cs b/Source/Game/Entities/Unit/Unit.Fields.cs index 4558579d4..48f798bc9 100644 --- a/Source/Game/Entities/Unit/Unit.Fields.cs +++ b/Source/Game/Entities/Unit/Unit.Fields.cs @@ -131,6 +131,7 @@ namespace Game.Entities uint m_transform; bool m_cleanupDone; // lock made to not add stuff after cleanup before delete bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world + bool _instantCast; ushort _aiAnimKitId; ushort _movementAnimKitId; diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index b7302964f..842db0116 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -35,6 +35,9 @@ namespace Game.Entities return false; } + public void SetInstantCast(bool set) { _instantCast = set; } + public bool CanInstantCast() { return _instantCast; } + // function uses real base points (typically value - 1) public int CalculateSpellDamage(Unit target, SpellInfo spellProto, uint effect_index, int? basePoints = null, uint castItemId = 0, int itemLevel = -1) { @@ -1954,7 +1957,7 @@ namespace Game.Entities if (!(spellInfo.HasAttribute(SpellAttr0.Ability | SpellAttr0.Tradespell) || spellInfo.HasAttribute(SpellAttr3.NoDoneBonus)) && (IsTypeId(TypeId.Player) && spellInfo.SpellFamilyName != 0) || IsTypeId(TypeId.Unit)) - castTime = (int)(castTime * m_unitData.ModCastingSpeed); + castTime = CanInstantCast() ? 0 : (int)(castTime * m_unitData.ModCastingSpeed); else if (spellInfo.HasAttribute(SpellAttr0.ReqAmmo) && !spellInfo.HasAttribute(SpellAttr2.AutorepeatFlag)) castTime = (int)(castTime * m_modAttackSpeedPct[(int)WeaponAttackType.RangedAttack]); else if (Global.SpellMgr.IsPartOfSkillLine(SkillType.Cooking, spellInfo.Id) && HasAura(67556)) // cooking with Chef Hat. diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 47aa7114a..539699470 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -3777,6 +3777,34 @@ namespace Game.Spells Unit target = aurApp.GetTarget(); + // Do not apply such auras in normal way + if (GetAmount() >= 1000) + { + if (apply) + target.SetInstantCast(true); + else + { + // only SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK can have this high amount + // it's some rare case that you have 2 auras like that, but just in case ;) + + bool remove = true; + var castingSpeedNotStack = target.GetAuraEffectsByType(AuraType.ModCastingSpeedNotStack); + foreach (AuraEffect aurEff in castingSpeedNotStack) + { + if (aurEff != this && aurEff.GetAmount() >= 1000) + { + remove = false; + break; + } + } + + if (remove) + target.SetInstantCast(false); + } + + return; + } + target.ApplyCastTimePercentMod(GetAmount(), apply); }