diff --git a/src/core/execution/PlayerExecution.ts b/src/core/execution/PlayerExecution.ts index 0a5d55864..ced03d44e 100644 --- a/src/core/execution/PlayerExecution.ts +++ b/src/core/execution/PlayerExecution.ts @@ -2,6 +2,7 @@ import { Config } from "../configuration/Config"; import { Execution, Game, + MessageType, Player, PlayerID, TerraNullius, @@ -11,6 +12,7 @@ import { calculateBoundingBox, getMode, inscribed, simpleHash } from "../Util"; import { GameImpl } from "../game/GameImpl"; import { consolex } from "../Consolex"; import { GameMap, TileRef } from "../game/GameMap"; +import { renderNumber } from "../../client/Utils"; export class PlayerExecution implements Execution { private readonly ticksPerClusterCalc = 20; @@ -201,6 +203,19 @@ export class PlayerExecution implements Execution { this.mg.ownerID(t) == this.player.smallID(); const tiles = this.mg.bfs(firstTile, filter); + if (this.player.numTilesOwned() == tiles.size) { + const gold = this.player.gold(); + this.mg.displayMessage( + `Conquered ${this.player.displayName()} received ${renderNumber( + gold, + )} gold`, + MessageType.SUCCESS, + capturing.id(), + ); + capturing.addGold(gold); + this.player.removeGold(gold); + } + for (const tile of tiles) { capturing.conquer(tile); }