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

How an AI club negotiates to buy one of the managed club's players, and how the player feels about the move. More...

Classes

struct  BuyerContext
 
struct  BuyerReply
 
struct  RejectionEffect
 
struct  StanceFacts
 

Enumerations

enum class  Move : std::uint8_t {
  Bid = 0 , Improved , FinalOffer , Restated ,
  Counter , AskingPrice , Accepted , WalkedAway ,
  COUNT
}
 
enum class  Why : std::uint8_t {
  WithinBudget , Improved , MoreInstalments , AddOnsInsteadOfCash ,
  AddOnsTrimmed , SellOnCut , CashLimited , FinalOffer ,
  Unrealistic , Insulted , OutOfPatience , RivalBids ,
  DeadlineDay , WageBudget , COUNT
}
 
enum class  Decision : std::uint8_t { Accept , Counter , WalkAway }
 
enum class  PlayerStance : std::uint8_t {
  AskedToLeave , WantsBiggerClub , Open , HappyHere ,
  Reluctant
}
 

Functions

bool byBuyer (Move move)
 
const char * moveKey (Move move)
 
const char * whyKey (Why why)
 
double appearanceOdds (std::uint16_t target)
 
double goalOdds (std::uint16_t target)
 
double sellOnCostPerPercent (int age)
 
double buyerCost (const OfferTerms &terms, int age)
 
std::uint32_t agentFee (std::uint32_t fee)
 
std::int64_t signingCash (const OfferTerms &terms)
 
bool deadlinePressure (int days_to_deadline)
 
double effectiveCeiling (const BuyerContext &context)
 
BuyerReply respond (const BuyerContext &context, const OfferTerms &current, const OfferTerms &asked, bool firm, double roll)
 
OfferTerms openingBid (std::uint32_t ceiling, int age, std::uint8_t rivals, double share_roll, double add_on_roll)
 
std::uint8_t drawPatience (double roll, int days_to_deadline)
 
int replyDelay (double roll, int days_to_deadline)
 
const char * stanceKey (PlayerStance stance)
 
PlayerStance stanceFor (const StanceFacts &facts)
 
double termsRefusalChance (PlayerStance stance)
 
bool isBigBid (const OfferTerms &terms, int, std::uint32_t market_value)
 
RejectionEffect rejectionEffect (PlayerStance stance, bool big_bid, std::uint8_t ambition)
 

Detailed Description

How an AI club negotiates to buy one of the managed club's players, and how the player feels about the move.

The buyer has a hidden ceiling on what the deal may cost it, measured by buyerCost(): cash now counts in full, instalments are discounted, add-ons cost their odds of being paid and a sell-on clause the expected share of a future sale. It answers the club's counters with its own structures (a higher fee spread over more years, add-ons instead of cash, a smaller sell-on), loses patience after a few rounds, walks away from demands far beyond its ceiling, pays more against rival bidders and near the deadline. Pure rules: every draw is passed in, so the answers are deterministic.

Enumeration Type Documentation

◆ Decision

enum class BuyerNegotiation::Decision : std::uint8_t
strong
Enumerator
Accept 
Counter 
WalkAway 

◆ Move

enum class BuyerNegotiation::Move : std::uint8_t
strong

One step of the talks over an incoming offer (values are persisted).

Enumerator
Bid 

The buyer's opening bid.

Improved 

The buyer's counter-proposal.

FinalOffer 

The buyer's last word.

Restated 

The buyer stands by its offer after an unrealistic ask.

Counter 

The managed club's structured counter.

AskingPrice 

The managed club named its price.

Accepted 

The buyer accepted the managed club's terms.

WalkedAway 

The buyer ended the talks.

COUNT 

◆ PlayerStance

enum class BuyerNegotiation::PlayerStance : std::uint8_t
strong

How the player feels about the move (shown in the talks).

Enumerator
AskedToLeave 

He has handed in a transfer request.

WantsBiggerClub 

Ambitious, and the buyer is clearly bigger.

Open 

Would go, would stay.

HappyHere 

Loyal or settled; no pull towards the buyer.

Reluctant 

Unlikely to agree terms with the buyer.

◆ Why

enum class BuyerNegotiation::Why : std::uint8_t
strong

Why the buyer answered the way it did.

Enumerator
WithinBudget 
Improved 
MoreInstalments 
AddOnsInsteadOfCash 
AddOnsTrimmed 
SellOnCut 
CashLimited 
FinalOffer 
Unrealistic 
Insulted 
OutOfPatience 
RivalBids 
DeadlineDay 
WageBudget 

His wage no longer fits its wage budget.

COUNT 

Function Documentation

◆ agentFee()

std::uint32_t BuyerNegotiation::agentFee ( std::uint32_t  fee)

Agent fee the buyer pays on top of fee.

◆ appearanceOdds()

double BuyerNegotiation::appearanceOdds ( std::uint16_t  target)

Odds that an appearance add-on with target matches is paid.

◆ buyerCost()

double BuyerNegotiation::buyerCost ( const OfferTerms &  terms,
int  age 
)

What terms cost the buyer in present value (agent fee excluded).

◆ byBuyer()

bool BuyerNegotiation::byBuyer ( Move  move)

True for the moves made by the buying club.

◆ deadlinePressure()

bool BuyerNegotiation::deadlinePressure ( int  days_to_deadline)

True in the last days of an open window.

◆ drawPatience()

std::uint8_t BuyerNegotiation::drawPatience ( double  roll,
int  days_to_deadline 
)

Counters the buyer will answer (fewer near the deadline).

◆ effectiveCeiling()

double BuyerNegotiation::effectiveCeiling ( const BuyerContext &  context)

The ceiling lifted by rival bids and deadline pressure.

◆ goalOdds()

double BuyerNegotiation::goalOdds ( std::uint16_t  target)

Odds that a goal add-on with target goals is paid.

◆ isBigBid()

bool BuyerNegotiation::isBigBid ( const OfferTerms &  terms,
int  age,
std::uint32_t  market_value 
)

A bid worth at least BIG_BID_VALUE_SHARE of the market value.

◆ moveKey()

const char * BuyerNegotiation::moveKey ( Move  move)

Language key naming move (e.g. "OFFER_MOVE_BID").

◆ openingBid()

OfferTerms BuyerNegotiation::openingBid ( std::uint32_t  ceiling,
int  age,
std::uint8_t  rivals,
double  share_roll,
double  add_on_roll 
)

Opening bid of a club with ceiling: a share of it drawn with share_roll (higher with rivals), the usual AI structure and, drawn with add_on_roll, an appearance add-on.

◆ rejectionEffect()

RejectionEffect BuyerNegotiation::rejectionEffect ( PlayerStance  stance,
bool  big_bid,
std::uint8_t  ambition 
)

◆ replyDelay()

int BuyerNegotiation::replyDelay ( double  roll,
int  days_to_deadline 
)

Days until the buyer answers a counter; 0 = the same day.

◆ respond()

BuyerReply BuyerNegotiation::respond ( const BuyerContext &  context,
const OfferTerms &  current,
const OfferTerms &  asked,
bool  firm,
double  roll 
)

Answer to the club's asked terms while current is on the table. firm marks a named price: the buyer meets it, makes its final offer or leaves. roll in [0, 1) picks how the buyer reshapes its proposal.

◆ sellOnCostPerPercent()

double BuyerNegotiation::sellOnCostPerPercent ( int  age)

Expected cost per unit of fee of a 1% sell-on for a player of age.

◆ signingCash()

std::int64_t BuyerNegotiation::signingCash ( const OfferTerms &  terms)

Cash the buyer pays on signing: the upfront part and the agent fee.

◆ stanceFor()

PlayerStance BuyerNegotiation::stanceFor ( const StanceFacts &  facts)

◆ stanceKey()

const char * BuyerNegotiation::stanceKey ( PlayerStance  stance)

Language key describing stance.

◆ termsRefusalChance()

double BuyerNegotiation::termsRefusalChance ( PlayerStance  stance)

Chance he fails to agree personal terms once the clubs agree.

◆ whyKey()

const char * BuyerNegotiation::whyKey ( Why  why)

Language key describing why (e.g. "OFFER_WHY_IMPROVED").