Skip to content

Commit

Permalink
Fixes notoriety
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman committed Nov 27, 2024
1 parent b6c392a commit 35af596
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions Projects/UOContent/Misc/Notoriety.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,16 @@ public static bool Mobile_AllowBeneficial(Mobile from, Mobile target)
return true;
}

var bcFrom = from as BaseCreature;
var bcTarg = target as BaseCreature;
var pmFrom = from as PlayerMobile;
var pmTarg = target as PlayerMobile;

if (pmFrom == null && bcFrom?.Summoned == true)
if (from.Region.IsPartOf<SafeZone>() || target.Region.IsPartOf<SafeZone>())
{
pmFrom = bcFrom.SummonMaster as PlayerMobile;
return false;
}

if (pmTarg == null && bcTarg?.Summoned == true)
{
pmTarg = bcTarg.SummonMaster as PlayerMobile;
}
var bcFrom = from as BaseCreature;
var bcTarg = target as BaseCreature;

var pmFrom = (bcFrom?.GetMaster() ?? from) as PlayerMobile;
var pmTarg = (bcTarg?.GetMaster() ?? target) as PlayerMobile;

if (pmFrom != null && pmTarg != null)
{
Expand Down Expand Up @@ -117,11 +113,6 @@ public static bool Mobile_AllowBeneficial(Mobile from, Mobile target)
return false;
}

if (from.Region.IsPartOf<SafeZone>() || target.Region.IsPartOf<SafeZone>())
{
return false;
}

var map = from.Map;

var targetFaction = Faction.Find(target, true);
Expand All @@ -136,7 +127,7 @@ public static bool Mobile_AllowBeneficial(Mobile from, Mobile target)
return true; // In felucca, anything goes
}

if (!from.Player)
if (pmFrom == null && !from.Player)
{
return true; // NPCs have no restrictions
}
Expand All @@ -146,7 +137,7 @@ public static bool Mobile_AllowBeneficial(Mobile from, Mobile target)
return false; // Players cannot heal uncontrolled mobiles
}

if (pmFrom?.Young == true && pmTarg?.Young != true)
if (pmFrom?.Young == true && pmTarg?.Young == false)
{
return false; // Young players cannot perform beneficial actions towards older players
}
Expand Down

0 comments on commit 35af596

Please sign in to comment.