|
2 | 2 | Difficulty, |
3 | 3 | Execution, |
4 | 4 | Game, |
| 5 | + GameMode, |
5 | 6 | Gold, |
6 | 7 | Nation, |
7 | 8 | Player, |
@@ -252,17 +253,31 @@ export class NationExecution implements Execution { |
252 | 253 | } |
253 | 254 |
|
254 | 255 | private handleUnits() { |
| 256 | + const hasCoastalTiles = this.hasCoastalTiles(); |
| 257 | + const isTeamGame = this.mg.config().gameConfig().gameMode === GameMode.Team; |
255 | 258 | return ( |
256 | 259 | this.maybeSpawnStructure(UnitType.City, (num) => num) || |
257 | 260 | this.maybeSpawnStructure(UnitType.Port, (num) => num) || |
258 | 261 | this.maybeSpawnWarship() || |
259 | | - this.maybeSpawnStructure(UnitType.Factory, (num) => num) || |
| 262 | + this.maybeSpawnStructure(UnitType.Factory, (num) => |
| 263 | + hasCoastalTiles ? num * 3 : num, |
| 264 | + ) || |
260 | 265 | this.maybeSpawnStructure(UnitType.DefensePost, (num) => (num + 2) ** 2) || |
261 | | - this.maybeSpawnStructure(UnitType.SAMLauncher, (num) => num ** 2) || |
| 266 | + this.maybeSpawnStructure(UnitType.SAMLauncher, (num) => |
| 267 | + isTeamGame ? num : num ** 2, |
| 268 | + ) || |
262 | 269 | this.maybeSpawnStructure(UnitType.MissileSilo, (num) => num ** 2) |
263 | 270 | ); |
264 | 271 | } |
265 | 272 |
|
| 273 | + private hasCoastalTiles(): boolean { |
| 274 | + if (this.player === null) return false; |
| 275 | + for (const tile of this.player.borderTiles()) { |
| 276 | + if (this.mg.isOceanShore(tile)) return true; |
| 277 | + } |
| 278 | + return false; |
| 279 | + } |
| 280 | + |
266 | 281 | private maybeSpawnStructure( |
267 | 282 | type: UnitType, |
268 | 283 | multiplier: (num: number) => number, |
@@ -296,6 +311,7 @@ export class NationExecution implements Execution { |
296 | 311 | : randTerritoryTileArray(this.random, this.mg, this.player, 25); |
297 | 312 | if (tiles.length === 0) return null; |
298 | 313 | const valueFunction = structureSpawnTileValue(this.mg, this.player, type); |
| 314 | + if (valueFunction === null) return null; |
299 | 315 | let bestTile: TileRef | null = null; |
300 | 316 | let bestValue = 0; |
301 | 317 | for (const t of tiles) { |
|
0 commit comments