feat: Adds Mobile.Murderer virtual property, consolidates kill-threshold checks (#2355)
## Summary - Adds `public virtual bool Murderer => Kills >= 5` property to `Mobile`, replacing ~30 scattered `Kills >= 5` / `Kills < 5` magic-number checks across the codebase - `BaseCreature` overrides `Murderer` to also return `true` when `AlwaysMurderer` is set - Updates `Corpse` serialization to v15, storing `_murderer` as a `bool` field (migrated from `int Kills >= 5` in earlier versions)
This commit is contained in:
parent
192f092ee7
commit
6745cf2075
31 changed files with 200 additions and 43 deletions
|
|
@ -557,6 +557,8 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual bool AlwaysMurderer => false;
|
||||
|
||||
public override bool Murderer => AlwaysMurderer || base.Murderer;
|
||||
|
||||
public virtual bool AlwaysAttackable => false;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
@ -2806,7 +2808,7 @@ namespace Server.Mobiles
|
|||
return;
|
||||
}
|
||||
|
||||
if (!Body.IsHuman || Kills >= 5 || AlwaysMurderer || AlwaysAttackable || m.Kills < 5 ||
|
||||
if (!Body.IsHuman || Murderer || AlwaysAttackable || !m.Murderer ||
|
||||
!m.InRange(Location, 12) || !m.Alive)
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public partial class Healer : BaseHealer
|
|||
return false;
|
||||
}
|
||||
|
||||
if (m.Kills >= 5)
|
||||
if (m.Murderer)
|
||||
{
|
||||
Say(501223); // Thou'rt not a decent and good person. I shall not resurrect thee.
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public partial class WanderingHealer : BaseHealer
|
|||
return false;
|
||||
}
|
||||
|
||||
if (m.Kills >= 5)
|
||||
if (m.Murderer)
|
||||
{
|
||||
Say(501223); // Thou'rt not a decent and good person. I shall not resurrect thee.
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ namespace Server.Mobiles
|
|||
InLOS(from))
|
||||
{
|
||||
m_NextResurrect = Core.Now + ResurrectDelay;
|
||||
if (!from.Criminal && from.Kills < 5 && from.Karma > 0)
|
||||
if (!from.Criminal && !from.Murderer && from.Karma > 0)
|
||||
{
|
||||
if (from.Map?.CanFit(from.Location, 16, false, false) == true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2595,7 +2595,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
if (Kills >= 5 && Core.Now >= m_NextJustAward)
|
||||
if (Murderer && Core.Now >= m_NextJustAward)
|
||||
{
|
||||
var m = FindMostRecentDamager(false);
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ public abstract partial class BaseChampion : BaseCreature
|
|||
|
||||
var prot = JusticeVirtue.GetProtector(pm);
|
||||
|
||||
if (prot == null || prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal ||
|
||||
if (prot == null || prot.Map != pm.Map || prot.Murderer || prot.Criminal ||
|
||||
!JusticeVirtue.CheckMapRegion(pm, prot))
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ public partial class Harrower : BaseCreature
|
|||
|
||||
var prot = JusticeVirtue.GetProtector(pm);
|
||||
|
||||
if (prot == null || prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal ||
|
||||
if (prot == null || prot.Map != pm.Map || prot.Murderer || prot.Criminal ||
|
||||
!JusticeVirtue.CheckMapRegion(pm, prot))
|
||||
{
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue