mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-08-18 00:28:14 +00:00
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:
@@ -422,6 +422,7 @@ export interface Player {
|
||||
// Resources & Population
|
||||
gold(): Gold;
|
||||
population(): number;
|
||||
totalPopulation(): number;
|
||||
workers(): number;
|
||||
troops(): number;
|
||||
targetTroopRatio(): number;
|
||||
|
||||
@@ -104,6 +104,7 @@ export interface PlayerUpdate {
|
||||
tilesOwned: number;
|
||||
gold: number;
|
||||
population: number;
|
||||
totalPopulation: number;
|
||||
workers: number;
|
||||
troops: number;
|
||||
targetTroopRatio: number;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user