Player12
An open source football management simulator
Loading...
Searching...
No Matches
scout_expertise.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Football Management Project
3// Copyright (c) 2025 - 2026 Flavio Milinanni. All Rights Reserved.
4//
5// This file is part of the Football Management Project.
6// See the LICENSE file in the project root.
7// -----------------------------------------------------------------------------
8
9#pragma once
10
11#include <cstdint>
12#include <map>
13#include <span>
14#include <utility>
15#include <vector>
16
17#include "global/languages.h"
18#include "global/types.h"
19
24enum class SpokenLanguage : std::uint8_t
25{
26 English = 0,
27 Italian,
28 Spanish,
29 French,
30 German,
32 Dutch,
33 Russian,
34 Swedish,
35 Polish,
36 Greek,
37 Turkish,
38 Arabic,
40 Chinese,
41 Korean,
44 Danish,
45 Finnish,
47 Slovak,
48 Czech,
51 COUNT
52};
53
55using LanguageSet = std::uint32_t;
56
58{
59 return LanguageSet{1} << static_cast<unsigned>(std::to_underlying(language));
60}
61
62constexpr bool speaks(LanguageSet languages, SpokenLanguage language)
63{
64 return (languages & languageBit(language)) != 0;
65}
66
68const char* spokenLanguageKey(SpokenLanguage language);
69
71enum class Continent : std::uint8_t
72{
73 Europe = 0,
76 Asia,
77 COUNT
78};
79
81const char* continentKey(Continent continent);
82
85
88
96
107{
110 std::map<LeagueID, std::uint16_t> league_days;
111};
112
114enum class EffectFactorKind : std::uint8_t
115{
116 Judging,
123};
124
127{
129 float delta = 0.0f;
130 std::uint32_t subject = 0;
131};
132
141{
142 float multiplier = 1.0f;
143 std::vector<EffectFactor> factors;
144};
145
148{
150 float weight = 1.0f;
151 std::uint32_t country_days = 0;
152};
153
158namespace ScoutExpertiseModel
159{
160constexpr float MIN_MULTIPLIER = 0.6f;
161constexpr float MAX_MULTIPLIER = 1.5f;
162constexpr float JUDGING_PER_POINT = 0.004f;
163constexpr float HOME_COUNTRY = 0.20f;
164constexpr float KNOWS_LEAGUE = 0.20f;
165constexpr float KNOWS_COUNTRY = 0.10f;
166constexpr float SPEAKS_LANGUAGE = 0.10f;
167constexpr float LANGUAGE_BARRIER = -0.15f;
168constexpr float FAR_FROM_HOME = -0.10f;
169constexpr float FULL_EXPERIENCE_DAYS = 365.0f;
170constexpr std::uint16_t LANGUAGE_LEARNED_DAYS = 540;
171constexpr std::uint16_t MAX_LEAGUE_DAYS = 9'999;
172
180ScoutExpertise generate(Language nationality, std::uint64_t world_seed,
181 std::uint32_t scout_id,
182 std::span<const LeagueID> countries);
183
192 std::uint8_t judging_ability,
193 std::span<const TargetCountry> countries,
194 LeagueID league, std::uint32_t league_days);
195} // namespace ScoutExpertiseModel
Language
Enum representing supported languages in the game.
Definition languages.h:24
Generation of scout backgrounds and the effectiveness model. [P].
constexpr float LANGUAGE_BARRIER
Definition scout_expertise.h:167
constexpr float MIN_MULTIPLIER
Definition scout_expertise.h:160
constexpr float KNOWS_LEAGUE
Definition scout_expertise.h:164
ScoutExpertise generate(Language nationality, std::uint64_t world_seed, std::uint32_t scout_id, std::span< const LeagueID > countries)
Definition scout_expertise.cpp:244
constexpr std::uint16_t MAX_LEAGUE_DAYS
Definition scout_expertise.h:171
constexpr float FAR_FROM_HOME
Definition scout_expertise.h:168
constexpr float FULL_EXPERIENCE_DAYS
Definition scout_expertise.h:169
constexpr float HOME_COUNTRY
Definition scout_expertise.h:163
ScoutEffectiveness compute(const ScoutExpertise &expertise, std::uint8_t judging_ability, std::span< const TargetCountry > countries, LeagueID league, std::uint32_t league_days)
Definition scout_expertise.cpp:296
constexpr float MAX_MULTIPLIER
Definition scout_expertise.h:161
constexpr float SPEAKS_LANGUAGE
Definition scout_expertise.h:166
constexpr std::uint16_t LANGUAGE_LEARNED_DAYS
Definition scout_expertise.h:170
constexpr float JUDGING_PER_POINT
Definition scout_expertise.h:162
constexpr float KNOWS_COUNTRY
Definition scout_expertise.h:165
EffectFactorKind
Kind of a line of the effectiveness breakdown.
Definition scout_expertise.h:115
Language countryNationality(LeagueID country)
Definition scout_expertise.cpp:225
Continent homeContinent(Language nationality)
Definition scout_expertise.cpp:204
std::uint32_t LanguageSet
Definition scout_expertise.h:55
SpokenLanguage nativeLanguage(Language nationality)
Definition scout_expertise.cpp:138
constexpr LanguageSet languageBit(SpokenLanguage language)
Definition scout_expertise.h:57
constexpr bool speaks(LanguageSet languages, SpokenLanguage language)
Definition scout_expertise.h:62
Continent countryContinent(LeagueID country)
Definition scout_expertise.cpp:235
const char * spokenLanguageKey(SpokenLanguage language)
Definition scout_expertise.cpp:101
SpokenLanguage
Languages a scout can speak (bit positions are persisted).
Definition scout_expertise.h:25
SpokenLanguage countryLanguage(LeagueID country)
Definition scout_expertise.cpp:230
Continent
Continents (values are shown, not persisted).
Definition scout_expertise.h:72
const char * continentKey(Continent continent)
Definition scout_expertise.cpp:120
One line of the breakdown, e.g. "Speaks Portuguese +10%".
Definition scout_expertise.h:127
std::uint32_t subject
Definition scout_expertise.h:130
EffectFactorKind kind
Definition scout_expertise.h:128
float delta
Definition scout_expertise.h:129
How well a scout will do on an assignment.
Definition scout_expertise.h:141
std::vector< EffectFactor > factors
Definition scout_expertise.h:143
float multiplier
Definition scout_expertise.h:142
Where a scout comes from and what he knows.
Definition scout_expertise.h:107
LanguageSet languages
Definition scout_expertise.h:109
Language nationality
Definition scout_expertise.h:108
std::map< LeagueID, std::uint16_t > league_days
Definition scout_expertise.h:110
A country covered by an assignment and the scout's history there.
Definition scout_expertise.h:148
LeagueID country
Definition scout_expertise.h:149
float weight
Definition scout_expertise.h:150
std::uint32_t country_days
Definition scout_expertise.h:151
uint8_t LeagueID
Type alias for League identifiers.
Definition types.h:15