mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-30 15:12:23 +00:00
update meta
This commit is contained in:
@@ -130,7 +130,7 @@ export interface Config {
|
||||
unitInfo(type: UnitType): UnitInfo;
|
||||
tradeShipGold(dist: number, numPorts: number): Gold;
|
||||
tradeShipSpawnRate(numTradeShips: number, numPlayerPorts: number): number;
|
||||
trainGold(isFriendly: boolean): Gold;
|
||||
trainGold(rel: "self" | "friendly" | "other"): Gold;
|
||||
trainSpawnRate(numPlayerFactories: number): number;
|
||||
trainStationMinRange(): number;
|
||||
trainStationMaxRange(): number;
|
||||
|
||||
@@ -333,8 +333,15 @@ export class DefaultConfig implements Config {
|
||||
// expected number of trains = numPlayerFactories / trainSpawnRate(numPlayerFactories)
|
||||
return (numPlayerFactories + 5) * 50;
|
||||
}
|
||||
trainGold(isFriendly: boolean): Gold {
|
||||
return isFriendly ? 50_000n : 10_000n;
|
||||
trainGold(rel: "self" | "friendly" | "other"): Gold {
|
||||
switch (rel) {
|
||||
case "friendly":
|
||||
return 50_000n;
|
||||
case "other":
|
||||
return 10_000n;
|
||||
case "self":
|
||||
return 5_000n;
|
||||
}
|
||||
}
|
||||
|
||||
trainStationMinRange(): number {
|
||||
@@ -363,7 +370,7 @@ export class DefaultConfig implements Config {
|
||||
this.tradeShipPortMultiplier(numPlayerPorts),
|
||||
);
|
||||
|
||||
return Math.floor(10 / combined);
|
||||
return Math.floor(20 / combined);
|
||||
}
|
||||
|
||||
private tradeShipBaseSpawn(numTradeShips: number): number {
|
||||
|
||||
@@ -25,8 +25,7 @@ class CityStopHandler implements TrainStopHandler {
|
||||
): void {
|
||||
const stationOwner = station.unit.owner();
|
||||
const trainOwner = trainExecution.owner();
|
||||
const isFriendly = stationOwner.isFriendly(trainOwner);
|
||||
const goldBonus = mg.config().trainGold(isFriendly);
|
||||
const goldBonus = mg.config().trainGold(rel(trainOwner, stationOwner));
|
||||
// Share revenue with the station owner if it's not the current player
|
||||
if (trainOwner !== stationOwner) {
|
||||
stationOwner.addGold(goldBonus, station.tile());
|
||||
@@ -44,13 +43,13 @@ class PortStopHandler implements TrainStopHandler {
|
||||
): void {
|
||||
const stationOwner = station.unit.owner();
|
||||
const trainOwner = trainExecution.owner();
|
||||
const isFriendly = stationOwner.isFriendly(trainOwner);
|
||||
const goldBonus = mg.config().trainGold(isFriendly);
|
||||
const goldBonus = mg.config().trainGold(rel(trainOwner, stationOwner));
|
||||
|
||||
if (isFriendly) {
|
||||
trainOwner.addGold(goldBonus, station.tile());
|
||||
// Share revenue with the station owner if it's not the current player
|
||||
if (trainOwner !== stationOwner) {
|
||||
stationOwner.addGold(goldBonus, station.tile());
|
||||
}
|
||||
trainOwner.addGold(goldBonus, station.tile());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,3 +232,13 @@ export class Cluster {
|
||||
this.stations.clear();
|
||||
}
|
||||
}
|
||||
|
||||
function rel(player: Player, other: Player): "self" | "friendly" | "other" {
|
||||
if (player === other) {
|
||||
return "self";
|
||||
}
|
||||
if (player.isFriendly(other)) {
|
||||
return "friendly";
|
||||
}
|
||||
return "other";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user