## 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
153 lines
4.6 KiB
C#
153 lines
4.6 KiB
C#
using ModernUO.Serialization;
|
|
|
|
namespace Server.Mobiles
|
|
{
|
|
[SerializationGenerator(0, false)]
|
|
public partial class EnragedRabbit : BaseEnraged
|
|
{
|
|
public EnragedRabbit(Mobile summoner) : base(summoner) => Body = 0xcd;
|
|
|
|
public override string CorpseName => "a hare corpse";
|
|
public override string DefaultName => "a rabbit";
|
|
|
|
public override int GetAttackSound() => 0xC9;
|
|
|
|
public override int GetHurtSound() => 0xCA;
|
|
|
|
public override int GetDeathSound() => 0xCB;
|
|
}
|
|
|
|
[SerializationGenerator(0, false)]
|
|
public partial class EnragedHart : BaseEnraged
|
|
{
|
|
public EnragedHart(Mobile summoner) : base(summoner) => Body = 0xea;
|
|
|
|
public override string CorpseName => "a deer corpse";
|
|
public override string DefaultName => "a great hart";
|
|
|
|
public override int GetAttackSound() => 0x82;
|
|
|
|
public override int GetHurtSound() => 0x83;
|
|
|
|
public override int GetDeathSound() => 0x84;
|
|
}
|
|
|
|
[SerializationGenerator(0, false)]
|
|
public partial class EnragedHind : BaseEnraged
|
|
{
|
|
public EnragedHind(Mobile summoner) : base(summoner) => Body = 0xed;
|
|
|
|
public override string CorpseName => "a deer corpse";
|
|
public override string DefaultName => "a hind";
|
|
|
|
public override int GetAttackSound() => 0x82;
|
|
|
|
public override int GetHurtSound() => 0x83;
|
|
|
|
public override int GetDeathSound() => 0x84;
|
|
}
|
|
|
|
[SerializationGenerator(0, false)]
|
|
public partial class EnragedBlackBear : BaseEnraged
|
|
{
|
|
public EnragedBlackBear(Mobile summoner) : base(summoner)
|
|
{
|
|
Body = 0xd3;
|
|
BaseSoundID = 0xa3;
|
|
}
|
|
|
|
public override string CorpseName => "a bear corpse";
|
|
public override string DefaultName => "a black bear";
|
|
}
|
|
|
|
[SerializationGenerator(0, false)]
|
|
public partial class EnragedEagle : BaseEnraged
|
|
{
|
|
public EnragedEagle(Mobile summoner) : base(summoner)
|
|
{
|
|
Body = 0x5;
|
|
BaseSoundID = 0x2ee;
|
|
}
|
|
|
|
public override string CorpseName => "an eagle corpse";
|
|
public override string DefaultName => "an eagle";
|
|
}
|
|
|
|
[SerializationGenerator(0, false)]
|
|
public partial class BaseEnraged : BaseCreature
|
|
{
|
|
public BaseEnraged(Mobile summoner) : base(AIType.AI_Melee)
|
|
{
|
|
SetStr(50, 200);
|
|
SetDex(50, 200);
|
|
|
|
/*
|
|
* On OSI, all stats are random 50-200, but
|
|
* str is never less than hits, and dex is never
|
|
* less than stam.
|
|
*/
|
|
SetHits(50, Str);
|
|
SetStam(50, Dex);
|
|
|
|
Karma = -1000;
|
|
Tamable = false;
|
|
|
|
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)
|
|
{
|
|
Delete();
|
|
}
|
|
/*
|
|
On OSI, without combatant, they behave as if they have been
|
|
given "come" command, ie they wander towards their summoner,
|
|
but never actually "follow".
|
|
*/
|
|
else if (!Combat(this))
|
|
{
|
|
AIObject?.MoveTo(SummonMaster, 5);
|
|
}
|
|
/*
|
|
On OSI, if the summon attacks a mobile, the summoner meer also
|
|
attacks them, regardless of karma, etc. as long as the combatant
|
|
is a player or controlled/summoned, and the summoner is not already
|
|
engaged in combat.
|
|
*/
|
|
else if (!Combat(SummonMaster))
|
|
{
|
|
if (Combatant.Player || Combatant is BaseCreature bc && bc.GetMaster() != null)
|
|
{
|
|
SummonMaster.Combatant = Combatant;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
base.OnThink();
|
|
}
|
|
}
|
|
|
|
private bool Combat(Mobile mobile)
|
|
{
|
|
var combatant = mobile.Combatant;
|
|
return combatant?.Deleted == false && !combatant.IsDeadBondedPet && combatant.Alive;
|
|
}
|
|
|
|
public override void OnSingleClick(Mobile from)
|
|
{
|
|
base.OnSingleClick(from);
|
|
PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1060768, from.NetState); // enraged
|
|
}
|
|
|
|
public override void AddNameProperties(IPropertyList list)
|
|
{
|
|
base.AddNameProperties(list);
|
|
list.Add(1060768); // enraged
|
|
}
|
|
}
|
|
}
|