From 3ade2d5e730fcf899448c545b6a019ab488d6fc8 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Tue, 14 Sep 2021 22:40:07 -0700 Subject: [PATCH] fix: Fixes random 0 (#783) --- Projects/UOContent/Mobiles/AI/MageAI.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Projects/UOContent/Mobiles/AI/MageAI.cs b/Projects/UOContent/Mobiles/AI/MageAI.cs index 93bc51226..8fe1f2c7a 100644 --- a/Projects/UOContent/Mobiles/AI/MageAI.cs +++ b/Projects/UOContent/Mobiles/AI/MageAI.cs @@ -399,7 +399,8 @@ namespace Server.Mobiles if (spell == null) { - if (!m_Mobile.DisallowAllMoves && Utility.Random((int)m_Mobile.GetDistanceToSqrt(toDispel)) == 0) + var distance = (int)m_Mobile.GetDistanceToSqrt(toDispel); + if (!m_Mobile.DisallowAllMoves && distance > 0 && Utility.Random(distance) == 0) { spell = new TeleportSpell(m_Mobile); }