diff --git a/Projects/Server/Timer/Timer.TimerWheel.cs b/Projects/Server/Timer/Timer.TimerWheel.cs index 0462fc307..8062264dd 100644 --- a/Projects/Server/Timer/Timer.TimerWheel.cs +++ b/Projects/Server/Timer/Timer.TimerWheel.cs @@ -28,8 +28,9 @@ public partial class Timer private const int _tickRatePowerOf2 = 3; private const int _tickRate = 1 << _tickRatePowerOf2; // 8ms - private static readonly Timer[][] _rings = new Timer[_ringLayers][]; - private static readonly int[] _ringIndexes = new int[_ringLayers]; + private static Timer[][] _rings = new Timer[_ringLayers][]; + private static int[] _ringIndexes = new int[_ringLayers]; + private static Timer[] _executingRings = new Timer[_ringLayers]; private static long _lastTickTurned = -1; private static bool _timerWheelExecuting; @@ -61,8 +62,6 @@ public partial class Timer _timerWheelExecuting = true; var turnNextWheel = false; - var _executingRings = new Timer[_ringLayers]; - // Detach the chain from the timer wheel. This allows adding timers to the same slot during execution. for (var i = 0; i < _ringLayers; i++) { @@ -120,6 +119,9 @@ public partial class Timer timer = next; } while (timer != null); + + // Clear out the rings + _executingRings[i] = null; } _timerWheelExecuting = false; diff --git a/Projects/UOContent/Mobiles/AI/HealerAI.cs b/Projects/UOContent/Mobiles/AI/HealerAI.cs index ad2b7bc3d..a44580f01 100644 --- a/Projects/UOContent/Mobiles/AI/HealerAI.cs +++ b/Projects/UOContent/Mobiles/AI/HealerAI.cs @@ -82,7 +82,11 @@ public class HealerAI : BaseAI } else if (NeedLHeal(toHelp)) { - m_Mobile.DebugSay("{toHelp.Name} needs a lesser heal"); + if (m_Mobile.Debug) + { + m_Mobile.DebugSay("{toHelp.Name} needs a lesser heal"); + } + new HealSpell(m_Mobile).Cast(); } } @@ -168,4 +172,4 @@ public class HealerAI : BaseAI private static bool NeedLHeal(Mobile m) => m.Hits < m.HitsMax - 10; private delegate bool NeedDelegate(Mobile m); -} \ No newline at end of file +} diff --git a/Projects/UOContent/Mobiles/AI/MageAI.cs b/Projects/UOContent/Mobiles/AI/MageAI.cs index 5984c0a2f..4201729c9 100644 --- a/Projects/UOContent/Mobiles/AI/MageAI.cs +++ b/Projects/UOContent/Mobiles/AI/MageAI.cs @@ -419,14 +419,20 @@ public class MageAI : BaseAI goto default; } - m_Mobile.DebugSay("Attempting to poison"); + if (m_Mobile.Debug) + { + m_Mobile.DebugSay("Attempting to poison"); + } spell = new PoisonSpell(m_Mobile); break; } case 2: // Bless ourselves { - m_Mobile.DebugSay("Blessing myself"); + if (m_Mobile.Debug) + { + m_Mobile.DebugSay("Blessing myself"); + } spell = new BlessSpell(m_Mobile); break; @@ -434,7 +440,10 @@ public class MageAI : BaseAI case 3: case 4: // Curse them { - m_Mobile.DebugSay("Attempting to curse"); + if (m_Mobile.Debug) + { + m_Mobile.DebugSay("Attempting to curse"); + } spell = GetRandomCurseSpell(); break; @@ -446,14 +455,20 @@ public class MageAI : BaseAI goto default; } - m_Mobile.DebugSay("Attempting to paralyze"); + if (m_Mobile.Debug) + { + m_Mobile.DebugSay("Attempting to paralyze"); + } spell = new ParalyzeSpell(m_Mobile); break; } case 6: // Drain mana { - m_Mobile.DebugSay("Attempting to drain mana"); + if (m_Mobile.Debug) + { + m_Mobile.DebugSay("Attempting to drain mana"); + } spell = GetRandomManaDrainSpell(); break; @@ -465,14 +480,20 @@ public class MageAI : BaseAI goto default; } - m_Mobile.DebugSay("Attempting to invis myself"); + if (m_Mobile.Debug) + { + m_Mobile.DebugSay("Attempting to invis myself"); + } spell = new InvisibilitySpell(m_Mobile); break; } default: // Damage them { - m_Mobile.DebugSay("Just doing damage"); + if (m_Mobile.Debug) + { + m_Mobile.DebugSay("Just doing damage"); + } spell = GetRandomDamageSpell(); break; @@ -517,7 +538,10 @@ public class MageAI : BaseAI { if (c.Paralyzed && !c.Poisoned && !m_Mobile.Meditating) { - m_Mobile.DebugSay("I am going to meditate"); + if (m_Mobile.Debug) + { + m_Mobile.DebugSay("I am going to meditate"); + } m_Mobile.UseSkill(SkillName.Meditation); } @@ -1199,4 +1223,4 @@ public class MageAI : BaseAI return true; } -} \ No newline at end of file +}