unsigned mindShields = std::count_if(_facilities.begin(), _facilities.end(), isMindShield());
unsigned completedFacilities = std::count_if(_facilities.begin(), _facilities.end(), isCompleted());
return (completedFacilities / 6 + 15) / (mindShields + 1);
as you can see it takes mind shields into account as well.
all this function does is give odds of detection.
the actual determination takes place elsewhere in the code, using the return value of this function as a percentage chance, under a bunch of other conditions.