Terraria.ModLoader.ProjectileLoader.CanHitNPC C# (CSharp) Method

CanHitNPC() public static method

public static CanHitNPC ( Projectile projectile, NPC target ) : bool?
projectile Projectile
target NPC
return bool?
        public static bool? CanHitNPC(Projectile projectile, NPC target)
        {
            bool? flag = null;
            foreach (var hook in HookCanHitNPC)
            {
                bool? canHit = hook(projectile, target);
                if (canHit.HasValue && !canHit.Value)
                {
                    return false;
                }
                if (canHit.HasValue)
                {
                    flag = canHit.Value;
                }
            }
            if (projectile.modProjectile != null)
            {
                bool? canHit = projectile.modProjectile.CanHitNPC(target);
                if (canHit.HasValue && !canHit.Value)
                {
                    return false;
                }
                if (canHit.HasValue)
                {
                    flag = canHit.Value;
                }
            }
            return flag;
        }