MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / getDetectionChance

Method getDetectionChance

src/Savegame/Base.cpp:1217–1222  ·  view source on GitHub ↗

* Calculate the detection chance of this base. * Big bases without mindshields are easier to detect. * @param difficulty The savegame difficulty. * @return The detection chance. */

Source from the content-addressed store, hash-verified

1215 * @return The detection chance.
1216 */
1217size_t Base::getDetectionChance(int difficulty) const
1218{
1219 size_t mindShields = std::count_if(_facilities.begin(), _facilities.end(), isMindShield());
1220 size_t completedFacilities = std::count_if(_facilities.begin(), _facilities.end(), isCompleted());
1221 return ((completedFacilities / 6 + 15) / (mindShields + 1)) * (int)(1 + difficulty / 2);
1222}
1223
1224int Base::getGravShields() const
1225{

Callers 1

operator()Method · 0.80

Calls 2

isMindShieldClass · 0.85
isCompletedClass · 0.85

Tested by

no test coverage detected