mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 01:57:44 +00:00
pop fix
This commit is contained in:
@@ -616,10 +616,7 @@ export class DefaultConfig implements Config {
|
||||
let toAdd =
|
||||
10 +
|
||||
(1400 / max + 1 / 125) * (0.8 * player.troops() + 1.2 * player.workers());
|
||||
const adjustedPop =
|
||||
typeof player.adjustedPopulation === "function"
|
||||
? player.adjustedPopulation()
|
||||
: player.population();
|
||||
const adjustedPop = player.adjustedPopulation();
|
||||
|
||||
const ratio = 1 - adjustedPop / max;
|
||||
toAdd *= ratio;
|
||||
@@ -645,7 +642,10 @@ export class DefaultConfig implements Config {
|
||||
}
|
||||
}
|
||||
|
||||
return Math.min(player.population() + toAdd, max) - player.population();
|
||||
return (
|
||||
Math.min(player.adjustedPopulation() + toAdd, max) -
|
||||
player.adjustedPopulation()
|
||||
);
|
||||
}
|
||||
|
||||
goldAdditionRate(player: Player): number {
|
||||
|
||||
@@ -99,6 +99,7 @@ export interface PlayerUpdate {
|
||||
tilesOwned: number;
|
||||
gold: number;
|
||||
population: number;
|
||||
adjustedPopulation: number;
|
||||
workers: number;
|
||||
troops: number;
|
||||
targetTroopRatio: number;
|
||||
|
||||
@@ -225,6 +225,9 @@ export class PlayerView {
|
||||
population(): number {
|
||||
return this.data.population;
|
||||
}
|
||||
adjustedPopulation(): number {
|
||||
return this.data.adjustedPopulation;
|
||||
}
|
||||
workers(): number {
|
||||
return this.data.workers;
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ export class PlayerImpl implements Player {
|
||||
tilesOwned: this.numTilesOwned(),
|
||||
gold: Number(this._gold),
|
||||
population: this.population(),
|
||||
adjustedPopulation: this.adjustedPopulation(),
|
||||
workers: this.workers(),
|
||||
troops: this.troops(),
|
||||
targetTroopRatio: this.targetTroopRatio(),
|
||||
|
||||
Reference in New Issue
Block a user