forked from ppfun/pixelplanet
fix country punishment
This commit is contained in:
parent
f081b62bb2
commit
66e67ae323
|
@ -50,8 +50,8 @@ class Ranks {
|
||||||
};
|
};
|
||||||
|
|
||||||
// if a country dominates, adjust its cooldown
|
// if a country dominates, adjust its cooldown
|
||||||
#punishedCountry;
|
#punishedCountry = null;
|
||||||
#punishmentFactor;
|
#punishmentFactor = 1.0;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
/*
|
/*
|
||||||
|
@ -109,12 +109,12 @@ class Ranks {
|
||||||
* 20% gets added to their cooldown for every country
|
* 20% gets added to their cooldown for every country
|
||||||
* after the first. Ceiled at 200%
|
* after the first. Ceiled at 200%
|
||||||
*/
|
*/
|
||||||
if (outnumbered > 2) {
|
if (outnumbered >= 2) {
|
||||||
this.#punishedCountry = leadingCountry;
|
let punishmentFactor = 1 + 0.25 * (outnumbered - 1);
|
||||||
let punishmentFactor = 1 + 0.2 * (outnumbered - 1);
|
if (punishmentFactor > 3) {
|
||||||
if (punishmentFactor > 2) {
|
punishmentFactor = 3;
|
||||||
punishmentFactor = 2;
|
|
||||||
}
|
}
|
||||||
|
this.#punishedCountry = leadingCountry;
|
||||||
this.#punishmentFactor = punishmentFactor;
|
this.#punishmentFactor = punishmentFactor;
|
||||||
logger.info(
|
logger.info(
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
|
|
|
@ -145,11 +145,11 @@ export async function storeHourlyCountryStats(start, amount) {
|
||||||
prevData.forEach(({ value, score }) => prevRanks.set(value, score));
|
prevData.forEach(({ value, score }) => prevRanks.set(value, score));
|
||||||
const addArr = [];
|
const addArr = [];
|
||||||
curData.forEach(({ value: cc, score: curPx }) => {
|
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;
|
const px = (curPx > prevPx) ? curPx - prevPx : curPx;
|
||||||
addArr.push({
|
addArr.push({
|
||||||
score: cc,
|
value: cc,
|
||||||
value: px,
|
score: px,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (addArr.length) {
|
if (addArr.length) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user