From 9434d82d78c1553718aa8195a3643b04bd2a0381 Mon Sep 17 00:00:00 2001 From: PilkeySEK <156579268+PilkeySEK@users.noreply.github.com> Date: Sat, 29 Mar 2025 21:56:17 +0100 Subject: [PATCH] Add gold for encircling someone + display message (#369) ## 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: PilkeySEK --- src/core/execution/PlayerExecution.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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); }