diff --git a/TODO.txt b/TODO.txt index d6a685791..a04f2af6f 100644 --- a/TODO.txt +++ b/TODO.txt @@ -221,10 +221,9 @@ * better unit scaling DONE 12/9/2024 * make hard & impossible harder DONE 12/9/2024 * clicking on a player's name in the rank UI should teleport you to him DONE 12/9/2024 -* nuking an enemy and accidentally destroying a trade ship shouldn't break the alliance and make you a traitor -* emojis should be displayed on top of your name not under it -* the notification for a successful trade should be shorter, example: " 70k Gold from trade with "X" " -* countries don't actually spawn with some randomness, it's always the same exact spawn +* emojis should be displayed on top of your name not under it DONE 12/9/2024 +* the notification for a successful trade should be shorter, example: " 70k Gold from trade with "X" " DONE 12/9/2024 +* countries don't actually spawn with some randomness, it's always the same exact spawn DONE 12/9/2024 * you should get a notification and a reward (some money) for eliminating an enemy (perhaps take wtvr gold the enemy had) * store in BigQuery * make boats work on lakes (& oceania) diff --git a/src/client/graphics/layers/NameLayer.ts b/src/client/graphics/layers/NameLayer.ts index a71928e31..06faddc41 100644 --- a/src/client/graphics/layers/NameLayer.ts +++ b/src/client/graphics/layers/NameLayer.ts @@ -188,17 +188,6 @@ export class NameLayer implements Layer { ); } - if (myPlayer != null) { - const emojis = render.player.outgoingEmojis().filter(e => e.recipient == AllPlayers || e.recipient == myPlayer) - if (emojis.length > 0) { - context.font = `${render.fontSize * 4}px ${this.theme.font()}`; - context.fillStyle = this.theme.playerInfoColor(render.player.id()).toHex(); - context.textAlign = 'center'; - context.textBaseline = 'middle'; - - context.fillText(emojis[0].emoji, nameCenterX, nameCenterY + render.fontSize / 2); - } - } context.textRendering = "optimizeSpeed"; @@ -211,6 +200,19 @@ export class NameLayer implements Layer { context.font = `bold ${render.fontSize}px ${this.theme.font()}`; context.fillText(renderTroops(render.player.troops()), nameCenterX, nameCenterY + render.fontSize); + + + if (myPlayer != null) { + const emojis = render.player.outgoingEmojis().filter(e => e.recipient == AllPlayers || e.recipient == myPlayer) + if (emojis.length > 0) { + context.font = `${render.fontSize * 4}px ${this.theme.font()}`; + context.fillStyle = this.theme.playerInfoColor(render.player.id()).toHex(); + context.textAlign = 'center'; + context.textBaseline = 'middle'; + + context.fillText(emojis[0].emoji, nameCenterX, nameCenterY + render.fontSize / 2); + } + } } private getPlayer(): Player | null { diff --git a/src/core/execution/ExecutionManager.ts b/src/core/execution/ExecutionManager.ts index b1811b056..8795cc603 100644 --- a/src/core/execution/ExecutionManager.ts +++ b/src/core/execution/ExecutionManager.ts @@ -117,6 +117,7 @@ export class Executor { const execs = [] for (const nation of this.gs.nations()) { execs.push(new FakeHumanExecution( + this.gameID, this.workerClient, new PlayerInfo( nation.name, diff --git a/src/core/execution/FakeHumanExecution.ts b/src/core/execution/FakeHumanExecution.ts index d9b70d432..06346e74d 100644 --- a/src/core/execution/FakeHumanExecution.ts +++ b/src/core/execution/FakeHumanExecution.ts @@ -9,6 +9,7 @@ import { ParallelAStar, WorkerClient } from "../worker/WorkerClient"; import { PathFinder } from "../pathfinding/PathFinding"; import { DestroyerExecution } from "./DestroyerExecution"; import { BattleshipExecution } from "./BattleshipExecution"; +import { GameID } from "../Schemas"; export class FakeHumanExecution implements Execution { @@ -25,8 +26,8 @@ export class FakeHumanExecution implements Execution { private relations = new Map() - constructor(private worker: WorkerClient, private playerInfo: PlayerInfo, private cell: Cell, private strength: number) { - this.random = new PseudoRandom(simpleHash(playerInfo.id)) + constructor(gameID: GameID, private worker: WorkerClient, private playerInfo: PlayerInfo, private cell: Cell, private strength: number) { + this.random = new PseudoRandom(simpleHash(playerInfo.id) + simpleHash(gameID)) } init(mg: MutableGame, ticks: number) { diff --git a/src/core/execution/TradeShipExecution.ts b/src/core/execution/TradeShipExecution.ts index 018327b8c..e16ffcd9e 100644 --- a/src/core/execution/TradeShipExecution.ts +++ b/src/core/execution/TradeShipExecution.ts @@ -99,8 +99,8 @@ export class TradeShipExecution implements Execution { const gold = this.mg.config().tradeShipGold(this.srcPort, this.dstPort) this.srcPort.owner().addGold(gold) this.dstPort.owner().addGold(gold) - this.mg.displayMessage(`Trade ship from ${this.tradeShip.owner().displayName()} has reached your port, giving you ${renderNumber(gold)} gold`, MessageType.SUCCESS, this.dstPort.owner().id()) - this.mg.displayMessage(`Your trade ship reached ${this.dstPort.owner().displayName()}, giving you ${renderNumber(gold)} gold`, MessageType.SUCCESS, this._owner) + this.mg.displayMessage(`Received ${renderNumber(gold)} gold from trade with ${this.tradeShip.owner().displayName()}`, MessageType.SUCCESS, this.dstPort.owner().id()) + this.mg.displayMessage(`Received ${renderNumber(gold)} gold from trade with ${this.tradeShip.owner().displayName()}`, MessageType.SUCCESS, this._owner) this.tradeShip.delete() return }