From aa270ac868824249d8664d7f0c5e509d852cf536 Mon Sep 17 00:00:00 2001 From: mark1145 Date: Sat, 1 Oct 2022 07:54:19 +1000 Subject: [PATCH] fix: Abusing summons offscreen (#1175) --- Projects/UOContent/Mobiles/AI/BaseAI.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Projects/UOContent/Mobiles/AI/BaseAI.cs b/Projects/UOContent/Mobiles/AI/BaseAI.cs index 1c3af5465..93d4f0338 100644 --- a/Projects/UOContent/Mobiles/AI/BaseAI.cs +++ b/Projects/UOContent/Mobiles/AI/BaseAI.cs @@ -2588,6 +2588,8 @@ public abstract class BaseAI Mobile newFocusMob = null; var val = double.MinValue; + Mobile enemySummonMob = null; + var enemySummonVal = double.MinValue; var eable = map.GetMobilesInRange(m_Mobile.Location, iRange); @@ -2631,7 +2633,8 @@ public abstract class BaseAI var bc = m as BaseCreature; var pm = m as PlayerMobile; - if (Core.AOS && bc?.Summoned == true && bc?.Controlled != true) + // Monster don't attack it's own summon + if (Core.AOS && bc != null && bc.Summoned && bc.SummonMaster == m_Mobile) { continue; } @@ -2718,17 +2721,23 @@ public abstract class BaseAI } var theirVal = m_Mobile.GetFightModeRanking(m, acqType, bPlayerOnly); - if (theirVal > val && m_Mobile.InLOS(m)) { newFocusMob = m; val = theirVal; } + // The summon is targeted when nothing else around. Otherwise this monster enters idle mode. + // Do a check for this edge case so players cannot abuse by casting EVs offscreen to kill an idle monster. + else if (Core.AOS && theirVal > enemySummonVal && m_Mobile.InLOS(m) && bc?.Summoned == true && bc?.Controlled != true) + { + enemySummonMob = m; + enemySummonVal = theirVal; + } } eable.Free(); - m_Mobile.FocusMob = newFocusMob; + m_Mobile.FocusMob = newFocusMob ?? enemySummonMob; return m_Mobile.FocusMob != null; }