fix: player corpse notoriety ignores the owner's body at death (#2669)
CorpseNotoriety returned Murderer for a player corpse whenever the corpse body was a monster body. RunUO's check was `body.IsMonster && IsSummoned(owner)`, which is never true for a player; the second half was lost when the branch was simplified (#134). Players who died while polymorphed or in a necromancer form left a corpse with the wrong notoriety. Player corpses also check murderer and criminal status before guild standing again, matching RunUO and MobileNotoriety. Tests: UOContent.Tests 1162 passed (4 new CorpseNotorietyTests).
This commit is contained in:
parent
08dab47413
commit
92ed9c5456
2 changed files with 60 additions and 16 deletions
40
Projects/UOContent.Tests/Tests/Misc/CorpseNotorietyTests.cs
Normal file
40
Projects/UOContent.Tests/Tests/Misc/CorpseNotorietyTests.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Xunit;
|
||||
|
||||
namespace UOContent.Tests;
|
||||
|
||||
[Collection("Sequential UOContent Tests")]
|
||||
public class CorpseNotorietyTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(0, Notoriety.Innocent)] // Human body
|
||||
[InlineData(746, Notoriety.Innocent)] // Horrific Beast, a monster body
|
||||
[InlineData(0, Notoriety.Murderer, 5)]
|
||||
[InlineData(746, Notoriety.Murderer, 5)]
|
||||
public void PlayerCorpseNotorietyIgnoresTransformedBody(int bodyMod, int expected, int kills = 0)
|
||||
{
|
||||
var victim = new PlayerMobile(World.NewMobile);
|
||||
victim.DefaultMobileInit();
|
||||
victim.Kills = kills;
|
||||
victim.BodyMod = bodyMod;
|
||||
|
||||
var looter = new PlayerMobile(World.NewMobile);
|
||||
looter.DefaultMobileInit();
|
||||
|
||||
var corpse = new Corpse(victim, []);
|
||||
|
||||
try
|
||||
{
|
||||
Assert.Equal(expected, NotorietyHandlers.CorpseNotoriety(looter, corpse));
|
||||
}
|
||||
finally
|
||||
{
|
||||
corpse.Delete();
|
||||
victim.Delete();
|
||||
looter.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue