bugfix: show updated cost when building a unit while another unit of same type is under construction

This commit is contained in:
Evan
2025-02-20 10:45:58 -08:00
parent aa76c28bb1
commit f8c5d29b36
5 changed files with 56 additions and 14 deletions
+13 -4
View File
@@ -114,7 +114,8 @@ export class DefaultConfig implements Config {
cost: (p: Player) =>
p.type() == PlayerType.Human && this.creativeMode()
? 0
: (p.units(UnitType.Warship).length + 1) * 250_000,
: (p.unitsIncludingConstruction(UnitType.Warship).length + 1) *
250_000,
territoryBound: false,
maxHealth: 1000,
};
@@ -131,7 +132,10 @@ export class DefaultConfig implements Config {
? 0
: Math.min(
1_000_000,
Math.pow(2, p.units(UnitType.Port).length) * 250_000,
Math.pow(
2,
p.unitsIncludingConstruction(UnitType.Port).length,
) * 250_000,
),
territoryBound: true,
constructionDuration: this.creativeMode() ? 0 : 2 * 10,
@@ -180,7 +184,9 @@ export class DefaultConfig implements Config {
? 0
: Math.min(
250_000,
(p.units(UnitType.DefensePost).length + 1) * 50_000,
(p.unitsIncludingConstruction(UnitType.DefensePost).length +
1) *
50_000,
),
territoryBound: true,
constructionDuration: this.creativeMode() ? 0 : 5 * 10,
@@ -192,7 +198,10 @@ export class DefaultConfig implements Config {
? 0
: Math.min(
1_000_000,
Math.pow(2, p.units(UnitType.City).length) * 125_000,
Math.pow(
2,
p.unitsIncludingConstruction(UnitType.City).length,
) * 125_000,
),
territoryBound: true,
constructionDuration: this.creativeMode() ? 0 : 2 * 10,