Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong formula in HTMS Potential #1714

Open
CarlosML27 opened this issue Sep 3, 2023 · 1 comment
Open

Wrong formula in HTMS Potential #1714

CarlosML27 opened this issue Sep 3, 2023 · 1 comment

Comments

@CarlosML27
Copy link

Hello! This is not an issue per se, but I think there's an error in the formula for the HTMS Potential points.

This is the code for calculating the potential in players over the age factor limit:

else if (skills.years <= MAX_AGE) {
	// subtract weeks to previous birthday
	pointsDiff = skills.days / DAYS_IN_WEEK * WEEK_PTS_PER_AGE[skills.years];

	// subtracting 16 weeks per whole year until 28
	for (let i = skills.years; i > AGE_FACTOR; i--)
		pointsDiff += WEEKS_IN_SEASON * WEEK_PTS_PER_AGE[i];

	pointsDiff = -pointsDiff;
}

Shouldn't the loop go from skills.years-1 to AGE_FACTOR, including it?

Let's say we have a player with 30.013 years. First, we'll subtract the days equivalence until we reach a full year (in this case, 30.000). Then we'll have to subtract the full 29.111 to 29.000 year (WEEKS_IN_SEASON * WEEK_PTS_PER_AGE[29]) and finally the 28.111-28.000 year (WEEKS_IN_SEASON * WEEK_PTS_PER_AGE[28]). As it is right now, unless I'm missing something it will be taking the 30 and 29 years, so the calculations are messed up in that part...

@CarlosML27
Copy link
Author

@minj Any chances you can take a look at this? I wouldn't mind to do the PR if you give me green light.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant