fix country punishment

This commit is contained in:
HF 2023-12-27 17:39:55 +01:00
parent f081b62bb2
commit 66e67ae323
2 changed files with 10 additions and 10 deletions

View File

@ -50,8 +50,8 @@ class Ranks {
};
// if a country dominates, adjust its cooldown
#punishedCountry;
#punishmentFactor;
#punishedCountry = null;
#punishmentFactor = 1.0;
constructor() {
/*
@ -109,12 +109,12 @@ class Ranks {
* 20% gets added to their cooldown for every country
* after the first. Ceiled at 200%
*/
if (outnumbered > 2) {
this.#punishedCountry = leadingCountry;
let punishmentFactor = 1 + 0.2 * (outnumbered - 1);
if (punishmentFactor > 2) {
punishmentFactor = 2;
if (outnumbered >= 2) {
let punishmentFactor = 1 + 0.25 * (outnumbered - 1);
if (punishmentFactor > 3) {
punishmentFactor = 3;
}
this.#punishedCountry = leadingCountry;
this.#punishmentFactor = punishmentFactor;
logger.info(
// eslint-disable-next-line max-len

View File

@ -145,11 +145,11 @@ export async function storeHourlyCountryStats(start, amount) {
prevData.forEach(({ value, score }) => prevRanks.set(value, score));
const addArr = [];
curData.forEach(({ value: cc, score: curPx }) => {
const prevPx = prevData.get(cc) || 0;
const prevPx = prevRanks.get(cc) || 0;
const px = (curPx > prevPx) ? curPx - prevPx : curPx;
addArr.push({
score: cc,
value: px,
value: cc,
score: px,
});
});
if (addArr.length) {