fix: Fixes NPCs attacking their own summons (#1773)
This commit is contained in:
parent
d6c87a4da4
commit
35a292d2c7
5 changed files with 17 additions and 9 deletions
|
|
@ -24,8 +24,6 @@ public abstract partial class BaseBOBEntry : IBOBEntry
|
||||||
|
|
||||||
public DateTime Created { get; set; } = Core.Now;
|
public DateTime Created { get; set; } = Core.Now;
|
||||||
|
|
||||||
public DateTime LastSerialized { get; set; } = Core.Now;
|
|
||||||
|
|
||||||
public Serial Serial { get; }
|
public Serial Serial { get; }
|
||||||
|
|
||||||
public bool Deleted { get; private set; }
|
public bool Deleted { get; private set; }
|
||||||
|
|
|
||||||
|
|
@ -1066,8 +1066,8 @@ public class MageAI : BaseAI
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanDispel(Mobile m) =>
|
public bool CanDispel(Mobile m) =>
|
||||||
m is BaseCreature creature && creature.Summoned && m_Mobile.CanBeHarmful(creature, false) &&
|
m is BaseCreature creature && creature.Summoned && creature.SummonMaster != m_Mobile &&
|
||||||
!creature.IsAnimatedDead;
|
m_Mobile.CanBeHarmful(creature, false) && !creature.IsAnimatedDead;
|
||||||
|
|
||||||
private bool ProcessTarget()
|
private bool ProcessTarget()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ public abstract class SummonUndeadCounter : MonsterAbility
|
||||||
summon.SummonMaster = source;
|
summon.SummonMaster = source;
|
||||||
summon.FightMode = FightMode.Closest;
|
summon.FightMode = FightMode.Closest;
|
||||||
summon.Combatant = target;
|
summon.Combatant = target;
|
||||||
|
summon.Home = source.Home;
|
||||||
|
summon.RangeHome = source.RangeHome;
|
||||||
}
|
}
|
||||||
|
|
||||||
summon.MoveToWorld(loc, source.Map);
|
summon.MoveToWorld(loc, source.Map);
|
||||||
|
|
|
||||||
|
|
@ -3582,7 +3582,6 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
creature.RangeHome = 10;
|
creature.RangeHome = 10;
|
||||||
creature.Summoned = true;
|
creature.Summoned = true;
|
||||||
|
|
||||||
creature.SummonMaster = caster;
|
creature.SummonMaster = caster;
|
||||||
|
|
||||||
var pack = creature.Backpack;
|
var pack = creature.Backpack;
|
||||||
|
|
|
||||||
|
|
@ -1060,11 +1060,20 @@ namespace Server.Mobiles
|
||||||
{
|
{
|
||||||
foreach (var m in World.Mobiles.Values)
|
foreach (var m in World.Mobiles.Values)
|
||||||
{
|
{
|
||||||
if (m is PlayerMobile pm &&
|
if (m is not PlayerMobile pm || pm.AllFollowers == null || pm.AllFollowers.Count == 0)
|
||||||
((!pm.Mounted || pm.Mount is EtherealMount) && pm.AllFollowers?.Count > pm.AutoStabled?.Count ||
|
|
||||||
pm.Mounted && pm.AllFollowers?.Count > (pm.AutoStabled?.Count ?? 0) + 1))
|
|
||||||
{
|
{
|
||||||
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue