attack meta changes (#742)

## Description: 
Full changes for the attack meta for v23. These include changes to
attack losses and speed both in general and in relation with defense
posts and fallout. Max population, population growth, and gold
generation are also adjusted. Troops and attack boats sent now count
within max pop. Deployed at attackmeta.openfront.dev

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

1brucben
This commit is contained in:
1brucben
2025-05-19 09:34:42 -07:00
committed by GitHub
parent 285d1f0d8d
commit fa1ed7c653
6 changed files with 99 additions and 80 deletions
+1
View File
@@ -422,6 +422,7 @@ export interface Player {
// Resources & Population
gold(): Gold;
population(): number;
totalPopulation(): number;
workers(): number;
troops(): number;
targetTroopRatio(): number;
+1
View File
@@ -104,6 +104,7 @@ export interface PlayerUpdate {
tilesOwned: number;
gold: number;
population: number;
totalPopulation: number;
workers: number;
troops: number;
targetTroopRatio: number;
+3
View File
@@ -219,6 +219,9 @@ export class PlayerView {
population(): number {
return this.data.population;
}
totalPopulation(): number {
return this.data.totalPopulation;
}
workers(): number {
return this.data.workers;
}
+16
View File
@@ -138,6 +138,7 @@ export class PlayerImpl implements Player {
tilesOwned: this.numTilesOwned(),
gold: Number(this._gold),
population: this.population(),
totalPopulation: this.totalPopulation(),
workers: this.workers(),
troops: this.troops(),
targetTroopRatio: this.targetTroopRatio(),
@@ -648,6 +649,21 @@ export class PlayerImpl implements Player {
population(): number {
return Number(this._troops + this._workers);
}
totalPopulation(): number {
return this.population() + this.attackingTroops();
}
private attackingTroops(): number {
const landAttackTroops = this._outgoingAttacks
.filter((a) => a.isActive())
.reduce((sum, a) => sum + a.troops(), 0);
const boatTroops = this.units(UnitType.TransportShip)
.map((u) => u.troops())
.reduce((sum, n) => sum + n, 0);
return landAttackTroops + boatTroops;
}
workers(): number {
return Math.max(1, Number(this._workers));
}