Player12
An open source football management simulator
Loading...
Searching...
No Matches
loan_negotiation.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Football Management Project
3// Copyright (c) 2025 - 2026 Flavio Milinanni. All Rights Reserved.
4//
5// This file is part of the Football Management Project.
6// See the LICENSE file in the project root.
7// -----------------------------------------------------------------------------
8
9#pragma once
10
11#include <cstdint>
12#include <vector>
13
16
34namespace LoanNegotiation
35{
40
42enum class Why : std::uint8_t
43{
46 WageRoom,
56 COUNT
57};
58
60const char* whyKey(Why why);
61
63bool isValid(const LoanTerms& terms);
64
67{
68 std::uint32_t ceiling = 0;
69 std::int64_t cash = 0;
70 std::int64_t wage_room = 0;
71 std::uint32_t weekly_wage = 0;
72 std::uint32_t market_value = 0;
73 int season_weeks = 40;
74 float apps_per_week = 0.6f;
75 std::uint8_t patience = 3;
76 std::uint8_t answered = 0;
77 std::uint8_t insults = 0;
79};
80
82int loanWeeks(const BorrowerContext& context, LoanDuration duration);
84double expectedAppearances(const BorrowerContext& context,
85 LoanDuration duration);
87double unplayedOdds(double expected, std::uint8_t minimum);
89std::uint8_t maxWageShare(const BorrowerContext& context);
91double borrowerCost(const BorrowerContext& context, const LoanTerms& terms);
93double effectiveCeiling(const BorrowerContext& context);
95bool affordable(const BorrowerContext& context, const LoanTerms& terms);
96
99{
100 Decision decision = Decision::WalkAway;
101 Move move = Move::WalkedAway;
103 bool insulted = false;
104 std::vector<Why> reasons;
105};
106
111BorrowerReply respond(const BorrowerContext& context, const LoanTerms& current,
112 const LoanTerms& asked, double roll);
113
119LoanTerms openingOffer(const BorrowerContext& context, LoanDuration duration,
120 std::uint8_t share, int age, double option_roll);
121
123std::uint32_t ceilingFor(const BorrowerContext& context,
124 const LoanTerms& opening, double roll);
125
126} // namespace LoanNegotiation
Decision
Definition buyer_negotiation.h:113
Move
Definition buyer_negotiation.h:36
How an AI club negotiates to borrow one of the managed club's players.
Definition loan_negotiation.cpp:21
Why
Definition loan_negotiation.h:43
bool isValid(const LoanTerms &terms)
Definition loan_negotiation.cpp:85
bool affordable(const BorrowerContext &context, const LoanTerms &terms)
Definition loan_negotiation.cpp:148
double unplayedOdds(double expected, std::uint8_t minimum)
Definition loan_negotiation.cpp:107
std::uint8_t maxWageShare(const BorrowerContext &context)
Definition loan_negotiation.cpp:116
LoanTerms openingOffer(const BorrowerContext &context, LoanDuration duration, std::uint8_t share, int age, double option_roll)
Definition loan_negotiation.cpp:353
double expectedAppearances(const BorrowerContext &context, LoanDuration duration)
Definition loan_negotiation.cpp:100
double effectiveCeiling(const BorrowerContext &context)
Definition loan_negotiation.cpp:139
int loanWeeks(const BorrowerContext &context, LoanDuration duration)
Definition loan_negotiation.cpp:93
BorrowerReply respond(const BorrowerContext &context, const LoanTerms &current, const LoanTerms &asked, double roll)
Definition loan_negotiation.cpp:160
double borrowerCost(const BorrowerContext &context, const LoanTerms &terms)
Definition loan_negotiation.cpp:125
std::uint32_t ceilingFor(const BorrowerContext &context, const LoanTerms &opening, double roll)
Definition loan_negotiation.cpp:372
const char * whyKey(Why why)
Definition loan_negotiation.cpp:79
LoanDuration
Definition transfer_negotiation.h:292
std::int64_t minimum
Definition runtime_editor_validation.cpp:46
Definition loan_negotiation.h:67
int season_weeks
Definition loan_negotiation.h:73
std::uint8_t answered
Definition loan_negotiation.h:76
float apps_per_week
Definition loan_negotiation.h:74
std::uint8_t patience
Definition loan_negotiation.h:75
std::uint32_t market_value
Definition loan_negotiation.h:72
std::uint8_t insults
Definition loan_negotiation.h:77
std::uint32_t weekly_wage
Definition loan_negotiation.h:71
std::int64_t wage_room
Definition loan_negotiation.h:70
std::int64_t cash
Definition loan_negotiation.h:69
std::uint32_t ceiling
Definition loan_negotiation.h:68
int days_to_deadline
Definition loan_negotiation.h:78
Definition loan_negotiation.h:99
LoanTerms terms
Definition loan_negotiation.h:102
Decision decision
Definition loan_negotiation.h:100
bool insulted
Definition loan_negotiation.h:103
std::vector< Why > reasons
Definition loan_negotiation.h:104
Move move
Definition loan_negotiation.h:101
Definition transfer_negotiation.h:299