Player12
An open source football management simulator
Loading...
Searching...
No Matches
stories.h File Reference
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <unordered_map>
#include <utility>
#include <vector>
#include "global/types.h"
#include "model/finances.h"
#include "model/gamedate.h"

Go to the source code of this file.

Classes

struct  CareerTotals
 
struct  StoryChoice
 
struct  StoryRecord
 
struct  DilemmaEffects
 Bounded effects of one answer to a decision moment. More...
 
struct  Dilemma
 A decision moment of the managed club (table StoryDilemmas). More...
 
struct  FollowedPlayer
 A followed player and what was last reported about him. More...
 
struct  StoryDayContext
 What the day loop knows beyond the squad. More...
 
struct  StoryState
 Persisted state of the story engine. More...
 
class  StoryEngine
 Detects story triggers for the managed club and posts them. More...
 

Namespaces

namespace  Stories
 

Enumerations

enum class  StoryKind : std::uint8_t {
  Debut = 0 , Breakout , CaptainDispute , PoorRun ,
  TransferSaga , Comeback , Milestone , Rivalry ,
  CompassionateLeave , HomesickYouth , FineDispute , RivalComments ,
  SponsorAppearance , TrainingClash , CoachingCourse , TicketProtest
}
 Story chains that grow out of what actually happens in the save. More...
 

Functions

std::optional< std::uint32_t > Stories::appearanceMilestone (std::uint32_t before, std::uint32_t after)
 
std::optional< std::uint32_t > Stories::goalMilestone (std::uint32_t before, std::uint32_t after)
 
bool Stories::isPoorRun (std::string_view recent_form)
 
const char * Stories::kindKey (StoryKind kind)
 
bool Stories::isDilemma (StoryKind kind)
 
const char * Stories::dilemmaTitleKey (StoryKind kind)
 
const char * Stories::dilemmaBodyKey (StoryKind kind)
 
const char * Stories::dilemmaOptionKey (StoryKind kind, int option)
 
const char * Stories::dilemmaDoneKey (StoryKind kind, int option)
 
std::optional< StoryKind > Stories::dilemmaForTitle (std::string_view title_key)
 
DilemmaEffects Stories::dilemmaEffects (StoryKind kind, int option, const ClubProfile &profile)
 

Variables

constexpr int Stories::WEEKLY_CAP = 2
 
constexpr std::int32_t Stories::LONG_INJURY_DAYS = 60
 
constexpr float Stories::BREAKOUT_RATING = 7.3f
 
constexpr int Stories::BREAKOUT_MAX_AGE = 21
 
constexpr int Stories::DEBUT_MAX_AGE = 19
 
constexpr int Stories::POOR_RUN_MATCHES = 5
 
constexpr std::int32_t Stories::SAGA_WINDOW_DAYS = 30
 
constexpr std::int32_t Stories::CHOICE_DAYS = 21
 
constexpr std::int32_t Stories::DILEMMA_GAP_DAYS = 14
 
constexpr std::int32_t Stories::DILEMMA_KIND_COOLDOWN_DAYS = 180
 
constexpr std::int32_t Stories::DILEMMA_ANSWER_DAYS = 7
 
constexpr double Stories::DILEMMA_DAILY_CHANCE = 0.06
 
constexpr float Stories::DILEMMA_MAX_MORALE = 6.0f
 
constexpr float Stories::DILEMMA_MAX_TRUST = 6.0f
 
constexpr float Stories::DILEMMA_MAX_SQUAD_MORALE = 2.0f
 
constexpr float Stories::DILEMMA_MAX_SHARPNESS = 10.0f
 
constexpr std::int64_t Stories::DILEMMA_MAX_MONEY = 250'000
 
constexpr StoryKind Stories::FIRST_DILEMMA = StoryKind::CompassionateLeave
 
constexpr StoryKind Stories::LAST_DILEMMA = StoryKind::TicketProtest
 
constexpr std::size_t Stories::MAX_FOLLOWS = 25
 
constexpr float Stories::BIG_MATCH_RATING = 8.5f
 
constexpr int Stories::BIG_MATCH_GOALS = 2
 
constexpr std::int32_t Stories::BIG_MATCH_GAP_DAYS = 7
 

Enumeration Type Documentation

◆ StoryKind

enum class StoryKind : std::uint8_t
strong

Story chains that grow out of what actually happens in the save.

Each story is triggered by a real event of the managed club (a debut, a string of high ratings, a long injury ending, repeated bids for a key player...) and produces at most one inbox message per instance. Stories that call for a decision carry a StoryChoice: the inbox offers to talk to the player with the conversation options that answer it. A weekly cap keeps busy periods from flooding the inbox.

The kinds after Rivalry are decision moments: short two-option dilemmas (see Dilemma) answered from the inbox. Values are persisted: append only.

Enumerator
Debut 
Breakout 
CaptainDispute 
PoorRun 
TransferSaga 
Comeback 
Milestone 
Rivalry 
CompassionateLeave 

A player asks to be with his family.

HomesickYouth 

A young player misses home.

FineDispute 

The captain disputes a club fine.

RivalComments 

The press asks about the rival's remarks.

SponsorAppearance 

A sponsor wants the squad before a match.

TrainingClash 

Two players clash in training.

CoachingCourse 

A veteran wants to start his coaching badges.

TicketProtest 

Supporters protest about ticket prices.