public static bool CanDetect(Mobile src, Mobile target, bool direct) { if (src.Map == null || target.Map == null || !src.CanBeHarmful(target, false, false, true)) { return(false); } // No invulnerable NPC's if (src.Blessed || (src is BaseCreature && ((BaseCreature)src).IsInvulnerable)) { return(false); } if (target.Blessed || (target is BaseCreature && ((BaseCreature)target).IsInvulnerable)) { return(false); } // pets shouldn't reveal their masters if (src is BaseCreature sbc && sbc.ControlMaster == target) { return(false); } SpellHelper.CheckResponsible(ref src); SpellHelper.CheckResponsible(ref target); if (src.Map.Rules == MapRules.FeluccaRules && direct) { return(!SpellHelper.IsGuildAllyOrParty(src, target)); } // pet owner, guild/alliance, party if (!SpellHelper.ValidIndirectTarget(target, src)) { return(false); } // Checked aggressed/aggressors if (src.Aggressed.Any(x => x.Defender == target) || src.Aggressors.Any(x => x.Attacker == target)) { return(true); } return(src.Map.Rules == MapRules.FeluccaRules); }
public static bool CanDetect(Mobile src, Mobile target, bool direct) { if (src.Map == null || target.Map == null || !src.CanBeHarmful(target, false, false, true)) { return(false); } // No invulnerable NPC's if (src.Blessed || src is BaseCreature creature && creature.IsInvulnerable) { return(false); } if (target.Blessed || target is BaseCreature baseCreature && baseCreature.IsInvulnerable) { return(false); } SpellHelper.CheckResponsible(ref src); SpellHelper.CheckResponsible(ref target); if (src.Map.Rules == MapRules.FeluccaRules && direct) { return(!SpellHelper.IsGuildAllyOrParty(src, target)); } // pet owner, guild/alliance, party if (!SpellHelper.ValidIndirectTarget(target, src)) { return(false); } // Checked aggressed/aggressors bool aggressed = false; for (var index = 0; index < src.Aggressed.Count; index++) { var x = src.Aggressed[index]; if (x.Defender == target) { aggressed = true; break; } } bool aggressors = false; for (var index = 0; index < src.Aggressors.Count; index++) { var x = src.Aggressors[index]; if (x.Attacker == target) { aggressors = true; break; } } if (aggressed || aggressors) { return(true); } return(src.Map.Rules == MapRules.FeluccaRules); }