zengm
zengm copied to clipboard
Suggestion: remove hard-coded money values in logic
For example, in team.js:
// Aversion towards losing cap space in a trade during free agency
if (g.phase >= PHASE.RESIGN_PLAYERS || g.phase <= PHASE.FREE_AGENCY) {
// Only care if cap space is over 2 million
if (payroll + 2000 < g.salaryCap) {
const salaryAddedThisSeason = sumContracts(add, true) - sumContracts(remove, true);
// Only care if cap space is being used
if (salaryAddedThisSeason > 0) {
//console.log("Free agency penalty: -" + (0.2 + 0.8 * g.daysLeft / 30) * salaryAddedThisSeason);
dv -= (0.2 + 0.8 * g.daysLeft / 30) * salaryAddedThisSeason; // 0.2 to 1 times the amount, depending on stage of free agency
}
}
}
Instead you could do something like
if (payroll + g.salaryCap*0.02 < g.salaryCap) {
The idea being consistent behaviour for custom leagues with custom salary caps (for example Australia's NBL has a $1.00m salary cap).
Good point. There used to be more of these, I tried to get rid of them when I made the salary cap customizable. If you find others, let me know.
core/teams.js has a reference:
scouting: { amount: tm.hasOwnProperty("budget") ? tm.budget.scouting.amount : Math.round((g.salaryCap / 90000) * 1350 + 900 * (g.numTeams - tm.popRank) / (g.numTeams - 1)) * 10,
I'm not entirely sure how to modify this one.
this is also relevant with the achievements -- the Moneyball achievements are trivial when the league salary cap is 23M. it would be cool if those achievements scaled to the league salary cap.