From 95e55e994f843999f3cf8af436210a5df25fa1da Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Tue, 21 Feb 2023 18:15:57 -0800 Subject: [PATCH] fix: Fixes young healing each other (#1345) --- Projects/UOContent/Misc/Notoriety.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Projects/UOContent/Misc/Notoriety.cs b/Projects/UOContent/Misc/Notoriety.cs index 3dfd5d0a5..e86c81ecc 100644 --- a/Projects/UOContent/Misc/Notoriety.cs +++ b/Projects/UOContent/Misc/Notoriety.cs @@ -70,15 +70,17 @@ namespace Server.Misc 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 && from is BaseCreature bcFrom && bcFrom.Summoned) + if (pmFrom == null && bcFrom?.Summoned == true) { pmFrom = bcFrom.SummonMaster as PlayerMobile; } - if (pmTarg == null && target is BaseCreature bcTarg && bcTarg.Summoned) + if (pmTarg == null && bcTarg?.Summoned == true) { pmTarg = bcTarg.SummonMaster as PlayerMobile; } @@ -131,12 +133,9 @@ namespace Server.Misc var targetFaction = Faction.Find(target, true); - if ((!Core.ML || map == Faction.Facet) && targetFaction != null) + if ((!Core.ML || map == Faction.Facet) && targetFaction != null && Faction.Find(from, true) != targetFaction) { - if (Faction.Find(from, true) != targetFaction) - { - return false; - } + return false; } if ((map?.Rules & MapRules.BeneficialRestrictions) == 0) @@ -149,12 +148,12 @@ namespace Server.Misc return true; // NPCs have no restrictions } - if (target is BaseCreature creature && !creature.Controlled) + if (bcTarg?.Controlled == false) { return false; // Players cannot heal uncontrolled mobiles } - if (pmFrom?.Young == true || pmTarg?.Young == true) + if (pmFrom?.Young == true && pmTarg?.Young != true) { return false; // Young players cannot perform beneficial actions towards older players }