spawn fewer tradeships, change destroyer, tradeship graphic

This commit is contained in:
Evan
2024-11-25 20:16:08 -08:00
parent 3137611ab3
commit 98367ac966
5 changed files with 19 additions and 11 deletions
+11 -7
View File
@@ -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);
+1
View File
@@ -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 {
+4 -1
View File
@@ -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) {
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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) {