[WIP] Overhaul of code involving requirements, recipes and skills.

From commit notes:

Includes:
 * A massive amount of const-correctness fixes, particularly to code involving the Skill class.
 * Removing differentiation between primary and secondary skill requirements
 * Moving skill requirements to src/requirements.cpp, paving way to using them for vehicles and construction
 * Modified recipe success formulas, they're reasonably similar to the previous ones, save for the 100% broken chance-to-learn recipe
 * Changing skill requirements internally to a more easily extensible format
 * [WIP] Ability to load said requirements from a different JSON structure, that can be more easily included in different entity types in the future. So far this is heavily WIP
 * Adding to above two points: Backwards-compatibility is kept, no data file changes included
 * [WIP] Crafting UI changes. WIP part includes showing a confidence/difficulty rating instead of a raw %
 * Minor fix for two typos in recipe_food.json

Also, changes I forgot to mention there:
 * Unlearnable recipes in books are shown in red
 * Recipe learning threshold from books now uses recipe skill requirements, due to there no longer being a primary skill/difficulty pair. This is probably the biggest non-structural change of them all, but I'm not sure anything can be done about it. Perhaps a flat bonus/penalty to skill levels required.
 * Skill requirements now include few more factors that can be overwritten in the new(wip) requirement JSON format, this includes base success chance, and splitting minimum required skill off from difficulty, meaning it will be possible to enable crafting higher-level recipes at a significant failure probability penalty, if that turns out to be a desirable thing, or to make recipes harder than their base requirement.
 * Some formatting changes - I upgraded bits of code to C++11, primarily just the for-in syntax, renamed some cryptic variable names, and added few intermediate variables in some places to make code more readable.

Forgive me for submitting a single huge monolithic commit, but the code was essentially spaghetti. From gameplay point of view, the changes are not significant, outside of the modified recipe success probabilities(they're reasonably close to before, though) necessitated by the fact that the old dice-based algorithms were impossible or at least very hard to extend to support multiple skills, and as such I have replaced it with a simple algorithm that can be modified by a single difficulty modifier parameter.

This is not yet finished, as it contains few issues that I ended up not fixing due to having to leave my development machine, notably probability of critical failure is way too high, and difficulty penalties for learning recipes need adjustments - currently, disassembly, learning by crafting, reading from books all use the same success chance as crafting.

And yet again, forgive me for how monolithic this is, trust me that the code was intertwined enough that the difficulty of changing it independent-bit-by-bit was somewhere between "impossible" and "I'm not good enough of a coder".
Good point. There's a lot of WIP in this stuff. 

BevapDin <notifications@github.com> wrote:

>> +double skill_requirement::success_rate(const player& _player, double difficulty_modifier) const
>> +{
>> +    if (difficulty == 0) return 1.0; // It's impossible to fail level 0 recipes
>> +    double relative_difficulty = _player.get_adjusted_skill_level(skill) - difficulty;
>> +    int stat = _player.int_cur; // Only intelligence for now
>> +    double stat_bonus = (stat - 8) * stat_factor;
>> +
>> +    double base_rate = base_success;
>> +    double exponent = pow(2, relative_difficulty - difficulty_modifier + stat_bonus);
>> +
>> +    return 1.0 - pow(1.0 - base_rate, exponent);
>> +}
>> +
>> +std::string skill_requirement::to_string() const
>> +{
>> +    return string_format("level %d %s", difficulty, skill->name().c_str());
>
>I think this is shown to the player, if so it needs translation.
>
>---
>Reply to this email directly or view it on GitHub:
>https://github.com/CleverRaven/Cataclysm-DDA/pull/10567/files#r22144889