mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-25 01:32:43 +00:00
spawn fewer tradeships, change destroyer, tradeship graphic
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user