fix: Fixes debug say (#1193)

This commit is contained in:
Kamron Batman 2022-10-16 17:57:14 -07:00 • committed by GitHub
parent 5e7dbb53c1
commit 9b2b34f5fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 15 deletions

View file

@ -28,8 +28,9 @@ public partial class Timer
private const int _tickRatePowerOf2 = 3; private const int _tickRatePowerOf2 = 3;
private const int _tickRate = 1 << _tickRatePowerOf2; // 8ms private const int _tickRate = 1 << _tickRatePowerOf2; // 8ms
private static readonly Timer[][] _rings = new Timer[_ringLayers][]; private static Timer[][] _rings = new Timer[_ringLayers][];
private static readonly int[] _ringIndexes = new int[_ringLayers]; private static int[] _ringIndexes = new int[_ringLayers];
private static Timer[] _executingRings = new Timer[_ringLayers];
private static long _lastTickTurned = -1; private static long _lastTickTurned = -1;
private static bool _timerWheelExecuting; private static bool _timerWheelExecuting;
@ -61,8 +62,6 @@ public partial class Timer
_timerWheelExecuting = true; _timerWheelExecuting = true;
var turnNextWheel = false; 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. // Detach the chain from the timer wheel. This allows adding timers to the same slot during execution.
for (var i = 0; i < _ringLayers; i++) for (var i = 0; i < _ringLayers; i++)
{ {
@ -120,6 +119,9 @@ public partial class Timer
timer = next; timer = next;
} while (timer != null); } while (timer != null);
// Clear out the rings
_executingRings[i] = null;
} }
_timerWheelExecuting = false; _timerWheelExecuting = false;

View file

@ -82,7 +82,11 @@ public class HealerAI : BaseAI
} }
else if (NeedLHeal(toHelp)) 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(); 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 static bool NeedLHeal(Mobile m) => m.Hits < m.HitsMax - 10;
private delegate bool NeedDelegate(Mobile m); private delegate bool NeedDelegate(Mobile m);
} }

View file

@ -419,14 +419,20 @@ public class MageAI : BaseAI
goto default; goto default;
} }
m_Mobile.DebugSay("Attempting to poison"); if (m_Mobile.Debug)
{
m_Mobile.DebugSay("Attempting to poison");
}
spell = new PoisonSpell(m_Mobile); spell = new PoisonSpell(m_Mobile);
break; break;
} }
case 2: // Bless ourselves case 2: // Bless ourselves
{ {
m_Mobile.DebugSay("Blessing myself"); if (m_Mobile.Debug)
{
m_Mobile.DebugSay("Blessing myself");
}
spell = new BlessSpell(m_Mobile); spell = new BlessSpell(m_Mobile);
break; break;
@ -434,7 +440,10 @@ public class MageAI : BaseAI
case 3: case 3:
case 4: // Curse them case 4: // Curse them
{ {
m_Mobile.DebugSay("Attempting to curse"); if (m_Mobile.Debug)
{
m_Mobile.DebugSay("Attempting to curse");
}
spell = GetRandomCurseSpell(); spell = GetRandomCurseSpell();
break; break;
@ -446,14 +455,20 @@ public class MageAI : BaseAI
goto default; goto default;
} }
m_Mobile.DebugSay("Attempting to paralyze"); if (m_Mobile.Debug)
{
m_Mobile.DebugSay("Attempting to paralyze");
}
spell = new ParalyzeSpell(m_Mobile); spell = new ParalyzeSpell(m_Mobile);
break; break;
} }
case 6: // Drain mana case 6: // Drain mana
{ {
m_Mobile.DebugSay("Attempting to drain mana"); if (m_Mobile.Debug)
{
m_Mobile.DebugSay("Attempting to drain mana");
}
spell = GetRandomManaDrainSpell(); spell = GetRandomManaDrainSpell();
break; break;
@ -465,14 +480,20 @@ public class MageAI : BaseAI
goto default; 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); spell = new InvisibilitySpell(m_Mobile);
break; break;
} }
default: // Damage them default: // Damage them
{ {
m_Mobile.DebugSay("Just doing damage"); if (m_Mobile.Debug)
{
m_Mobile.DebugSay("Just doing damage");
}
spell = GetRandomDamageSpell(); spell = GetRandomDamageSpell();
break; break;
@ -517,7 +538,10 @@ public class MageAI : BaseAI
{ {
if (c.Paralyzed && !c.Poisoned && !m_Mobile.Meditating) 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); m_Mobile.UseSkill(SkillName.Meditation);
} }
@ -1199,4 +1223,4 @@ public class MageAI : BaseAI
return true; return true;
} }
} }