From 98367ac966516e4cd0c742127c770ef1436d5b32 Mon Sep 17 00:00:00 2001 From: Evan Date: Mon, 25 Nov 2024 20:16:08 -0800 Subject: [PATCH] spawn fewer tradeships, change destroyer, tradeship graphic --- src/client/graphics/layers/UnitLayer.ts | 18 +++++++++++------- src/core/configuration/Config.ts | 1 + src/core/configuration/DefaultConfig.ts | 5 ++++- src/core/configuration/DevConfig.ts | 4 ++-- src/core/execution/PortExecution.ts | 2 +- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/client/graphics/layers/UnitLayer.ts b/src/client/graphics/layers/UnitLayer.ts index cbee1b4db..6cda23cf9 100644 --- a/src/client/graphics/layers/UnitLayer.ts +++ b/src/client/graphics/layers/UnitLayer.ts @@ -89,16 +89,16 @@ export class UnitLayer implements Layer { } private handleDestroyerEvent(event: UnitEvent) { - bfs(event.oldTile, euclDist(event.oldTile, 3)).forEach(t => { + bfs(event.oldTile, euclDist(event.oldTile, 4)).forEach(t => { this.clearCell(t.cell()); }); if (!event.unit.isActive()) { return } - bfs(event.unit.tile(), euclDist(event.unit.tile(), 3)) + bfs(event.unit.tile(), euclDist(event.unit.tile(), 4)) .forEach(t => this.paintCell(t.cell(), this.theme.borderColor(event.unit.owner().info()), 255)); - bfs(event.unit.tile(), euclDist(event.unit.tile(), 2)) - .forEach(t => this.paintCell(t.cell(), this.theme.territoryColor(event.unit.owner().info()), 180)); + bfs(event.unit.tile(), dist(event.unit.tile(), 3)) + .forEach(t => this.paintCell(t.cell(), this.theme.territoryColor(event.unit.owner().info()), 255)); } private handleNuke(event: UnitEvent) { @@ -113,11 +113,15 @@ export class UnitLayer implements Layer { } private handleTradeShipEvent(event: UnitEvent) { - bfs(event.oldTile, euclDist(event.oldTile, 1)).forEach(t => { + bfs(event.oldTile, euclDist(event.oldTile, 3)).forEach(t => { this.clearCell(t.cell()); }); if (event.unit.isActive()) { - bfs(event.unit.tile(), euclDist(event.unit.tile(), 1)) + bfs(event.unit.tile(), dist(event.unit.tile(), 2)) + .forEach(t => this.paintCell(t.cell(), this.theme.territoryColor(event.unit.owner().info()), 255)); + } + if (event.unit.isActive()) { + bfs(event.unit.tile(), dist(event.unit.tile(), 1)) .forEach(t => this.paintCell(t.cell(), this.theme.borderColor(event.unit.owner().info()), 255)); } } @@ -142,7 +146,7 @@ export class UnitLayer implements Layer { bfs(event.unit.tile(), dist(event.unit.tile(), 2)) .forEach(t => this.paintCell(t.cell(), this.theme.borderColor(event.unit.owner().info()), 255)); bfs(event.unit.tile(), dist(event.unit.tile(), 1)) - .forEach(t => this.paintCell(t.cell(), this.theme.territoryColor(event.unit.owner().info()), 180)); + .forEach(t => this.paintCell(t.cell(), this.theme.territoryColor(event.unit.owner().info()), 255)); } else { trail.forEach(t => this.clearCell(t.cell())); this.boatToTrail.delete(event.unit); diff --git a/src/core/configuration/Config.ts b/src/core/configuration/Config.ts index 85f683d00..719b7212b 100644 --- a/src/core/configuration/Config.ts +++ b/src/core/configuration/Config.ts @@ -59,6 +59,7 @@ export interface Config { defaultDonationAmount(sender: Player): number unitInfo(type: UnitType): UnitInfo tradeShipGold(src: Unit, dst: Unit): Gold + tradeShipSpawnRate(): number } export interface Theme { diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 1e3690837..117e1926b 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -12,7 +12,10 @@ export class DefaultConfig implements Config { } tradeShipGold(src: Unit, dst: Unit): Gold { const dist = manhattanDist(src.tile().cell(), dst.tile().cell()) - return 10000 + 50 * Math.pow(dist, 1.1) + return 10000 + 100 * Math.pow(dist, 1.1) + } + tradeShipSpawnRate(): number { + return 500 } unitInfo(type: UnitType): UnitInfo { switch (type) { diff --git a/src/core/configuration/DevConfig.ts b/src/core/configuration/DevConfig.ts index 6ed85f785..f77599259 100644 --- a/src/core/configuration/DevConfig.ts +++ b/src/core/configuration/DevConfig.ts @@ -5,7 +5,7 @@ export const devConfig = new class extends DefaultConfig { unitInfo(type: UnitType): UnitInfo { const info = super.unitInfo(type) const oldCost = info.cost - info.cost = (p: Player) => oldCost(p) / 1000 + info.cost = (p: Player) => oldCost(p) / 10000 return info } @@ -13,7 +13,7 @@ export const devConfig = new class extends DefaultConfig { return 95 } numSpawnPhaseTurns(): number { - return 80 + return 40 } gameCreationRate(): number { return 20 * 1000 diff --git a/src/core/execution/PortExecution.ts b/src/core/execution/PortExecution.ts index 97e729345..f3f636359 100644 --- a/src/core/execution/PortExecution.ts +++ b/src/core/execution/PortExecution.ts @@ -86,7 +86,7 @@ export class PortExecution implements Execution { const portConnections = Array.from(this.portPaths.keys()) - if (portConnections.length > 0 && this.random.chance(250)) { + if (portConnections.length > 0 && this.random.chance(this.mg.config().tradeShipSpawnRate())) { const port = this.random.randElement(portConnections) const path = this.portPaths.get(port) if (path != null) {