public static bool Mobile_AllowHarmful(Mobile from, Mobile target) { if (from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player) { return(true); } PlayerMobile pmFrom = from as PlayerMobile; PlayerMobile pmTarg = target as PlayerMobile; BaseCreature bcTarg = target as BaseCreature; if (pmFrom == null && from is BaseCreature bcFrom && bcFrom.Summoned) { pmFrom = bcFrom.SummonMaster as PlayerMobile; } if (pmTarg == null && bcTarg?.Summoned == true) { pmTarg = bcTarg.SummonMaster as PlayerMobile; } if (pmFrom != null && pmTarg != null) { if (pmFrom.DuelContext != pmTarg.DuelContext && (pmFrom.DuelContext?.Started == true || pmTarg.DuelContext?.Started == true)) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated)) { return(false); } if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament?.IsNotoRestricted == true && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant) { return(false); } if (pmFrom.DuelContext?.Started == true && pmFrom.DuelContext == pmTarg.DuelContext) { return(true); } } if (pmFrom?.DuelContext?.Started == true || pmTarg?.DuelContext?.Started == true) { return(false); } if (from.Region.IsPartOf <SafeZone>() || target.Region.IsPartOf <SafeZone>()) { return(false); } Map map = from.Map; if ((map?.Rules & MapRules.HarmfulRestrictions) == 0) { return(true); // In felucca, anything goes } if (!from.Player && !(from is BaseCreature bc && bc.GetMaster() != null && bc.GetMaster().AccessLevel == AccessLevel.Player)) { if (!CheckAggressor(from.Aggressors, target) && !CheckAggressed(from.Aggressed, target) && pmTarg?.CheckYoungProtection(from) == true) { return(false); } return(true); // Uncontrolled NPCs are only restricted by the young system } Guild fromGuild = GetGuildFor(from.Guild as Guild, from); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly(targetGuild) || fromGuild.IsEnemy(targetGuild))) { return(true); // Guild allies or enemies can be harmful } if (bcTarg?.Controlled == true || (bcTarg?.Summoned == true && bcTarg?.SummonMaster != from)) { return(false); // Cannot harm other controlled mobiles } if (target.Player) { return(false); // Cannot harm other players } return(bcTarg?.InitialInnocent == true || Notoriety.Compute(from, target) != Notoriety.Innocent); }