fix: Fixes NPCs attacking their own summons (#1773)

This commit is contained in:
Kamron Batman 2024-05-11 16:32:55 -07:00 committed by GitHub
parent d6c87a4da4
commit 35a292d2c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 9 deletions

View file

@ -24,8 +24,6 @@ public abstract partial class BaseBOBEntry : IBOBEntry
public DateTime Created { get; set; } = Core.Now;
public DateTime LastSerialized { get; set; } = Core.Now;
public Serial Serial { get; }
public bool Deleted { get; private set; }

View file

@ -1066,8 +1066,8 @@ public class MageAI : BaseAI
}
public bool CanDispel(Mobile m) =>
m is BaseCreature creature && creature.Summoned && m_Mobile.CanBeHarmful(creature, false) &&
!creature.IsAnimatedDead;
m is BaseCreature creature && creature.Summoned && creature.SummonMaster != m_Mobile &&
m_Mobile.CanBeHarmful(creature, false) && !creature.IsAnimatedDead;
private bool ProcessTarget()
{

View file

@ -51,6 +51,8 @@ public abstract class SummonUndeadCounter : MonsterAbility
summon.SummonMaster = source;
summon.FightMode = FightMode.Closest;
summon.Combatant = target;
summon.Home = source.Home;
summon.RangeHome = source.RangeHome;
}
summon.MoveToWorld(loc, source.Map);

View file

@ -3582,7 +3582,6 @@ namespace Server.Mobiles
creature.RangeHome = 10;
creature.Summoned = true;
creature.SummonMaster = caster;
var pack = creature.Backpack;

View file

@ -1060,11 +1060,20 @@ namespace Server.Mobiles
{
foreach (var m in World.Mobiles.Values)
{
if (m is PlayerMobile pm &&
((!pm.Mounted || pm.Mount is EtherealMount) && pm.AllFollowers?.Count > pm.AutoStabled?.Count ||
pm.Mounted && pm.AllFollowers?.Count > (pm.AutoStabled?.Count ?? 0) + 1))
if (m is not PlayerMobile pm || pm.AllFollowers == null || pm.AllFollowers.Count == 0)
{
pm.AutoStablePets(); /* autostable checks summons, et al: no need here */
continue;
}
var autoStabledCount = pm.AutoStabled?.Count ?? 0;
if (pm.Mounted && pm.Mount is not EtherealMount)
{
autoStabledCount++;
}
if (pm.AllFollowers.Count > autoStabledCount)
{
pm.AutoStablePets();
}
}
}