mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 03:53:49 +00:00
update
This commit is contained in:
@@ -129,7 +129,7 @@ export interface Config {
|
||||
tradeShipGold(dist: number): Gold;
|
||||
tradeShipSpawnRate(
|
||||
tradeShipSpawnRejections: number,
|
||||
numTradeShips: number,
|
||||
numPlayerPorts: number,
|
||||
): number;
|
||||
trainGold(rel: "self" | "team" | "ally" | "other"): Gold;
|
||||
trainSpawnRate(numPlayerFactories: number): number;
|
||||
|
||||
@@ -298,27 +298,25 @@ export class DefaultConfig implements Config {
|
||||
return 120;
|
||||
}
|
||||
|
||||
tradeShipGold(dist: number, numPorts: number): Gold {
|
||||
tradeShipGold(dist: number): Gold {
|
||||
return toInt(10000 + 150 * Math.pow(dist, 1.1));
|
||||
}
|
||||
|
||||
// Probability of trade ship spawn = 1 / tradeShipSpawnRate
|
||||
tradeShipSpawnRate(
|
||||
tradeShipSpawnRejections: number,
|
||||
numTradeShips: number,
|
||||
numPlayerPorts: number,
|
||||
): number {
|
||||
if (numPlayerPorts <= 3) return 18;
|
||||
if (numPlayerPorts <= 5) return 25;
|
||||
if (numPlayerPorts <= 8) return 35;
|
||||
if (numPlayerPorts <= 10) return 40;
|
||||
if (numPlayerPorts <= 12) return 45;
|
||||
return 50;
|
||||
}
|
||||
|
||||
// Pity timer: increases spawn chance after consecutive rejections
|
||||
const rejectionModifier = 1 / (tradeShipSpawnRejections + 1);
|
||||
|
||||
return Math.floor((100 * rejectionModifier) / baseSpawnRate);
|
||||
return Math.floor((100 * rejectionModifier) / 50);
|
||||
}
|
||||
|
||||
unitInfo(type: UnitType): UnitInfo {
|
||||
@@ -379,7 +377,6 @@ export class DefaultConfig implements Config {
|
||||
case UnitType.MIRV:
|
||||
return {
|
||||
cost: this.costWrapper(() => 35_000_000),
|
||||
territoryBound: false,
|
||||
};
|
||||
break;
|
||||
case UnitType.MIRVWarhead:
|
||||
|
||||
@@ -69,10 +69,10 @@ export class PortExecution implements Execution {
|
||||
}
|
||||
|
||||
shouldSpawnTradeShip(): boolean {
|
||||
const numTradeShips = this.mg.unitCount(UnitType.TradeShip);
|
||||
const numPlayerPorts = this.port!.owner().unitCount(UnitType.Port);
|
||||
const spawnRate = this.mg
|
||||
.config()
|
||||
.tradeShipSpawnRate(this.tradeShipSpawnRejections, numTradeShips);
|
||||
.tradeShipSpawnRate(this.tradeShipSpawnRejections, numPlayerPorts);
|
||||
for (let i = 0; i < this.port!.level(); i++) {
|
||||
if (this.random.chance(spawnRate)) {
|
||||
this.tradeShipSpawnRejections = 0;
|
||||
|
||||
Reference in New Issue
Block a user