From 437fe2d8fd9c5c78c78882d0300bf8379723f674 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 5 Feb 2024 18:18:30 -0500 Subject: [PATCH] Core/Creatures: Moved autoattack handling from scripts to game Port From (https://github.com/TrinityCore/TrinityCore/commit/605e5f94c0d71cad8e83fa5a07eaec4e6bed9cc3) --- Source/Game/AI/CoreAI/CombatAI.cs | 14 +--- Source/Game/AI/CoreAI/GuardAI.cs | 5 +- Source/Game/AI/CoreAI/PassiveAI.cs | 5 +- Source/Game/AI/CoreAI/PetAI.cs | 9 -- Source/Game/AI/CoreAI/UnitAI.cs | 35 -------- Source/Game/AI/PlayerAI/PlayerAI.cs | 2 - Source/Game/AI/ScriptedAI/ScriptedAI.cs | 9 +- Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs | 5 +- .../Game/AI/ScriptedAI/ScriptedFollowerAI.cs | 5 +- Source/Game/AI/SmartScripts/SmartAI.cs | 10 +-- Source/Game/Entities/Creature/Creature.cs | 4 + Source/Game/Entities/Player/Player.Fields.cs | 2 +- Source/Game/Entities/Player/Player.cs | 82 ++++-------------- Source/Game/Entities/Unit/Unit.Combat.cs | 83 ++++++++++++++++--- Source/Game/Entities/Unit/Unit.Movement.cs | 2 - Source/Game/Entities/Unit/Unit.cs | 2 +- .../GarothiWorldbreaker.cs | 4 +- Source/Scripts/BrokenIsles/ZoneMardum.cs | 2 - .../Scripts/DragonIsles/AzureVault/Leymor.cs | 4 +- .../AlteracValley/AlteracValley.cs | 7 +- .../EasternKingdoms/AlteracValley/Balinda.cs | 5 +- .../EasternKingdoms/AlteracValley/Drekthar.cs | 5 +- .../AlteracValley/Galvangar.cs | 5 +- .../EasternKingdoms/AlteracValley/Vanndar.cs | 5 +- .../EasternKingdoms/BaradinHold/Alizabal.cs | 2 - .../EasternKingdoms/BaradinHold/Occuthar.cs | 2 - .../BaradinHold/PitLordArgaloth.cs | 2 +- .../BlackrockCaverns/AscendantLordObsidius.cs | 2 +- .../BlackrockCaverns/Beauty.cs | 2 +- .../BlackrockCaverns/Corla.cs | 2 - .../BlackrockCaverns/KarshSteelbender.cs | 5 +- .../BlackrockCaverns/RomoggBonecrusher.cs | 2 +- .../BlackrockDepths/AmbassadorFlamelash.cs | 2 +- .../BlackrockDepths/CorenDirebrew.cs | 7 +- .../EmperorDagranThaurissan.cs | 2 +- .../BlackrockDepths/GeneralAngerforge.cs | 2 +- .../HighInterrogatorGerstahn.cs | 2 +- .../BlackrockDepths/Magmus.cs | 2 +- .../BlackrockDepths/TombOfSeven.cs | 2 +- .../BlackrockSpire/Drakkisath.cs | 2 +- .../BlackrockSpire/GizrulTheSlavener.cs | 2 +- .../BlackrockMountain/BlackrockSpire/Gyth.cs | 2 +- .../BlackrockSpire/Halycon.cs | 2 +- .../BlackrockSpire/HighlordOmokk.cs | 2 +- .../BlackrockSpire/LordValthalak.cs | 3 - .../BlackrockSpire/MotherSmolderweb.cs | 3 +- .../BlackrockSpire/OverlordWyrmthalak.cs | 5 +- .../BlackrockSpire/PyroguardEmberseer.cs | 4 +- .../BlackrockSpire/QuartermasterZigris.cs | 2 +- .../BlackrockSpire/RendBlackhand.cs | 1 - .../BlackrockSpire/ShadowHunterVoshgajin.cs | 2 +- .../BlackrockSpire/TheBeast.cs | 2 +- .../BlackrockSpire/UrokDoomhowl.cs | 2 +- .../BlackrockSpire/WarmasterVoone.cs | 2 +- .../BlackwingLair/BroodlordLashlayer.cs | 2 +- .../BlackwingLair/Chromaggus.cs | 4 - .../BlackwingLair/Ebonroc.cs | 2 +- .../BlackwingLair/Firemaw.cs | 2 +- .../BlackwingLair/Flamegor.cs | 2 +- .../BlackwingLair/Nefarian.cs | 5 +- .../BlackwingLair/Razorgore.cs | 2 +- .../BlackwingLair/Vaelastrasz.cs | 2 - .../MoltenCore/BaronGeddon.cs | 2 - .../BlackrockMountain/MoltenCore/Garr.cs | 4 +- .../BlackrockMountain/MoltenCore/Gehennas.cs | 2 +- .../BlackrockMountain/MoltenCore/Golemagg.cs | 4 +- .../BlackrockMountain/MoltenCore/Lucifron.cs | 2 +- .../BlackrockMountain/MoltenCore/Magmadar.cs | 2 +- .../MoltenCore/MajordomoExecutus.cs | 2 - .../BlackrockMountain/MoltenCore/Ragnaros.cs | 11 --- .../BlackrockMountain/MoltenCore/Shazzrah.cs | 3 - .../MoltenCore/SulfuronHarbinger.cs | 4 +- .../EasternKingdoms/Deadmines/MrSmite.cs | 2 - .../EasternKingdoms/Karazhan/Curator.cs | 2 +- .../Karazhan/MaidenOfVirtue.cs | 2 +- .../EasternKingdoms/Karazhan/Midnight.cs | 4 +- .../EasternKingdoms/Karazhan/Moroes.cs | 10 +-- .../EasternKingdoms/Karazhan/Netherspite.cs | 2 - .../EasternKingdoms/Karazhan/Nightbane.cs | 2 +- .../Scripts/EasternKingdoms/Karazhan/Opera.cs | 18 ---- .../Karazhan/PrinceMalchezaar.cs | 2 - .../EasternKingdoms/Karazhan/ShadeOfAran.cs | 4 +- .../Karazhan/TerestianIllhoof.cs | 9 +- .../MagistersTerrace/FelbloodKaelthas.cs | 2 +- .../MagistersTerrace/PriestessDelrissa.cs | 22 ++--- .../MagistersTerrace/SelinFireheart.cs | 5 +- .../MagistersTerrace/Vexallus.cs | 2 +- Source/Scripts/Events/LunarFestival.cs | 2 +- Source/Scripts/Events/ZalazaneFall.cs | 2 +- Source/Scripts/Pets/Hunter.cs | 2 - Source/Scripts/Pets/Shaman.cs | 4 +- Source/Scripts/World/EmeraldDragons.cs | 2 - Source/Scripts/World/NpcGuard.cs | 5 +- Source/Scripts/World/NpcsSpecial.cs | 3 +- 94 files changed, 192 insertions(+), 358 deletions(-) diff --git a/Source/Game/AI/CoreAI/CombatAI.cs b/Source/Game/AI/CoreAI/CombatAI.cs index 581159b24..3828ecd8a 100644 --- a/Source/Game/AI/CoreAI/CombatAI.cs +++ b/Source/Game/AI/CoreAI/CombatAI.cs @@ -71,8 +71,6 @@ namespace Game.AI if (info != null) _events.ScheduleEvent(spellId, info.cooldown, info.cooldown * 2); } - else - DoMeleeAttackIfReady(); } public override void SpellInterrupted(uint spellId, uint unTimeMs) @@ -87,10 +85,7 @@ namespace Game.AI public override void UpdateAI(uint diff) { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); + UpdateVictim(); } } @@ -193,6 +188,7 @@ namespace Game.AI _minRange = spellInfo != null ? spellInfo.GetMinRange(false) : 0; creature.m_CombatDistance = spellInfo != null ? spellInfo.GetMaxRange(false) : 0; creature.m_SightDistance = creature.m_CombatDistance; + creature.SetCanMelee(false); } public override bool CanAIAttack(Unit victim) @@ -234,6 +230,7 @@ namespace Game.AI LoadConditions(); _doDismiss = false; _dismissTimer = VEHICLE_DISMISS_TIME; + me.SetCanMelee(false); } public override void UpdateAI(uint diff) @@ -315,10 +312,7 @@ namespace Game.AI public override void UpdateAI(uint diff) { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); + UpdateVictim(); } } } diff --git a/Source/Game/AI/CoreAI/GuardAI.cs b/Source/Game/AI/CoreAI/GuardAI.cs index 893641e27..95abfbad5 100644 --- a/Source/Game/AI/CoreAI/GuardAI.cs +++ b/Source/Game/AI/CoreAI/GuardAI.cs @@ -12,10 +12,7 @@ namespace Game.AI public override void UpdateAI(uint diff) { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); + UpdateVictim(); } public override bool CanSeeAlways(WorldObject obj) diff --git a/Source/Game/AI/CoreAI/PassiveAI.cs b/Source/Game/AI/CoreAI/PassiveAI.cs index 08990b8d6..2aa09253f 100644 --- a/Source/Game/AI/CoreAI/PassiveAI.cs +++ b/Source/Game/AI/CoreAI/PassiveAI.cs @@ -11,7 +11,8 @@ namespace Game.AI { public PassiveAI(Creature creature) : base(creature) { - creature.SetReactState(ReactStates.Passive); + me.SetReactState(ReactStates.Passive); + me.SetCanMelee(false); } public override void UpdateAI(uint diff) @@ -43,8 +44,6 @@ namespace Game.AI { if (!me.IsValidAttackTarget(me.GetVictim())) me.AttackStop(); - else - DoMeleeAttackIfReady(); } } diff --git a/Source/Game/AI/CoreAI/PetAI.cs b/Source/Game/AI/CoreAI/PetAI.cs index 857d49564..fd6da28d7 100644 --- a/Source/Game/AI/CoreAI/PetAI.cs +++ b/Source/Game/AI/CoreAI/PetAI.cs @@ -50,15 +50,6 @@ namespace Game.AI StopAttack(); return; } - - // Check before attacking to prevent pets from leaving stay position - if (me.GetCharmInfo().HasCommandState(CommandStates.Stay)) - { - if (me.GetCharmInfo().IsCommandAttack() || (me.GetCharmInfo().IsAtStay() && me.IsWithinMeleeRange(me.GetVictim()))) - DoMeleeAttackIfReady(); - } - else - DoMeleeAttackIfReady(); } else { diff --git a/Source/Game/AI/CoreAI/UnitAI.cs b/Source/Game/AI/CoreAI/UnitAI.cs index 70590dda0..53acc48a7 100644 --- a/Source/Game/AI/CoreAI/UnitAI.cs +++ b/Source/Game/AI/CoreAI/UnitAI.cs @@ -52,41 +52,6 @@ namespace Game.AI targets.Sort(new ObjectDistanceOrderPred(me, ascending)); } - public void DoMeleeAttackIfReady() - { - 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)) - return; - - // Check that the victim is in front of the unit - if (!me.HasInArc(2 * MathF.PI / 3, victim)) - return; - - //Make sure our attack is ready and we aren't currently casting before checking distance - if (me.IsAttackReady()) - { - me.AttackerStateUpdate(victim); - me.ResetAttackTimer(); - } - - if (me.HaveOffhandWeapon() && me.IsAttackReady(WeaponAttackType.OffAttack)) - { - me.AttackerStateUpdate(victim, WeaponAttackType.OffAttack); - me.ResetAttackTimer(WeaponAttackType.OffAttack); - } - } - public bool DoSpellAttackIfReady(uint spellId) { if (me.HasUnitState(UnitState.Casting) || !me.IsAttackReady()) diff --git a/Source/Game/AI/PlayerAI/PlayerAI.cs b/Source/Game/AI/PlayerAI/PlayerAI.cs index 8b4e501ad..3db9baa9f 100644 --- a/Source/Game/AI/PlayerAI/PlayerAI.cs +++ b/Source/Game/AI/PlayerAI/PlayerAI.cs @@ -573,8 +573,6 @@ namespace Game.AI { if (IsRangedAttacker()) DoRangedAttackIfReady(); - else - DoMeleeAttackIfReady(); } public void CancelAllShapeshifts() diff --git a/Source/Game/AI/ScriptedAI/ScriptedAI.cs b/Source/Game/AI/ScriptedAI/ScriptedAI.cs index 69ed8b31c..5e8f39deb 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedAI.cs @@ -45,10 +45,7 @@ namespace Game.AI public override void UpdateAI(uint diff) { //Check if we have a current target - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); + UpdateVictim(); } //Start movement toward victim @@ -655,8 +652,6 @@ namespace Game.AI if (me.HasUnitState(UnitState.Casting)) return; }); - - DoMeleeAttackIfReady(); } public void _DespawnAtEvade() @@ -766,8 +761,6 @@ namespace Game.AI if (me.HasUnitState(UnitState.Casting)) return; }); - - DoMeleeAttackIfReady(); } // Hook used to execute events scheduled into EventMap without the need diff --git a/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs b/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs index 0ccc8d802..8aec788d1 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs @@ -261,10 +261,7 @@ namespace Game.AI public virtual void UpdateEscortAI(uint diff) { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); + UpdateVictim(); } public override void MovementInform(MovementGeneratorType moveType, uint Id) diff --git a/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs b/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs index d2db321bd..4eea4f2c3 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedFollowerAI.cs @@ -158,10 +158,7 @@ namespace Game.AI void UpdateFollowerAI(uint diff) { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); + UpdateVictim(); } public void StartFollow(Player player, uint factionForFollower = 0, Quest quest = null) diff --git a/Source/Game/AI/SmartScripts/SmartAI.cs b/Source/Game/AI/SmartScripts/SmartAI.cs index d4bee673c..7c68be735 100644 --- a/Source/Game/AI/SmartScripts/SmartAI.cs +++ b/Source/Game/AI/SmartScripts/SmartAI.cs @@ -310,21 +310,13 @@ namespace Game.AI CheckConditions(diff); - bool hasVictim = UpdateVictim(); + UpdateVictim(); GetScript().OnUpdate(diff); UpdatePath(diff); UpdateFollow(diff); UpdateDespawn(diff); - - if (!IsAIControlled()) - return; - - if (!hasVictim) - return; - - DoMeleeAttackIfReady(); } bool IsEscortInvokerInRange() diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 714b32de7..423f69806 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -554,6 +554,10 @@ namespace Game.Entities AIUpdateTick(diff); + DoMeleeAttackIfReady(); + + // creature can be dead after UpdateAI call + // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly) if (!IsAlive()) break; diff --git a/Source/Game/Entities/Player/Player.Fields.cs b/Source/Game/Entities/Player/Player.Fields.cs index 4b88b48d7..e1ca08ad1 100644 --- a/Source/Game/Entities/Player/Player.Fields.cs +++ b/Source/Game/Entities/Player/Player.Fields.cs @@ -144,7 +144,7 @@ namespace Game.Entities uint m_titanGripPenaltySpellId; uint m_deathTimer; long m_deathExpireTime; - byte m_swingErrorMsg; + AttackSwingErr? m_swingErrorMsg; DateTime m_regenInterruptTimestamp; uint m_regenTimerCount; uint m_foodEmoteTimerCount; diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 9bf6665c3..e93bf8ac6 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -421,69 +421,7 @@ namespace Game.Entities m_achievementSys.UpdateTimedCriteria(TimeSpan.FromMilliseconds(diff)); - if (HasUnitState(UnitState.MeleeAttacking) && !HasUnitState(UnitState.Casting | UnitState.Charging)) - { - Unit victim = GetVictim(); - if (victim != null) - { - // default combat reach 10 - // TODO add weapon, skill check - - if (IsAttackReady(WeaponAttackType.BaseAttack)) - { - if (!IsWithinMeleeRange(victim)) - { - SetAttackTimer(WeaponAttackType.BaseAttack, 100); - if (m_swingErrorMsg != 1) // send single time (client auto repeat) - { - SendAttackSwingNotInRange(); - m_swingErrorMsg = 1; - } - } - //120 degrees of radiant range, if player is not in boundary radius - else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathFunctions.PI / 3, victim)) - { - SetAttackTimer(WeaponAttackType.BaseAttack, 100); - if (m_swingErrorMsg != 2) // send single time (client auto repeat) - { - SendAttackSwingBadFacingAttack(); - m_swingErrorMsg = 2; - } - } - else - { - m_swingErrorMsg = 0; // reset swing error state - - // prevent base and off attack in same time, delay attack at 0.2 sec - if (HaveOffhandWeapon()) - if (GetAttackTimer(WeaponAttackType.OffAttack) < SharedConst.AttackDisplayDelay) - SetAttackTimer(WeaponAttackType.OffAttack, SharedConst.AttackDisplayDelay); - - // do attack - AttackerStateUpdate(victim, WeaponAttackType.BaseAttack); - ResetAttackTimer(WeaponAttackType.BaseAttack); - } - } - - if (!IsInFeralForm() && HaveOffhandWeapon() && IsAttackReady(WeaponAttackType.OffAttack)) - { - if (!IsWithinMeleeRange(victim)) - SetAttackTimer(WeaponAttackType.OffAttack, 100); - else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathFunctions.PI / 3, victim)) - SetAttackTimer(WeaponAttackType.BaseAttack, 100); - else - { - // prevent base and off attack in same time, delay attack at 0.2 sec - if (GetAttackTimer(WeaponAttackType.BaseAttack) < SharedConst.AttackDisplayDelay) - SetAttackTimer(WeaponAttackType.BaseAttack, SharedConst.AttackDisplayDelay); - - // do attack - AttackerStateUpdate(victim, WeaponAttackType.OffAttack); - ResetAttackTimer(WeaponAttackType.OffAttack); - } - } - } - } + DoMeleeAttackIfReady(); if (HasPlayerFlag(PlayerFlags.Resting)) _restMgr.Update(diff); @@ -7707,11 +7645,19 @@ namespace Game.Entities public bool CanTameExoticPets() { return IsGameMaster() || HasAuraType(AuraType.AllowTamePetType); } - void SendAttackSwingCantAttack() { SendPacket(new AttackSwingError(AttackSwingErr.CantAttack)); } - public void SendAttackSwingCancelAttack() { SendPacket(new CancelCombat()); } - void SendAttackSwingDeadTarget() { SendPacket(new AttackSwingError(AttackSwingErr.DeadTarget)); } - public void SendAttackSwingNotInRange() { SendPacket(new AttackSwingError(AttackSwingErr.NotInRange)); } - void SendAttackSwingBadFacingAttack() { SendPacket(new AttackSwingError(AttackSwingErr.BadFacing)); } + public void SendAttackSwingCancelAttack() + { + SendPacket(new CancelCombat()); + } + + public void SetAttackSwingError(AttackSwingErr? err) + { + if (err.HasValue && err.Value != m_swingErrorMsg) + SendPacket(new AttackSwingError(err.Value)); + + m_swingErrorMsg = err; + } + public void SendAutoRepeatCancel(Unit target) { CancelAutoRepeat cancelAutoRepeat = new(); diff --git a/Source/Game/Entities/Unit/Unit.Combat.cs b/Source/Game/Entities/Unit/Unit.Combat.cs index a30ccf2a3..46d0ce25e 100644 --- a/Source/Game/Entities/Unit/Unit.Combat.cs +++ b/Source/Game/Entities/Unit/Unit.Combat.cs @@ -281,14 +281,8 @@ namespace Game.Entities Creature creature = ToCreature(); // creatures cannot attack while evading - if (creature != null) - { - if (creature.IsInEvadeMode()) - return false; - - if (creature.CanMelee()) - meleeAttack = false; - } + if (creature != null && creature.IsInEvadeMode()) + return false; // nobody can attack GM in GM-mode if (victim.IsTypeId(TypeId.Player)) @@ -522,12 +516,15 @@ namespace Game.Entities return m_baseAttackSpeed[(int)att]; } - public void AttackerStateUpdate(Unit victim, WeaponAttackType attType = WeaponAttackType.BaseAttack, bool extra = false) + public void DoMeleeAttackIfReady() { - if (HasUnitFlag(UnitFlags.Pacified)) + if (!HasUnitState(UnitState.MeleeAttacking)) return; - if (HasUnitState(UnitState.CannotAutoattack) && !extra) + if (HasUnitState(UnitState.Charging)) + return; + + if (IsCreature() && !ToCreature().CanMelee()) return; if (HasUnitState(UnitState.Casting)) @@ -537,6 +534,70 @@ namespace Game.Entities return; } + Unit victim = GetVictim(); + if (victim == null) + return; + + AttackSwingErr? getAutoAttackError() + { + if (!IsWithinMeleeRange(victim)) + return AttackSwingErr.NotInRange; + + //120 degrees of radiant range, if player is not in boundary radius + if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathF.PI / 3, victim)) + return AttackSwingErr.BadFacing; + + return null; + }; + + if (IsAttackReady(WeaponAttackType.BaseAttack)) + { + AttackSwingErr? autoAttackError = getAutoAttackError(); + if (!autoAttackError.HasValue) + { + // prevent base and off attack in same time, delay attack at 0.2 sec + if (HaveOffhandWeapon()) + if (GetAttackTimer(WeaponAttackType.OffAttack) < SharedConst.AttackDisplayDelay) + SetAttackTimer(WeaponAttackType.OffAttack, SharedConst.AttackDisplayDelay); + + // do attack + AttackerStateUpdate(victim, WeaponAttackType.BaseAttack); + ResetAttackTimer(WeaponAttackType.BaseAttack); + } + else + SetAttackTimer(WeaponAttackType.BaseAttack, 100); + + Player attackerPlayer = ToPlayer(); + if (attackerPlayer != null) + attackerPlayer.SetAttackSwingError(autoAttackError); + } + + if (!IsInFeralForm() && HaveOffhandWeapon() && IsAttackReady(WeaponAttackType.OffAttack)) + { + AttackSwingErr? autoAttackError = getAutoAttackError(); + if (!autoAttackError.HasValue) + { + // prevent base and off attack in same time, delay attack at 0.2 sec + if (GetAttackTimer(WeaponAttackType.BaseAttack) < SharedConst.AttackDisplayDelay) + SetAttackTimer(WeaponAttackType.BaseAttack, SharedConst.AttackDisplayDelay); + + // do attack + AttackerStateUpdate(victim, WeaponAttackType.OffAttack); + ResetAttackTimer(WeaponAttackType.OffAttack); + } + else + SetAttackTimer(WeaponAttackType.OffAttack, 100); + } + } + + public void AttackerStateUpdate(Unit victim, WeaponAttackType attType = WeaponAttackType.BaseAttack, bool extra = false) + { + if (HasUnitFlag(UnitFlags.Pacified)) + return; + + if (HasUnitState(UnitState.CannotAutoattack) && !extra) + return; + if (HasAuraType(AuraType.DisableAttackingExceptAbilities)) return; diff --git a/Source/Game/Entities/Unit/Unit.Movement.cs b/Source/Game/Entities/Unit/Unit.Movement.cs index f3dad1b78..a35760513 100644 --- a/Source/Game/Entities/Unit/Unit.Movement.cs +++ b/Source/Game/Entities/Unit/Unit.Movement.cs @@ -1236,7 +1236,6 @@ namespace Game.Entities case UnitState.Confused: if (!HasUnitState(UnitState.Stunned)) { - ClearUnitState(UnitState.MeleeAttacking); SendMeleeAttackStop(); // SendAutoRepeatCancel ? SetConfused(true); @@ -1245,7 +1244,6 @@ namespace Game.Entities case UnitState.Fleeing: if (!HasUnitState(UnitState.Stunned | UnitState.Confused)) { - ClearUnitState(UnitState.MeleeAttacking); SendMeleeAttackStop(); // SendAutoRepeatCancel ? SetFeared(true); diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index 78bd7a03c..fdbdfa3b1 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -672,7 +672,7 @@ namespace Game.Entities public void RemoveAllDynObjects() { while (!m_dynObj.Empty()) - m_dynObj.First().Remove(); + m_dynObj.Last().Remove(); } public GameObject GetGameObject(uint spellId) diff --git a/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs b/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs index b836804ca..44111c013 100644 --- a/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs +++ b/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs @@ -408,9 +408,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.Argus }); - if (me.GetVictim() != null && me.GetVictim().IsWithinMeleeRange(me)) - DoMeleeAttackIfReady(); - else + if (me.GetVictim() == null && !me.GetVictim().IsWithinMeleeRange(me)) DoSpellAttackIfReady(SpellIds.Carnage); } diff --git a/Source/Scripts/BrokenIsles/ZoneMardum.cs b/Source/Scripts/BrokenIsles/ZoneMardum.cs index bb73f92c9..6b58c7d25 100644 --- a/Source/Scripts/BrokenIsles/ZoneMardum.cs +++ b/Source/Scripts/BrokenIsles/ZoneMardum.cs @@ -538,8 +538,6 @@ namespace Scripts.BrokenIsles.ZoneMardum if (me.HasUnitState(UnitState.Casting)) return; - - DoMeleeAttackIfReady(); } } diff --git a/Source/Scripts/DragonIsles/AzureVault/Leymor.cs b/Source/Scripts/DragonIsles/AzureVault/Leymor.cs index 20fd96284..cfb737695 100644 --- a/Source/Scripts/DragonIsles/AzureVault/Leymor.cs +++ b/Source/Scripts/DragonIsles/AzureVault/Leymor.cs @@ -144,7 +144,7 @@ namespace Scripts.DragonIsles.AzureVault.Leymor public override void UpdateAI(uint diff) { - _scheduler.Update(diff, DoMeleeAttackIfReady); + _scheduler.Update(diff); } } @@ -203,7 +203,7 @@ namespace Scripts.DragonIsles.AzureVault.Leymor if (!UpdateVictim()) return; - _scheduler.Update(diff, DoMeleeAttackIfReady); + _scheduler.Update(diff); } } diff --git a/Source/Scripts/EasternKingdoms/AlteracValley/AlteracValley.cs b/Source/Scripts/EasternKingdoms/AlteracValley/AlteracValley.cs index 6bb0f65b4..727a1fb45 100644 --- a/Source/Scripts/EasternKingdoms/AlteracValley/AlteracValley.cs +++ b/Source/Scripts/EasternKingdoms/AlteracValley/AlteracValley.cs @@ -131,10 +131,7 @@ namespace Scripts.EasternKingdoms.AlteracValley _scheduler.Update(diff); if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); + return; } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/AlteracValley/Balinda.cs b/Source/Scripts/EasternKingdoms/AlteracValley/Balinda.cs index ef5500c24..e47c3a991 100644 --- a/Source/Scripts/EasternKingdoms/AlteracValley/Balinda.cs +++ b/Source/Scripts/EasternKingdoms/AlteracValley/Balinda.cs @@ -141,8 +141,7 @@ namespace Scripts.EasternKingdoms.AlteracValley.Balinda if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/AlteracValley/Drekthar.cs b/Source/Scripts/EasternKingdoms/AlteracValley/Drekthar.cs index 0039a3301..8d4ae5abb 100644 --- a/Source/Scripts/EasternKingdoms/AlteracValley/Drekthar.cs +++ b/Source/Scripts/EasternKingdoms/AlteracValley/Drekthar.cs @@ -91,8 +91,7 @@ namespace Scripts.EasternKingdoms.AlteracValley.Drekthar if (!UpdateVictim() || !CheckInRoom()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/AlteracValley/Galvangar.cs b/Source/Scripts/EasternKingdoms/AlteracValley/Galvangar.cs index 39a95bd53..6b228f76c 100644 --- a/Source/Scripts/EasternKingdoms/AlteracValley/Galvangar.cs +++ b/Source/Scripts/EasternKingdoms/AlteracValley/Galvangar.cs @@ -92,8 +92,7 @@ namespace Scripts.EasternKingdoms.AlteracValley.Galvangar if (!UpdateVictim() || !CheckInRoom()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/AlteracValley/Vanndar.cs b/Source/Scripts/EasternKingdoms/AlteracValley/Vanndar.cs index 30d33afd9..ec3cee896 100644 --- a/Source/Scripts/EasternKingdoms/AlteracValley/Vanndar.cs +++ b/Source/Scripts/EasternKingdoms/AlteracValley/Vanndar.cs @@ -75,8 +75,7 @@ namespace Scripts.EasternKingdoms.AlteracValley.Vanndar if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs b/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs index 5f92eb4c5..a874ac14e 100644 --- a/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs +++ b/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs @@ -248,8 +248,6 @@ namespace Scripts.EasternKingdoms.BaradinHold.Alizabal break; } }); - - DoMeleeAttackIfReady(); } } } diff --git a/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs b/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs index b90d20da9..5552d04d2 100644 --- a/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs +++ b/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs @@ -125,8 +125,6 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar break; } }); - - DoMeleeAttackIfReady(); } } diff --git a/Source/Scripts/EasternKingdoms/BaradinHold/PitLordArgaloth.cs b/Source/Scripts/EasternKingdoms/BaradinHold/PitLordArgaloth.cs index 441d0efc6..657c8c5ba 100644 --- a/Source/Scripts/EasternKingdoms/BaradinHold/PitLordArgaloth.cs +++ b/Source/Scripts/EasternKingdoms/BaradinHold/PitLordArgaloth.cs @@ -70,7 +70,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.PitLordArgaloth if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/AscendantLordObsidius.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/AscendantLordObsidius.cs index dcbf46fe0..cd4fdf1d2 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/AscendantLordObsidius.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/AscendantLordObsidius.cs @@ -66,7 +66,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockCaverns.AscendantLo if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/Beauty.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/Beauty.cs index 7afd39f22..e86ec64a6 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/Beauty.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/Beauty.cs @@ -69,7 +69,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockCaverns.Beauty if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/Corla.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/Corla.cs index 3489d2ea1..83ebaa97c 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/Corla.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/Corla.cs @@ -78,8 +78,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockCaverns.Corla public override void UpdateAI(uint diff) { _scheduler.Update(diff); - - DoMeleeAttackIfReady(); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/KarshSteelbender.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/KarshSteelbender.cs index 60b8eb00b..824a72c14 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/KarshSteelbender.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/KarshSteelbender.cs @@ -64,8 +64,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockCaverns.KarshSteelb if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/RomoggBonecrusher.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/RomoggBonecrusher.cs index ac24cc14f..292772762 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/RomoggBonecrusher.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/RomoggBonecrusher.cs @@ -102,7 +102,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockCaverns.RomoggBonec if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/AmbassadorFlamelash.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/AmbassadorFlamelash.cs index 3c5e90890..86b252599 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/AmbassadorFlamelash.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/AmbassadorFlamelash.cs @@ -50,7 +50,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.AmbassadorFl if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/CorenDirebrew.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/CorenDirebrew.cs index 7f79cfd02..293852ef8 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/CorenDirebrew.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/CorenDirebrew.cs @@ -237,7 +237,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.CorenDirebre if (!UpdateVictim() && phase != DirebrewPhases.Intro) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -283,7 +283,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.CorenDirebre public override void UpdateAI(uint diff) { - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -513,5 +513,4 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.CorenDirebre OnEffectApply.Add(new EffectApplyHandler(OnApply, 1, AuraType.PeriodicDummy, AuraEffectHandleModes.Real)); } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/EmperorDagranThaurissan.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/EmperorDagranThaurissan.cs index b31691f9c..4b28c54aa 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/EmperorDagranThaurissan.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/EmperorDagranThaurissan.cs @@ -79,7 +79,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.Draganthauri if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/GeneralAngerforge.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/GeneralAngerforge.cs index fb8a2e459..ea530bde9 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/GeneralAngerforge.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/GeneralAngerforge.cs @@ -93,7 +93,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.GeneralAnger if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/HighInterrogatorGerstahn.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/HighInterrogatorGerstahn.cs index f57148917..2337511ba 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/HighInterrogatorGerstahn.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/HighInterrogatorGerstahn.cs @@ -60,7 +60,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.HighInterrog if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/Magmus.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/Magmus.cs index 87ca8868a..d3c6dba4d 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/Magmus.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/Magmus.cs @@ -71,7 +71,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.Magmus if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } public override void JustDied(Unit killer) diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/TombOfSeven.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/TombOfSeven.cs index fc6873001..4157ec95f 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/TombOfSeven.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/TombOfSeven.cs @@ -189,7 +189,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockDepths.TombOfSeven if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } public override bool OnGossipSelect(Player player, uint menuId, uint gossipListId) diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Drakkisath.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Drakkisath.cs index b2784f15c..cbeaa611f 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Drakkisath.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Drakkisath.cs @@ -61,7 +61,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.Drakkisath if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/GizrulTheSlavener.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/GizrulTheSlavener.cs index 10d57ce7d..95d824ebe 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/GizrulTheSlavener.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/GizrulTheSlavener.cs @@ -61,7 +61,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.GizrulTheSlav if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Gyth.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Gyth.cs index 465d71c37..5e9752a38 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Gyth.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Gyth.cs @@ -118,7 +118,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.Gyth SummonedRend = true; } - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Halycon.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Halycon.cs index d4b9d1cee..db0c3a7e4 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Halycon.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/Halycon.cs @@ -72,7 +72,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.Halycon if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/HighlordOmokk.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/HighlordOmokk.cs index 0d64cb374..4ff48e694 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/HighlordOmokk.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/HighlordOmokk.cs @@ -50,7 +50,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.HighlordOmokk if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/LordValthalak.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/LordValthalak.cs index bb8bc2447..94d169fb9 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/LordValthalak.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/LordValthalak.cs @@ -94,9 +94,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire frenzy15 = true; } } - - DoMeleeAttackIfReady(); } } } - diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/MotherSmolderweb.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/MotherSmolderweb.cs index 0b9b0503c..927644cd8 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/MotherSmolderweb.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/MotherSmolderweb.cs @@ -58,8 +58,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.MotherSmolder if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } - diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/OverlordWyrmthalak.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/OverlordWyrmthalak.cs index 271067591..e71fce022 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/OverlordWyrmthalak.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/OverlordWyrmthalak.cs @@ -98,8 +98,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.OverlordWyrmt } } - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/PyroguardEmberseer.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/PyroguardEmberseer.cs index de5637e0b..97b3388ab 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/PyroguardEmberseer.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/PyroguardEmberseer.cs @@ -214,8 +214,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.PyroguardEmbe if (!UpdateVictim()) return; - - DoMeleeAttackIfReady(); } } @@ -261,7 +259,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.PyroguardEmbe if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/QuartermasterZigris.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/QuartermasterZigris.cs index 4e70fca70..f0638c1f0 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/QuartermasterZigris.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/QuartermasterZigris.cs @@ -52,7 +52,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.Quartermaster if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/RendBlackhand.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/RendBlackhand.cs index d855765bc..30ba57914 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/RendBlackhand.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/RendBlackhand.cs @@ -502,7 +502,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.RendBlackhand if (me.HasUnitState(UnitState.Casting)) return; }); - DoMeleeAttackIfReady(); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/ShadowHunterVoshgajin.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/ShadowHunterVoshgajin.cs index aa43f1b2e..f0fb6a69f 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/ShadowHunterVoshgajin.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/ShadowHunterVoshgajin.cs @@ -60,7 +60,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.ShadowHunterV if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/TheBeast.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/TheBeast.cs index 16c9ad875..44557027d 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/TheBeast.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/TheBeast.cs @@ -59,7 +59,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.Thebeast if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/UrokDoomhowl.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/UrokDoomhowl.cs index 66f59d966..3a4c7500f 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/UrokDoomhowl.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/UrokDoomhowl.cs @@ -59,7 +59,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.UrokDoomhowl if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/WarmasterVoone.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/WarmasterVoone.cs index a54a4006a..64eab8bea 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/WarmasterVoone.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/WarmasterVoone.cs @@ -74,7 +74,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire.WarmasterVoon if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/BroodlordLashlayer.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/BroodlordLashlayer.cs index 1ce1af7de..9b8c2e7db 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/BroodlordLashlayer.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/BroodlordLashlayer.cs @@ -95,7 +95,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.Broodlord if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Chromaggus.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Chromaggus.cs index 51240bf23..97a6732ee 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Chromaggus.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Chromaggus.cs @@ -156,8 +156,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair Breath2_Spell = SpellIds.Igniteflesh; break; } - - EnterEvadeMode(); } void Initialize() @@ -243,8 +241,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair DoCast(me, SpellIds.Enrage); Enraged = true; } - - DoMeleeAttackIfReady(); } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Ebonroc.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Ebonroc.cs index 3d20c7ee2..e26e0aaf4 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Ebonroc.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Ebonroc.cs @@ -46,7 +46,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.Ebonroc if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Firemaw.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Firemaw.cs index 9045e9746..3d6b6c372 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Firemaw.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Firemaw.cs @@ -48,7 +48,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.Firemaw if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Flamegor.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Flamegor.cs index f9468bacb..18e86f18a 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Flamegor.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Flamegor.cs @@ -54,7 +54,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.Flamegor if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Nefarian.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Nefarian.cs index c337997f6..ae07d2c32 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Nefarian.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Nefarian.cs @@ -570,9 +570,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.VictorNefarius Phase3 = true; Talk(TextIds.SayRaiseSkeletons); } - - DoMeleeAttackIfReady(); } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Razorgore.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Razorgore.cs index 6fc481f5d..cb35cb761 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Razorgore.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Razorgore.cs @@ -123,7 +123,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.Razorgore if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Vaelastrasz.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Vaelastrasz.cs index d86fc2697..a2029d87e 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Vaelastrasz.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/Vaelastrasz.cs @@ -164,8 +164,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair.Vaelastrasz Talk(TextIds.SayHalflife); HasYelled = true; } - - DoMeleeAttackIfReady(); } public override bool OnGossipSelect(Player player, uint menuId, uint gossipListId) diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/BaronGeddon.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/BaronGeddon.cs index 8e1ac5ee0..f5dc0a1a3 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/BaronGeddon.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/BaronGeddon.cs @@ -72,8 +72,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.BaronGeddon if (me.HasUnitState(UnitState.Casting)) return; - - DoMeleeAttackIfReady(); } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Garr.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Garr.cs index b94febfc1..7dc9c67de 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Garr.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Garr.cs @@ -49,7 +49,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Garr if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -110,7 +110,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Garr if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Gehennas.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Gehennas.cs index 1e0a824be..8cb06b385 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Gehennas.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Gehennas.cs @@ -51,7 +51,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Gehennas if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Golemagg.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Golemagg.cs index 1114bc31a..4cb2e42b5 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Golemagg.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Golemagg.cs @@ -70,7 +70,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Golemagg if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -120,7 +120,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Golemagg if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Lucifron.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Lucifron.cs index 804b2ac67..f823a7a10 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Lucifron.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Lucifron.cs @@ -46,7 +46,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Lucifron if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Magmadar.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Magmadar.cs index 0dcb33b60..e47490cdb 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Magmadar.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Magmadar.cs @@ -63,7 +63,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Magmadar if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/MajordomoExecutus.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/MajordomoExecutus.cs index d764e5151..a618b0340 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/MajordomoExecutus.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/MajordomoExecutus.cs @@ -103,8 +103,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Majordomo if (HealthBelowPct(50)) DoCast(me, SpellIds.AegisOfRagnaros, new CastSpellExtraArgs(true)); - - DoMeleeAttackIfReady(); } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Ragnaros.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Ragnaros.cs index 8aceee53c..e584e9870 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Ragnaros.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Ragnaros.cs @@ -294,9 +294,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore break; } }); - - - DoMeleeAttackIfReady(); } } } @@ -315,14 +312,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore { instance.SetData(MCMiscConst.DataRagnarosAdds, 1); } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Shazzrah.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Shazzrah.cs index 4f3ba66c8..f827c7550 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Shazzrah.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/Shazzrah.cs @@ -96,9 +96,6 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Shazzrah if (me.HasUnitState(UnitState.Casting)) return; }); - - - DoMeleeAttackIfReady(); } } diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/SulfuronHarbinger.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/SulfuronHarbinger.cs index 2e5c47e63..64729ab5e 100644 --- a/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/SulfuronHarbinger.cs +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/MoltenCore/SulfuronHarbinger.cs @@ -72,7 +72,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Sulfuron if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -125,7 +125,7 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Sulfuron if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } diff --git a/Source/Scripts/EasternKingdoms/Deadmines/MrSmite.cs b/Source/Scripts/EasternKingdoms/Deadmines/MrSmite.cs index 29eff9655..4dfd3b014 100644 --- a/Source/Scripts/EasternKingdoms/Deadmines/MrSmite.cs +++ b/Source/Scripts/EasternKingdoms/Deadmines/MrSmite.cs @@ -175,8 +175,6 @@ namespace Scripts.EasternKingdoms.Deadmines } else uiTimer -= uiDiff; } - - DoMeleeAttackIfReady(); } public override void MovementInform(MovementGeneratorType uiType, uint uiId) diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs b/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs index 2914dddf4..d88ffee6b 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs @@ -112,7 +112,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Curator public override void UpdateAI(uint diff) { - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } bool _infused; diff --git a/Source/Scripts/EasternKingdoms/Karazhan/MaidenOfVirtue.cs b/Source/Scripts/EasternKingdoms/Karazhan/MaidenOfVirtue.cs index e2f26d99e..c59a07002 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/MaidenOfVirtue.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/MaidenOfVirtue.cs @@ -81,7 +81,7 @@ namespace Scripts.EasternKingdoms.Karazhan.MaidenOfVirtue if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Midnight.cs b/Source/Scripts/EasternKingdoms/Karazhan/Midnight.cs index b9e77274f..ec7e3856c 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Midnight.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Midnight.cs @@ -206,7 +206,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight if (!UpdateVictim() && _phase != Phases.None) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } public override void SpellHit(WorldObject caster, SpellInfo spellInfo) @@ -346,7 +346,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight if (!UpdateVictim() || _phase == Phases.Mounted) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs b/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs index 49dbd92b4..cf7ff3f8d 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs @@ -137,6 +137,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes _scheduler.Schedule(TimeSpan.FromSeconds(30), MiscConst.GroupNonEnrage, task => { DoCast(me, SpellIds.Vanish); + me.SetCanMelee(false); InVanish = true; task.Schedule(TimeSpan.FromSeconds(5), garroteTask => @@ -148,6 +149,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes target.CastSpell(target, SpellIds.Garrote, true); InVanish = false; + me.SetCanMelee(true); }); task.Repeat(); @@ -263,11 +265,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes _scheduler.CancelGroup(MiscConst.GroupNonEnrage); } - _scheduler.Update(diff, () => - { - if (!InVanish) - DoMeleeAttackIfReady(); - }); + _scheduler.Update(diff); } } @@ -318,8 +316,6 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes { if (instance.GetBossState(DataTypes.Moroes) != EncounterState.InProgress) EnterEvadeMode(); - - DoMeleeAttackIfReady(); } } diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Netherspite.cs b/Source/Scripts/EasternKingdoms/Karazhan/Netherspite.cs index be7460600..510577b27 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Netherspite.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Netherspite.cs @@ -337,8 +337,6 @@ namespace Scripts.EasternKingdoms.Karazhan.Netherspite } else PhaseTimer -= diff; } - - DoMeleeAttackIfReady(); } } } \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Nightbane.cs b/Source/Scripts/EasternKingdoms/Karazhan/Nightbane.cs index 8b94fff3a..daacc069d 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Nightbane.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Nightbane.cs @@ -318,7 +318,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Nightbane if (!UpdateVictim() && phase != NightbanePhases.Intro) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Opera.cs b/Source/Scripts/EasternKingdoms/Karazhan/Opera.cs index 7f11ca68b..e6ce73067 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Opera.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Opera.cs @@ -284,8 +284,6 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera SummonTito(); else SummonTitoTimer -= diff; } - - DoMeleeAttackIfReady(); } void SummonTito() @@ -350,8 +348,6 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera YipTimer = 10000; } else YipTimer -= diff; - - DoMeleeAttackIfReady(); } } @@ -456,8 +452,6 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera BrainWipeTimer = 20000; } else BrainWipeTimer -= diff; - - DoMeleeAttackIfReady(); } } @@ -563,8 +557,6 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera } else RustTimer -= diff; } - - DoMeleeAttackIfReady(); } } @@ -671,8 +663,6 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera ScreamTimer = RandomHelper.URand(20000, 30000); } else ScreamTimer -= diff; - - DoMeleeAttackIfReady(); } } @@ -749,8 +739,6 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera ChainLightningTimer = 15000; } else ChainLightningTimer -= diff; - - DoMeleeAttackIfReady(); } } @@ -880,8 +868,6 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); - if (ChaseTimer <= diff) { if (!IsChasing) @@ -1235,8 +1221,6 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera EternalAffectionTimer = RandomHelper.URand(45000, 60000); } else EternalAffectionTimer -= diff; - - DoMeleeAttackIfReady(); } } @@ -1432,8 +1416,6 @@ namespace Scripts.EasternKingdoms.Karazhan.EsOpera PoisonThrustTimer = RandomHelper.URand(10000, 20000); } else PoisonThrustTimer -= diff; - - DoMeleeAttackIfReady(); } } } \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/Karazhan/PrinceMalchezaar.cs b/Source/Scripts/EasternKingdoms/Karazhan/PrinceMalchezaar.cs index 88ec2dc7d..7a5fdaada 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/PrinceMalchezaar.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/PrinceMalchezaar.cs @@ -513,8 +513,6 @@ namespace Scripts.EasternKingdoms.Karazhan.PrinceMalchezaar if (phase == 2) DoMeleeAttacksIfReady(); - else - DoMeleeAttackIfReady(); } void DoMeleeAttacksIfReady() diff --git a/Source/Scripts/EasternKingdoms/Karazhan/ShadeOfAran.cs b/Source/Scripts/EasternKingdoms/Karazhan/ShadeOfAran.cs index fa0c942b3..c7de3bb37 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/ShadeOfAran.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/ShadeOfAran.cs @@ -138,6 +138,7 @@ namespace Scripts.EasternKingdoms.Karazhan.ShadeOfAran public override void Reset() { Initialize(); + me.SetCanMelee(true); // Not in progress instance.SetBossState(DataTypes.Aran, EncounterState.NotStarted); @@ -462,8 +463,7 @@ namespace Scripts.EasternKingdoms.Karazhan.ShadeOfAran else FlameWreathCheckTime -= diff; } - if (ArcaneCooldown != 0 && FireCooldown != 0 && FrostCooldown != 0) - DoMeleeAttackIfReady(); + me.SetCanMelee(ArcaneCooldown != 0 && FireCooldown != 0 && FrostCooldown != 0); } public override void DamageTaken(Unit pAttacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null) diff --git a/Source/Scripts/EasternKingdoms/Karazhan/TerestianIllhoof.cs b/Source/Scripts/EasternKingdoms/Karazhan/TerestianIllhoof.cs index 68387e2a3..7d9deee0c 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/TerestianIllhoof.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/TerestianIllhoof.cs @@ -124,7 +124,7 @@ namespace Scripts.EasternKingdoms.Karazhan.TerestianIllhoof public override void UpdateAI(uint diff) { - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -153,10 +153,7 @@ namespace Scripts.EasternKingdoms.Karazhan.TerestianIllhoof if (!UpdateVictim()) return; - _scheduler.Update(diff, () => - { - DoMeleeAttackIfReady(); - }); + _scheduler.Update(diff); } } @@ -239,7 +236,7 @@ namespace Scripts.EasternKingdoms.Karazhan.TerestianIllhoof if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/MagistersTerrace/FelbloodKaelthas.cs b/Source/Scripts/EasternKingdoms/MagistersTerrace/FelbloodKaelthas.cs index 434b677c1..f2161c639 100644 --- a/Source/Scripts/EasternKingdoms/MagistersTerrace/FelbloodKaelthas.cs +++ b/Source/Scripts/EasternKingdoms/MagistersTerrace/FelbloodKaelthas.cs @@ -430,7 +430,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.FelbloodKaelthas if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } diff --git a/Source/Scripts/EasternKingdoms/MagistersTerrace/PriestessDelrissa.cs b/Source/Scripts/EasternKingdoms/MagistersTerrace/PriestessDelrissa.cs index 8ef02624b..49995033e 100644 --- a/Source/Scripts/EasternKingdoms/MagistersTerrace/PriestessDelrissa.cs +++ b/Source/Scripts/EasternKingdoms/MagistersTerrace/PriestessDelrissa.cs @@ -340,7 +340,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -497,6 +497,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa AddThreat(unit, 1000.0f); InVanish = true; + me.SetCanMelee(false); task.Repeat(TimeSpan.FromSeconds(30)); task.Schedule(TimeSpan.FromSeconds(10), waitTask => { @@ -505,6 +506,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa DoCastVictim(SpellIds.Backstab, new CastSpellExtraArgs(true)); DoCastVictim(SpellIds.KidneyShot, new CastSpellExtraArgs(true)); me.SetVisible(true); // ...? Hacklike + me.SetCanMelee(true); InVanish = false; } waitTask.Repeat(); @@ -523,6 +525,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa { Initialize(); me.SetVisible(true); + me.SetCanMelee(true); base.Reset(); } @@ -535,9 +538,6 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa base.UpdateAI(diff); _scheduler.Update(diff); - - if (!InVanish) - DoMeleeAttackIfReady(); } } @@ -608,7 +608,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa base.UpdateAI(diff); - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -649,7 +649,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa base.UpdateAI(diff); - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -740,7 +740,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa HasIceBlocked = true; } - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -823,7 +823,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa base.UpdateAI(diff); - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -908,7 +908,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa base.UpdateAI(diff); if (me.IsWithinDistInMap(me.GetVictim(), SharedConst.AttackDistance)) - _meleeScheduler.Update(diff, () => DoMeleeAttackIfReady()); + _meleeScheduler.Update(diff); else _scheduler.Update(diff); } @@ -973,7 +973,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa base.UpdateAI(diff); - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } @@ -1037,7 +1037,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.PriestessDelrissa base.UpdateAI(diff); - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } } \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/MagistersTerrace/SelinFireheart.cs b/Source/Scripts/EasternKingdoms/MagistersTerrace/SelinFireheart.cs index 964d72390..e7f4e5718 100644 --- a/Source/Scripts/EasternKingdoms/MagistersTerrace/SelinFireheart.cs +++ b/Source/Scripts/EasternKingdoms/MagistersTerrace/SelinFireheart.cs @@ -231,8 +231,6 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.SelinFireheart _events.ScheduleEvent(EventIds.DrainCrystal, TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25), 0, PhaseIds.Normal); } } - - DoMeleeAttackIfReady(); } } @@ -252,5 +250,4 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.SelinFireheart } } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/MagistersTerrace/Vexallus.cs b/Source/Scripts/EasternKingdoms/MagistersTerrace/Vexallus.cs index 11c8182b1..1f2010514 100644 --- a/Source/Scripts/EasternKingdoms/MagistersTerrace/Vexallus.cs +++ b/Source/Scripts/EasternKingdoms/MagistersTerrace/Vexallus.cs @@ -136,7 +136,7 @@ namespace Scripts.EasternKingdoms.MagistersTerrace.Vexallus if (!UpdateVictim()) return; - _scheduler.Update(diff, () => DoMeleeAttackIfReady()); + _scheduler.Update(diff); } } diff --git a/Source/Scripts/Events/LunarFestival.cs b/Source/Scripts/Events/LunarFestival.cs index 4061bb53a..f7bbda87a 100644 --- a/Source/Scripts/Events/LunarFestival.cs +++ b/Source/Scripts/Events/LunarFestival.cs @@ -361,7 +361,7 @@ namespace Scripts.Events.LunarFestival if (!UpdateVictim()) return; - _scheduler.Update(diff, DoMeleeAttackIfReady); + _scheduler.Update(diff); } } diff --git a/Source/Scripts/Events/ZalazaneFall.cs b/Source/Scripts/Events/ZalazaneFall.cs index 71e06b0de..3415358b3 100644 --- a/Source/Scripts/Events/ZalazaneFall.cs +++ b/Source/Scripts/Events/ZalazaneFall.cs @@ -206,7 +206,7 @@ namespace Scripts.Events.ZalazaneFall if (_tigerGuid.IsEmpty()) return; - _scheduler.Update(diff, DoMeleeAttackIfReady); + _scheduler.Update(diff); } } diff --git a/Source/Scripts/Pets/Hunter.cs b/Source/Scripts/Pets/Hunter.cs index e0c381a3c..fd59fc190 100644 --- a/Source/Scripts/Pets/Hunter.cs +++ b/Source/Scripts/Pets/Hunter.cs @@ -97,8 +97,6 @@ namespace Scripts.Pets.Hunter else _spellTimer -= diff; } - - DoMeleeAttackIfReady(); } } } \ No newline at end of file diff --git a/Source/Scripts/Pets/Shaman.cs b/Source/Scripts/Pets/Shaman.cs index ab033fbfc..f6cd32251 100644 --- a/Source/Scripts/Pets/Shaman.cs +++ b/Source/Scripts/Pets/Shaman.cs @@ -32,8 +32,6 @@ namespace Scripts.Pets.Shaman return; _scheduler.Update(diff); - - DoMeleeAttackIfReady(); } } @@ -74,7 +72,7 @@ namespace Scripts.Pets.Shaman if (me.HasUnitState(UnitState.Casting)) return; - _scheduler.Update(diff, DoMeleeAttackIfReady); + _scheduler.Update(diff); } } } \ No newline at end of file diff --git a/Source/Scripts/World/EmeraldDragons.cs b/Source/Scripts/World/EmeraldDragons.cs index 64f85ecef..31f491bbd 100644 --- a/Source/Scripts/World/EmeraldDragons.cs +++ b/Source/Scripts/World/EmeraldDragons.cs @@ -134,8 +134,6 @@ namespace Scripts.World.Achievements Unit target = SelectTarget(SelectTargetMethod.MaxThreat, 0, -50.0f, true); if (target != null) DoCast(target, SpellIds.SummonPlayer); - - DoMeleeAttackIfReady(); } } diff --git a/Source/Scripts/World/NpcGuard.cs b/Source/Scripts/World/NpcGuard.cs index 73affa05a..fc62aa4f2 100644 --- a/Source/Scripts/World/NpcGuard.cs +++ b/Source/Scripts/World/NpcGuard.cs @@ -107,12 +107,9 @@ namespace Scripts.World.NpcGuard { me.ResetAttackTimer(); DoCastVictim(spellInfo.Id); - meleeContext.Repeat(); return; } } - me.AttackerStateUpdate(victim); - me.ResetAttackTimer(); meleeContext.Repeat(); }).Schedule(TimeSpan.FromSeconds(5), spellContext => { @@ -183,7 +180,7 @@ namespace Scripts.World.NpcGuard if (!UpdateVictim()) return; - _scheduler.Update(diff, DoMeleeAttackIfReady); + _scheduler.Update(diff); } void ScheduleVanish() diff --git a/Source/Scripts/World/NpcsSpecial.cs b/Source/Scripts/World/NpcsSpecial.cs index 299b77b1e..52017a2f2 100644 --- a/Source/Scripts/World/NpcsSpecial.cs +++ b/Source/Scripts/World/NpcsSpecial.cs @@ -207,8 +207,7 @@ namespace Scripts.World.NpcsSpecial ResetFlagTimer -= diff; } - if (UpdateVictim()) - DoMeleeAttackIfReady(); + UpdateVictim(); } public override void ReceiveEmote(Player player, TextEmotes emote)