rebalance difficulties: adjust max pop on difficulties

This commit is contained in:
Evan
2025-02-10 20:47:36 -08:00
parent 3ced661e2c
commit 81a83706c7
2 changed files with 21 additions and 25 deletions
+19 -23
View File
@@ -351,14 +351,28 @@ export class DefaultConfig implements Config {
}
maxPopulation(player: Player | PlayerView): number {
let maxPop = Math.pow(player.numTilesOwned(), 0.6) * 1000 + 50000;
let maxPop =
2 * (Math.pow(player.numTilesOwned(), 0.6) * 1000 + 50000) +
player.units(UnitType.City).length * this.cityPopulationIncrease();
if (player.type() == PlayerType.Bot) {
return maxPop / 2;
}
if (player.type() == PlayerType.Human) {
return maxPop;
}
return (
maxPop * 2 +
player.units(UnitType.City).length * this.cityPopulationIncrease()
);
switch (this._gameConfig.difficulty) {
case Difficulty.Easy:
return maxPop * 0.5;
case Difficulty.Medium:
return maxPop * 0.7;
case Difficulty.Hard:
return maxPop * 1;
case Difficulty.Impossible:
return maxPop * 1.5;
}
}
populationIncreaseRate(player: Player): number {
@@ -372,24 +386,6 @@ export class DefaultConfig implements Config {
if (player.type() == PlayerType.Bot) {
toAdd *= 0.7;
}
let difficultyMultiplier = 1;
switch (this._gameConfig.difficulty) {
case Difficulty.Easy:
difficultyMultiplier = 0.3;
break;
case Difficulty.Medium:
difficultyMultiplier = 0.5;
break;
case Difficulty.Hard:
difficultyMultiplier = 1;
break;
case Difficulty.Impossible:
difficultyMultiplier = 1.2;
break;
}
if (player.type() == PlayerType.FakeHuman) {
toAdd *= difficultyMultiplier;
}
return Math.min(player.population() + toAdd, max) - player.population();
}
+2 -2
View File
@@ -18,14 +18,14 @@ export class DevConfig extends DefaultConfig {
}
numSpawnPhaseTurns(): number {
return this.gameConfig().gameType == GameType.Singleplayer ? 20 : 100;
return this.gameConfig().gameType == GameType.Singleplayer ? 40 : 100;
// return 100
}
unitInfo(type: UnitType): UnitInfo {
const info = super.unitInfo(type);
const oldCost = info.cost;
info.cost = (p: Player) => oldCost(p) / 1000000000;
// info.cost = (p: Player) => oldCost(p) / 1000000000;
return info;
}