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

Invader goal miscalculation #28

Open
tiennou opened this issue Jan 15, 2024 · 1 comment
Open

Invader goal miscalculation #28

tiennou opened this issue Jan 15, 2024 · 1 comment

Comments

@tiennou
Copy link

tiennou commented Jan 15, 2024

The code at-or-around https://github.com/screeps/backend-local/blob/master/lib/cronjobs.js#L433 is responsible for spawning invaders when a certain quantity is harvested from a room. I happened to find something that looks like a bug in that line that leads the goal to become 0 as Math.floor turns the chance of halving into a straight 0 and the code resets it to the value of the INVADERS_ENERGY_GOAL constant.

invaderGoal = Math.floor(invaderGoal * mult);

should fix the range back into 35,000 - 260,000 instead of a slanted 70,000 - 260,000.

TS Playground

@tiennou
Copy link
Author

tiennou commented Jan 15, 2024

Someone just pointed out to me https://screeps.com/forum/topic/2846/math-floor-in-invader-generation/4, and the fact that 0 causes the value to default again to INVADERS_ENERGY_GOAL, so 100,000.

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