|
Player12
An open source football management simulator
|
Relations, promises, requests and team talks of the managed club. More...
#include <interactions.h>
Classes | |
| struct | TeamTalkRecord |
Public Member Functions | |
| InteractionSystem (std::shared_ptr< GameData > gamedata, std::function< SquadRole(PlayerID)> role_of) | |
| void | onDayAdvanced (const GameDateValue &date, TeamID managed_team_id, Inbox &inbox) |
| void | onWeek (const GameDateValue &date, TeamID managed_team_id, Inbox &inbox) |
| void | onMatchPlayed (const MatchReport &report, TeamID managed_team_id) |
| void | onTransferCompleted (const GameDateValue &date, PlayerID player_id, TeamID from_team_id, TeamID to_team_id, TeamID managed_team_id, Inbox &inbox) |
| float | onBidRejected (const GameDateValue &date, PlayerID player_id, const std::string &buyer_name, float morale_delta, float trust_delta, bool transfer_request, Inbox &inbox) |
| float | adjustTrust (PlayerID player_id, float delta) |
| float | moraleTargetOffset (PlayerID player_id) const |
| std::vector< TalkOptionView > | options (PlayerID player_id, const GameDateValue &date, TeamID managed_team_id, float manager_standing) const |
| std::optional< TalkOutcome > | talk (PlayerID player_id, TalkOption option, const GameDateValue &date, TeamID managed_team_id, float manager_standing) |
| TeamTalkContext | teamTalkContext (TeamID team_id, TeamTalkMoment moment, const GameDateValue &date) const |
| bool | canGiveTeamTalk (TeamID team_id, TeamTalkMoment moment, const GameDateValue &date) const |
| std::optional< TeamTalkResult > | giveTeamTalk (const TeamTalkContext &context, TeamID team_id, TeamTalkTone tone) |
| float | teamTalkModifier (TeamID team_id, const GameDateValue &date, int half) const |
| DressingRoom | dressingRoom (TeamID team_id, const GameDateValue &date) const |
| float | cohesionModifier (TeamID team_id, const GameDateValue &date) const |
| const PlayerRelation * | relation (PlayerID player_id) const |
| std::vector< Promise > | promisesFor (PlayerID player_id) const |
| const std::vector< Promise > & | promises () const |
| std::vector< PlayerID > | pendingRequests () const |
| const InteractionState & | getState () const |
| void | restore (InteractionState restored) |
| void | load (const std::shared_ptr< DatabaseConnection > &db_conn) |
| void | save (const std::shared_ptr< DatabaseConnection > &db_conn) const |
Static Public Member Functions | |
| static std::optional< GameDateValue > | signingDeadline (const GameDateValue &date, LeagueID league) |
Private Member Functions | |
| TalkContext | contextFor (const Player &player, const GameDateValue &date, float manager_standing) const |
| TalkBlock | blockFor (const Player &player, TalkOption option, const TalkContext &context, const GameDateValue &date, TeamID managed_team_id, std::int32_t &cooldown) const |
| TalkBlock | optionBlockFor (const Player &player, TalkOption option, const TalkContext &context, const GameDateValue &date, TeamID managed_team_id) const |
| bool | hasActivePromise (PlayerID player_id, PromiseType type) const |
| void | evaluatePromises (const GameDateValue &date, TeamID managed_team_id, Inbox &inbox) |
| void | evaluatePromise (Promise &promise, const Player &player, bool due, const GameDateValue &date, std::int32_t today, Inbox &inbox) |
| void | evaluatePlayingTimePromise (Promise &promise, const Player &player, bool due, const GameDateValue &date, std::int32_t today, Inbox &inbox) |
| void | evaluateContractPromise (Promise &promise, const Player &player, bool due, const GameDateValue &date, Inbox &inbox) |
| void | evaluateSigningPromise (Promise &promise, bool due, const GameDateValue &date, Inbox &inbox) |
| void | resolvePromise (Promise &promise, PromiseState outcome, PromiseVoidReason reason, const GameDateValue &date, Inbox &inbox) |
| void | raiseRequests (const GameDateValue &date, TeamID managed_team_id, Inbox &inbox) |
| bool | resolveIgnoredRequest (Player &player, PlayerDynamics &dynamics, PlayerRelation &relation, const GameDateValue &date, std::int32_t today, Inbox &inbox) |
| TalkRequest | requestForPlayer (const Player &player, const PlayerDynamics &dynamics, const PlayerRelation &relation, const GameDateValue &date, std::int32_t today) const |
| void | spreadLeaderMood (TeamID managed_team_id, const GameDateValue &date) |
| PlayerRelation & | relationFor (PlayerID player_id) |
| float | firstTeamThreshold (TeamID team_id) const |
Private Attributes | |
| std::shared_ptr< GameData > | gamedata |
| std::function< SquadRole(PlayerID)> | role_of |
| InteractionState | state |
| std::unordered_map< TeamID, TeamTalkRecord > | team_talks |
Relations, promises, requests and team talks of the managed club.
Owned by WorldSimulation; all randomness is keyed by the world seed, the day and the player so that a reloaded save continues identically.
| InteractionSystem::InteractionSystem | ( | std::shared_ptr< GameData > | gamedata, |
| std::function< SquadRole(PlayerID)> | role_of | ||
| ) |
role_of gives a player's playing-time expectation in his squad.
| float InteractionSystem::adjustTrust | ( | PlayerID | player_id, |
| float | delta | ||
| ) |
Moves a player's trust by delta (decision moments); returns the change applied after clamping.
|
private |
| bool InteractionSystem::canGiveTeamTalk | ( | TeamID | team_id, |
| TeamTalkMoment | moment, | ||
| const GameDateValue & | date | ||
| ) | const |
True when this moment's talk has not been given for this match.
| float InteractionSystem::cohesionModifier | ( | TeamID | team_id, |
| const GameDateValue & | date | ||
| ) | const |
Cohesion modifier of a club (0 when unknown / not managed).
|
private |
| DressingRoom InteractionSystem::dressingRoom | ( | TeamID | team_id, |
| const GameDateValue & | date | ||
| ) | const |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inline |
| std::optional< TeamTalkResult > InteractionSystem::giveTeamTalk | ( | const TeamTalkContext & | context, |
| TeamID | team_id, | ||
| TeamTalkTone | tone | ||
| ) |
Gives the talk once per moment and match; applies morale changes.
|
private |
| void InteractionSystem::load | ( | const std::shared_ptr< DatabaseConnection > & | db_conn | ) |
| float InteractionSystem::moraleTargetOffset | ( | PlayerID | player_id | ) | const |
Weekly morale target offset of a player (trust and open requests).
| float InteractionSystem::onBidRejected | ( | const GameDateValue & | date, |
| PlayerID | player_id, | ||
| const std::string & | buyer_name, | ||
| float | morale_delta, | ||
| float | trust_delta, | ||
| bool | transfer_request, | ||
| Inbox & | inbox | ||
| ) |
The club turned down a bid the player wanted to hear more about: his morale falls by morale_delta scaled by his temperament, trust by trust_delta, and with transfer_request he asks to leave. Posts his reaction to the inbox. Returns the morale change applied.
| void InteractionSystem::onDayAdvanced | ( | const GameDateValue & | date, |
| TeamID | managed_team_id, | ||
| Inbox & | inbox | ||
| ) |
Daily promise evaluation (exactly once per day) and weekly requests.
| void InteractionSystem::onMatchPlayed | ( | const MatchReport & | report, |
| TeamID | managed_team_id | ||
| ) |
Playing-time promise progress; clears the match's team talks.
| void InteractionSystem::onTransferCompleted | ( | const GameDateValue & | date, |
| PlayerID | player_id, | ||
| TeamID | from_team_id, | ||
| TeamID | to_team_id, | ||
| TeamID | managed_team_id, | ||
| Inbox & | inbox | ||
| ) |
Arrival dates, voided promises, signing promises.
| void InteractionSystem::onWeek | ( | const GameDateValue & | date, |
| TeamID | managed_team_id, | ||
| Inbox & | inbox | ||
| ) |
Weekly: trust drift, leader influence, request lifecycle.
|
private |
| std::vector< TalkOptionView > InteractionSystem::options | ( | PlayerID | player_id, |
| const GameDateValue & | date, | ||
| TeamID | managed_team_id, | ||
| float | manager_standing | ||
| ) | const |
Options for a managed player with availability and hints.
| std::vector< PlayerID > InteractionSystem::pendingRequests | ( | ) | const |
Managed players with an unanswered request.
|
inline |
Promises made to a player (all states), newest first.
|
private |
| const PlayerRelation * InteractionSystem::relation | ( | PlayerID | player_id | ) | const |
|
private |
|
private |
|
private |
|
private |
| void InteractionSystem::restore | ( | InteractionState | restored | ) |
| void InteractionSystem::save | ( | const std::shared_ptr< DatabaseConnection > & | db_conn | ) | const |
|
static |
Deadline of a signing promise made on date by a club of league (end of its next window within 120 days), nullopt if no window is that close.
|
private |
| std::optional< TalkOutcome > InteractionSystem::talk | ( | PlayerID | player_id, |
| TalkOption | option, | ||
| const GameDateValue & | date, | ||
| TeamID | managed_team_id, | ||
| float | manager_standing | ||
| ) |
Holds the conversation line and applies morale, trust, promises and request changes. Returns nullopt when the option is not available. Listing the player (list_player) is left to the caller.
| TeamTalkContext InteractionSystem::teamTalkContext | ( | TeamID | team_id, |
| TeamTalkMoment | moment, | ||
| const GameDateValue & | date | ||
| ) | const |
Listeners of the managed club's talk: its selected XI.
| float InteractionSystem::teamTalkModifier | ( | TeamID | team_id, |
| const GameDateValue & | date, | ||
| int | half | ||
| ) | const |
Execution-quality modifier of the team's talks for half (1 or 2) of its match on date: the pre-match talk counts fully in the first half and half in the second, where the half-time talk adds; the total is capped at +-TOTAL_CAP. 0 on any other day.
|
private |
|
private |
|
private |
Transient.