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

Pure decision rules of the transfer market. More...

Classes

struct  ClubResponse
 
struct  ContractDemand
 
struct  ContractOffer
 
struct  ContractResponse
 
struct  LoanContext
 
struct  LoanTerms
 
struct  OfferTerms
 A club-to-club offer: fee, instalments, add-ons and sell-on. More...
 
struct  PlayerContext
 
struct  PositionNeed
 
struct  SaleContext
 
struct  SquadFit
 
struct  SquadNeeds
 
struct  Valuation
 
struct  WindowInfo
 

Enumerations

enum class  Reason : std::uint8_t {
  KeyPlayer , FirstTeamPlayer , SellingToRival , MidSeason ,
  LateWindow , RicherBuyer , Listed , NotForSale ,
  ReleaseClauseMet , OfferTooLow , TooLittleUpfront , CounterOffer ,
  TalksBroken , OfferAccepted , LongContract , ExpiringContract ,
  OpeningBidLow , KeyPlayerNotForSale , WageTooLow , ContractTooShort ,
  ContractTooLong , ClubTooSmall , PlayingTime , PromiseNotCredible ,
  WantsReleaseClause , LoyalToClub , BiggerClub , TermsAccepted ,
  TalksEnded , AgentPushback , NotForLoan , WageShareTooLow ,
  OptionTooLow , LoanLimit , NoPlayingTimeOnLoan , WindowClosed ,
  Unavailable , OverBudget , Embargo , AgentFeeTooLow ,
  SquadFull , COUNT
}
 
enum class  ContractKind : std::uint8_t { Transfer , FreeAgent , PreContract , Renewal }
 
enum class  LoanDuration : std::uint8_t { SeasonEnd , SixMonths }
 
enum class  FitKind : std::uint8_t { None , Starter , Upgrade , Depth }
 

Functions

const char * reasonKey (Reason reason)
 
bool isValid (const OfferTerms &terms)
 
std::uint32_t upfrontAmount (const OfferTerms &terms)
 
std::vector< std::uint32_t > instalmentAmounts (const OfferTerms &terms)
 
OfferTerms aiOfferTerms (std::uint32_t fee)
 
OfferTerms aiBidFor (std::uint32_t asking_fee, int age)
 
Valuation valueForSale (const SaleContext &context)
 
double sellerValue (const OfferTerms &terms, int age)
 
ClubResponse evaluateOffer (const SaleContext &context, const OfferTerms &terms, std::uint8_t round)
 
std::uint8_t maxContractYears (int age)
 
ContractDemand contractDemand (const PlayerContext &context)
 
std::uint32_t agentAsk (const PlayerContext &context, const ContractDemand &demand, std::uint8_t round)
 
ContractResponse evaluateContract (const PlayerContext &context, const ContractOffer &offer, std::uint8_t round)
 
float appearanceRate (SquadRole role)
 
double yearlyRiseWorth (std::uint32_t wage, std::uint8_t percent, std::uint8_t years)
 
ContractOffer demandedOffer (const ContractDemand &demand)
 
ClubResponse evaluateLoan (const LoanContext &context, const LoanTerms &terms)
 
bool playerAcceptsLoan (SquadRole at_parent, SquadRole at_borrower, std::uint8_t ambition, int reputation_gap, std::vector< Reason > &reasons)
 
WindowInfo windowInfo (LeagueID league, const GameDateValue &date)
 
float activityWeight (const WindowInfo &window)
 
bool canSignPreContract (std::uint8_t contract_years, const GameDateValue &date)
 
GameDateValue seasonEndDate (const GameDateValue &date)
 
GameDateValue contractEndDate (const GameDateValue &date, std::uint8_t contract_years)
 
GameDateValue loanEndDate (const GameDateValue &start, LoanDuration duration)
 
int weeksBetween (const GameDateValue &from, const GameDateValue &to)
 
std::int64_t severancePay (std::uint32_t weekly_wage, std::uint8_t contract_years, const GameDateValue &date)
 
SquadRole roleForRank (std::size_t rank)
 
PlayerRole positionGroup (PlayerRole role)
 
SquadNeeds squadNeeds (std::span< const std::pair< PlayerRole, float > > squad)
 
SquadFit squadFit (const SquadNeeds &needs, PlayerRole role, float overall)
 

Detailed Description

Pure decision rules of the transfer market.

Club valuations, the seller's reading of a structured offer, the player's contract demands and answers, loan terms and window timing. Nothing here touches the game state, so every rule is unit-testable and deterministic.

Enumeration Type Documentation

◆ ContractKind

enum class TransferNegotiation::ContractKind : std::uint8_t
strong
Enumerator
Transfer 
FreeAgent 
PreContract 
Renewal 

◆ FitKind

enum class TransferNegotiation::FitKind : std::uint8_t
strong
Enumerator
None 

Would not improve the squad.

Starter 

Fills a missing starting place.

Upgrade 

Better than the weakest starter.

Depth 

Needed cover.

◆ LoanDuration

enum class TransferNegotiation::LoanDuration : std::uint8_t
strong
Enumerator
SeasonEnd 
SixMonths 

◆ Reason

enum class TransferNegotiation::Reason : std::uint8_t
strong

Why a club or player answered the way they did (language keys).

Enumerator
KeyPlayer 
FirstTeamPlayer 
SellingToRival 
MidSeason 
LateWindow 
RicherBuyer 
Listed 
NotForSale 
ReleaseClauseMet 
OfferTooLow 
TooLittleUpfront 
CounterOffer 
TalksBroken 
OfferAccepted 
LongContract 
ExpiringContract 
OpeningBidLow 
KeyPlayerNotForSale 
WageTooLow 
ContractTooShort 
ContractTooLong 
ClubTooSmall 
PlayingTime 
PromiseNotCredible 
WantsReleaseClause 
LoyalToClub 
BiggerClub 
TermsAccepted 
TalksEnded 
AgentPushback 
NotForLoan 
WageShareTooLow 
OptionTooLow 
LoanLimit 
NoPlayingTimeOnLoan 
WindowClosed 
Unavailable 
OverBudget 
Embargo 
AgentFeeTooLow 
SquadFull 
COUNT 

Function Documentation

◆ activityWeight()

float TransferNegotiation::activityWeight ( const WindowInfo &  window)

Relative AI activity: rises in the last week, spikes on deadline day.

◆ agentAsk()

std::uint32_t TransferNegotiation::agentAsk ( const PlayerContext &  context,
const ContractDemand &  demand,
std::uint8_t  round 
)

Wage the agent asks for after round rejected proposals: above the real demand by a margin that grows with ambition and with the step down in club stature, falling to the demand itself by the last round.

◆ aiBidFor()

OfferTerms TransferNegotiation::aiBidFor ( std::uint32_t  asking_fee,
int  age 
)

An AI club's bid for a player the seller values at asking_fee: the AI structure (instalments above AI_INSTALMENT_THRESHOLD) with the headline fee raised until the seller's valuation of the deferred money reaches the asking fee, so large deals between computer-managed clubs can complete.

◆ aiOfferTerms()

OfferTerms TransferNegotiation::aiOfferTerms ( std::uint32_t  fee)

Structure used by AI clubs: big fees are spread over instalments.

◆ appearanceRate()

float TransferNegotiation::appearanceRate ( SquadRole  role)

Competitive appearances per week of a player in role.

◆ canSignPreContract()

bool TransferNegotiation::canSignPreContract ( std::uint8_t  contract_years,
const GameDateValue &  date 
)

Players in the final six months (from 1 January) may pre-sign.

◆ contractDemand()

ContractDemand TransferNegotiation::contractDemand ( const PlayerContext &  context)

Demands for talks that have not started (asking_wage = opening ask).

◆ contractEndDate()

GameDateValue TransferNegotiation::contractEndDate ( const GameDateValue &  date,
std::uint8_t  contract_years 
)

Last day of a contract with contract_years seasons left on date (years are counted down on 1 July).

◆ demandedOffer()

ContractOffer TransferNegotiation::demandedOffer ( const ContractDemand &  demand)

Contract that exactly meets the demands (used by AI clubs).

◆ evaluateContract()

ContractResponse TransferNegotiation::evaluateContract ( const PlayerContext &  context,
const ContractOffer &  offer,
std::uint8_t  round 
)

round counts proposals already rejected in these talks.

◆ evaluateLoan()

ClubResponse TransferNegotiation::evaluateLoan ( const LoanContext &  context,
const LoanTerms &  terms 
)

◆ evaluateOffer()

ClubResponse TransferNegotiation::evaluateOffer ( const SaleContext &  context,
const OfferTerms &  terms,
std::uint8_t  round 
)

Evaluates a transfer offer. round counts offers already made in these talks (0 = first offer).

◆ instalmentAmounts()

std::vector< std::uint32_t > TransferNegotiation::instalmentAmounts ( const OfferTerms &  terms)

Yearly instalments (sum = fee - upfront).

◆ isValid()

bool TransferNegotiation::isValid ( const OfferTerms &  terms)

True when the structure is internally consistent.

◆ loanEndDate()

GameDateValue TransferNegotiation::loanEndDate ( const GameDateValue &  start,
LoanDuration  duration 
)

Last day of a loan starting on start (clipped to 30 June).

◆ maxContractYears()

std::uint8_t TransferNegotiation::maxContractYears ( int  age)

Longest contract allowed at age (RSTP).

◆ playerAcceptsLoan()

bool TransferNegotiation::playerAcceptsLoan ( SquadRole  at_parent,
SquadRole  at_borrower,
std::uint8_t  ambition,
int  reputation_gap,
std::vector< Reason > &  reasons 
)

True when the player agrees to the loan; otherwise reasons says why.

◆ positionGroup()

PlayerRole TransferNegotiation::positionGroup ( PlayerRole  role)

Position group for squad planning: central midfielders (CDM, CM, CAM) and wide players (LM, RM, LW, RW) are interchangeable.

◆ reasonKey()

const char * TransferNegotiation::reasonKey ( Reason  reason)

Language key describing reason (e.g. "NEG_REASON_KEY_PLAYER").

◆ roleForRank()

SquadRole TransferNegotiation::roleForRank ( std::size_t  rank)

Playing-time role for a 0-based ability rank (as the world sim).

◆ seasonEndDate()

GameDateValue TransferNegotiation::seasonEndDate ( const GameDateValue &  date)

30 June closing the season that contains date.

◆ sellerValue()

double TransferNegotiation::sellerValue ( const OfferTerms &  terms,
int  age 
)

Seller's present value of an offer (deferred money discounted, add-ons and sell-on credited with caps).

◆ severancePay()

std::int64_t TransferNegotiation::severancePay ( std::uint32_t  weekly_wage,
std::uint8_t  contract_years,
const GameDateValue &  date 
)

Remaining contract wages owed to a released player.

◆ squadFit()

SquadFit TransferNegotiation::squadFit ( const SquadNeeds &  needs,
PlayerRole  role,
float  overall 
)

◆ squadNeeds()

SquadNeeds TransferNegotiation::squadNeeds ( std::span< const std::pair< PlayerRole, float > >  squad)

Needs of a squad given each player's role and overall.

◆ upfrontAmount()

std::uint32_t TransferNegotiation::upfrontAmount ( const OfferTerms &  terms)

Amount paid on signing.

◆ valueForSale()

Valuation TransferNegotiation::valueForSale ( const SaleContext &  context)

◆ weeksBetween()

int TransferNegotiation::weeksBetween ( const GameDateValue &  from,
const GameDateValue &  to 
)

Whole weeks from from to to (0 if not after).

◆ windowInfo()

WindowInfo TransferNegotiation::windowInfo ( LeagueID  league,
const GameDateValue &  date 
)

Window of clubs of league on date (TransferWindows).

◆ yearlyRiseWorth()

double TransferNegotiation::yearlyRiseWorth ( std::uint32_t  wage,
std::uint8_t  percent,
std::uint8_t  years 
)

Weekly worth of a yearly rise of percent over years on wage (the average uplift over the contract).