mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-27 21:34:52 +00:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user