public static bool IsFormationInsideCastle( Formation formation, bool includeOnlyPositionedUnits, float thresholdPercentage = 0.4f) { int num1 = includeOnlyPositionedUnits ? formation.arrangement.PositionedUnitCount : formation.CountOfUnits; float num2 = (float)num1 * thresholdPercentage; if (num1 != 0) { return((double)formation.CountUnitsOnNavMeshIDMod10(1, includeOnlyPositionedUnits) >= (double)num2); } return(!(formation.Team.TeamAI is TeamAISiegeAttacker) && !(formation.Team.TeamAI is TeamAISallyOutDefender) && (formation.Team.TeamAI is TeamAISiegeDefender || formation.Team.TeamAI is TeamAISallyOutAttacker)); }