Player12
An open source football management simulator
Loading...
Searching...
No Matches
TrainingModel Namespace Reference

Pure training rules (no game state), unit tested in isolation. More...

Functions

Microcycle presetMicrocycle (TrainingPreset preset)
 
float sessionLoad (TrainingSlot slot, TrainingIntensity squad_intensity)
 
float balancedWeekLoad ()
 
float typicalDailyLoad ()
 
float sessionInjuryExposure (TrainingSlot slot, TrainingIntensity squad_intensity)
 
std::optional< MicrocycleDay > dayFor (int days_since_last, int days_to_next, std::int32_t ordinal)
 
bool isCongested (int days_since_last, int days_to_next)
 
TrainingDay scheduleDay (const TeamTrainingPlan &plan, int days_since_last, int days_to_next, std::int32_t ordinal)
 
float conditionDrain (float load, float stamina)
 
float recoveryShare (SessionType session)
 
float sharpnessGain (TrainingSlot slot)
 
float workloadRatio (const PlayerTrainingState &state)
 
float workloadRiskMultiplier (const PlayerTrainingState &state)
 
WorkloadRisk workloadRisk (const PlayerTrainingState &state, float condition)
 
void rollDay (PlayerTrainingState &state)
 
float developmentMultiplier (const TeamTrainingPlan &plan, int age, float coaching_quality)
 
std::array< float, 9 > scheduleAttributeMix (const TeamTrainingPlan &plan)
 
std::array< float, 9 > focusAttributeMix (TrainingFocus focus, const StatsConfig &config)
 
const std::array< const char *, 9 > & attributeNames ()
 
float applyDirectedGrowth (Player &player, float growth, const TeamTrainingPlan &plan, TrainingFocus focus, const StatsConfig &config)
 
TacticSnapshot snapshotOf (const Team &team)
 
float familiarityLoss (const TacticSnapshot &before, const TacticSnapshot &after)
 
float familiarityGain (TrainingSlot slot)
 
std::vector< TrainingAdvice > advise (const AdviceInputs &inputs)
 
const char * sessionKey (SessionType session)
 
const char * intensityKey (TrainingIntensity intensity)
 
const char * presetKey (TrainingPreset preset)
 
const char * focusKey (TrainingFocus focus)
 
const char * dayKey (MicrocycleDay day)
 
const char * riskKey (WorkloadRisk risk)
 

Variables

constexpr float MATCH_LOAD = 1.8f
 

Detailed Description

Pure training rules (no game state), unit tested in isolation.

Function Documentation

◆ advise()

std::vector< TrainingAdvice > TrainingModel::advise ( const AdviceInputs &  inputs)

Assistant recommendations, most important first (never empty).

◆ applyDirectedGrowth()

float TrainingModel::applyDirectedGrowth ( Player &  player,
float  growth,
const TeamTrainingPlan &  plan,
TrainingFocus  focus,
const StatsConfig &  config 
)

Applies the directed part of a week's growth: 30% follows the schedule mix over the role's attributes (overall-preserving), 35% follows the individual focus (any attribute, capped at potential + 5). Physical attributes only grow up to 25.

Returns
The growth left for the regular role-weighted development.

◆ attributeNames()

const std::array< const char *, 9 > & TrainingModel::attributeNames ( )

Attribute names in the order used by the mixes.

◆ balancedWeekLoad()

float TrainingModel::balancedWeekLoad ( )

Load of a Balanced week at normal intensity (six training days).

◆ conditionDrain()

float TrainingModel::conditionDrain ( float  load,
float  stamina 
)

Condition lost in a session with load for a player with stamina.

◆ dayFor()

std::optional< MicrocycleDay > TrainingModel::dayFor ( int  days_since_last,
int  days_to_next,
std::int32_t  ordinal 
)

Maps a calendar day onto the microcycle.

Parameters
days_since_lastDays since the previous match (<= 0: unknown).
days_to_nextDays to the next match (0: today, < 0: unknown).
ordinalDay ordinal, used to cycle through the template when no fixture is near.
Returns
std::nullopt on match days.

◆ dayKey()

const char * TrainingModel::dayKey ( MicrocycleDay  day)

◆ developmentMultiplier()

float TrainingModel::developmentMultiplier ( const TeamTrainingPlan &  plan,
int  age,
float  coaching_quality 
)

Development-rate multiplier from the week's training volume, the preset and the coaching quality (0-1), before facilities.

◆ familiarityGain()

float TrainingModel::familiarityGain ( TrainingSlot  slot)

Share of the familiarity gap closed by one session.

◆ familiarityLoss()

float TrainingModel::familiarityLoss ( const TacticSnapshot &  before,
const TacticSnapshot &  after 
)

Share of familiarity lost when the drilled tactic changes from before to after (0 for identical tactics, at most 0.6).

◆ focusAttributeMix()

std::array< float, 9 > TrainingModel::focusAttributeMix ( TrainingFocus  focus,
const StatsConfig &  config 
)

Attributes trained by an individual focus (same order). Role retraining uses the target role category's weights from config.

◆ focusKey()

const char * TrainingModel::focusKey ( TrainingFocus  focus)

◆ intensityKey()

const char * TrainingModel::intensityKey ( TrainingIntensity  intensity)

◆ isCongested()

bool TrainingModel::isCongested ( int  days_since_last,
int  days_to_next 
)

True when the previous and next match are at most four days apart.

◆ presetKey()

const char * TrainingModel::presetKey ( TrainingPreset  preset)

◆ presetMicrocycle()

Microcycle TrainingModel::presetMicrocycle ( TrainingPreset  preset)

Template of a preset (Custom returns Balanced).

◆ recoveryShare()

float TrainingModel::recoveryShare ( SessionType  session)

Extra share of the condition deficit recovered by a session type.

◆ riskKey()

const char * TrainingModel::riskKey ( WorkloadRisk  risk)

◆ rollDay()

void TrainingModel::rollDay ( PlayerTrainingState &  state)

Closes a day: folds the pending load into the acute and chronic loads.

◆ scheduleAttributeMix()

std::array< float, 9 > TrainingModel::scheduleAttributeMix ( const TeamTrainingPlan &  plan)

Relative attention of the plan's template to each attribute (Pace, Shooting, Passing, Dribbling, Defending, Physicality, Stamina, Vision, Goalkeeping), used to steer development.

◆ scheduleDay()

TrainingDay TrainingModel::scheduleDay ( const TeamTrainingPlan &  plan,
int  days_since_last,
int  days_to_next,
std::int32_t  ordinal 
)

The day's session after the congestion rule.

◆ sessionInjuryExposure()

float TrainingModel::sessionInjuryExposure ( TrainingSlot  slot,
TrainingIntensity  squad_intensity 
)

Training-injury exposure of a session relative to an average training day (the Balanced template averages 1.0 over its six days, so its weekly exposure equals the calibrated 6 x 1.2 training hours).

◆ sessionKey()

const char * TrainingModel::sessionKey ( SessionType  session)

Language keys.

◆ sessionLoad()

float TrainingModel::sessionLoad ( TrainingSlot  slot,
TrainingIntensity  squad_intensity 
)

Training load of a session at the squad-wide intensity.

◆ sharpnessGain()

float TrainingModel::sharpnessGain ( TrainingSlot  slot)

Match-sharpness gain of a session (sharpness decays 0.5 per day).

◆ snapshotOf()

TacticSnapshot TrainingModel::snapshotOf ( const Team &  team)

Snapshot of a club's current strategy and outfield shape.

◆ typicalDailyLoad()

float TrainingModel::typicalDailyLoad ( )

Typical average daily load (training plus one match a week).

◆ workloadRatio()

float TrainingModel::workloadRatio ( const PlayerTrainingState &  state)

Acute:chronic workload ratio (1.0 with no history).

◆ workloadRisk()

WorkloadRisk TrainingModel::workloadRisk ( const PlayerTrainingState &  state,
float  condition 
)

Risk band shown to the user.

◆ workloadRiskMultiplier()

float TrainingModel::workloadRiskMultiplier ( const PlayerTrainingState &  state)

Injury hazard multiplier from the workload history: 1 + 0.5 * (ACWR - 1.3) above 1.3 (capped at 1.5), 0.9 with a high, stable chronic load.

Variable Documentation

◆ MATCH_LOAD

constexpr float TrainingModel::MATCH_LOAD = 1.8f
inlineconstexprprivate

Load of a full match, in session units. [P: match ~1.8x MD-3]