fix(ai): meer mages and their enraged creatures no longer fight each other (#2673)
## Summary A meer mage fights `FightMode.Evil` and its enraged creatures carry -1000 karma, so `BaseCreature.IsEnemy` made each an enemy of the other: - The meer acquired its own enraged creatures as ordinary targets. - An enraged creature fell back to attacking its meer when nothing else was in range. It isn't `Summoned`, so it reached the meer through `AcquireNewFocusMob`'s summon-master fallback. `BaseEnraged` and `MeerMage` now override `IsEnemy` to exclude each other. Another meer's creatures stay enemies. `BaseEnraged` also pulled its meer into fights against any creature with a `SummonMaster`, which included another meer's enraged creatures. It now checks `GetMaster()`, matching the "controlled/summoned" OSI note in that method. ## Test plan - [x] `MeerAndItsEnragedCreature_AreNotEnemies`: fails before the fix - [x] `AnotherMeersEnragedCreature_StaysAnEnemy` - [x] `MeerAndItsEnragedCreature_NeverAcquireEachOther`: fails before the fix (the meer acquired its own creature) - [x] UOContent.Tests (1171 passed, 2 skipped) and Server.Tests (907) green
This commit is contained in:
parent
05b6ca9d5d
commit
37970a4811
3 changed files with 84 additions and 1 deletions
|
|
@ -95,6 +95,9 @@ namespace Server.Mobiles
|
|||
SummonMaster = summoner;
|
||||
}
|
||||
|
||||
// The meer's FightMode.Evil against our negative karma would otherwise make us enemies.
|
||||
public override bool IsEnemy(Mobile m) => m != SummonMaster && base.IsEnemy(m);
|
||||
|
||||
public override void OnThink()
|
||||
{
|
||||
if (SummonMaster?.Deleted != false)
|
||||
|
|
@ -118,7 +121,7 @@ namespace Server.Mobiles
|
|||
*/
|
||||
else if (!Combat(SummonMaster))
|
||||
{
|
||||
if (Combatant.Player || Combatant is BaseCreature bc && (bc.Controlled || bc.SummonMaster != null))
|
||||
if (Combatant.Player || Combatant is BaseCreature bc && bc.GetMaster() != null)
|
||||
{
|
||||
SummonMaster.Combatant = Combatant;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool InitialInnocent => true;
|
||||
|
||||
// FightMode.Evil would otherwise target our own enraged creatures for their negative karma.
|
||||
public override bool IsEnemy(Mobile m) => (m as BaseEnraged)?.SummonMaster != this && base.IsEnemy(m);
|
||||
|
||||
public override void GenerateLoot()
|
||||
{
|
||||
AddLoot(LootPack.FilthyRich);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue