Skip to content

Commit

Permalink
Adjusts harmful checks to match beneficial checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman committed Nov 27, 2024
1 parent dbe21e0 commit ed073a8
Showing 1 changed file with 20 additions and 28 deletions.
48 changes: 20 additions & 28 deletions Projects/UOContent/Misc/Notoriety.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,16 @@ public static bool Mobile_AllowHarmful(Mobile from, Mobile target)
return true;
}

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

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 @@ -208,11 +204,6 @@ public static bool Mobile_AllowHarmful(Mobile from, Mobile target)
return false;
}

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

var map = from.Map;

if ((map?.Rules & MapRules.HarmfulRestrictions) == 0)
Expand Down Expand Up @@ -258,23 +249,24 @@ public static bool Mobile_AllowHarmful(Mobile from, Mobile target)

public static Guild GetGuildFor(Guild def, Mobile m)
{
var g = def;
if (m is not BaseCreature c || !c.Controlled || c.ControlMaster == null)
{
return def;
}

c.DisplayGuildTitle = false;

if (m is BaseCreature c && c.Controlled && c.ControlMaster != null)
if (c.Map != Map.Internal && (Core.AOS || Guild.NewGuildSystem || c.ControlOrder is OrderType.Attack or OrderType.Guard))
{
c.DisplayGuildTitle = false;
return (Guild)(c.Guild = c.ControlMaster.Guild);
}

if (c.Map != Map.Internal && (Core.AOS || Guild.NewGuildSystem || c.ControlOrder is OrderType.Attack or OrderType.Guard))
{
g = (Guild)(c.Guild = c.ControlMaster.Guild);
}
else if (c.Map == Map.Internal || c.ControlMaster.Guild == null)
{
g = (Guild)(c.Guild = null);
}
if (c.Map == Map.Internal || c.ControlMaster.Guild == null)
{
return (Guild)(c.Guild = null);
}

return g;
return def;
}

public static int CorpseNotoriety(Mobile source, Corpse target)
Expand Down

0 comments on commit ed073a8

Please sign in to comment.