From c27b81778956a47b525259c3acbe5b2c9a38753b Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 1 Jun 2022 16:15:27 -0400 Subject: [PATCH] Core/Spells: Implemented SPELL_ATTR6_DELAY_COMBAT_TIMER_DURING_CAST Port From (https://github.com/TrinityCore/TrinityCore/commit/0620b829b2597777f2b5d931dfb0336f79dfd0df) --- .../Framework/Constants/Spells/SpellConst.cs | 2 +- Source/Game/Entities/Unit/Unit.cs | 27 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index 51bb21df8..a542e32f3 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -1811,7 +1811,7 @@ namespace Framework.Constants NoJumpPathing = 0x10000, /*Nyi*/ // No Jump Pathing AllowEquipWhileCasting = 0x20000, // Allow Equip While Casting OriginateFromController = 0x40000, // Originate From Controller Description Client Will Prevent Casting If Not Possessed, Charmer Will Be Caster For All Intents And Purposes - DelayCombatTimerDuringCast = 0x80000, /*Nyi*/ // Delay Combat Timer During Cast + DelayCombatTimerDuringCast = 0x80000, // Delay Combat Timer During Cast AuraIconOnlyForCasterLimit10 = 0x100000, // Aura Icon Only For Caster (Limit 10) (Client Only) ShowMechanicAsCombatText = 0x200000, // Show Mechanic As Combat Text (Client Only) AbsorbCannotBeIgnore = 0x400000, /*Nyi*/ // Absorb Cannot Be Ignore diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index 5b299efc9..efd81c2d6 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -162,14 +162,25 @@ namespace Game.Entities _lastExtraAttackSpell = 0; } - uint att; - // not implemented before 3.0.2 - if ((att = GetAttackTimer(WeaponAttackType.BaseAttack)) != 0) - SetAttackTimer(WeaponAttackType.BaseAttack, (diff >= att ? 0 : att - diff)); - if ((att = GetAttackTimer(WeaponAttackType.RangedAttack)) != 0) - SetAttackTimer(WeaponAttackType.RangedAttack, (diff >= att ? 0 : att - diff)); - if ((att = GetAttackTimer(WeaponAttackType.OffAttack)) != 0) - SetAttackTimer(WeaponAttackType.OffAttack, (diff >= att ? 0 : att - diff)); + bool spellPausesCombatTimer(CurrentSpellTypes type) + { + return GetCurrentSpell(type) != null && GetCurrentSpell(type).GetSpellInfo().HasAttribute(SpellAttr6.DelayCombatTimerDuringCast); + } + + if (!spellPausesCombatTimer(CurrentSpellTypes.Generic) && !spellPausesCombatTimer(CurrentSpellTypes.Channeled)) + { + uint base_att = GetAttackTimer(WeaponAttackType.BaseAttack); + if (base_att != 0) + SetAttackTimer(WeaponAttackType.BaseAttack, (diff >= base_att ? 0 : base_att - diff)); + + uint ranged_att = GetAttackTimer(WeaponAttackType.RangedAttack); + if (ranged_att != 0) + SetAttackTimer(WeaponAttackType.RangedAttack, (diff >= ranged_att ? 0 : ranged_att - diff)); + + uint off_att = GetAttackTimer(WeaponAttackType.OffAttack); + if (off_att != 0) + SetAttackTimer(WeaponAttackType.OffAttack, (diff >= off_att ? 0 : off_att - diff)); + } // update abilities available only for fraction of time UpdateReactives(diff);