mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 12:51:30 +00:00
feat: more trade when there are few ports worldwide (#242)
This commit is contained in:
@@ -160,7 +160,7 @@ export interface Config {
|
||||
defaultDonationAmount(sender: Player): number;
|
||||
unitInfo(type: UnitType): UnitInfo;
|
||||
tradeShipGold(dist: number): Gold;
|
||||
tradeShipSpawnRate(): number;
|
||||
tradeShipSpawnRate(numberOfPorts: number): number;
|
||||
defensePostRange(): number;
|
||||
defensePostDefenseBonus(): number;
|
||||
falloutDefenseModifier(percentOfFallout: number): number;
|
||||
|
||||
@@ -156,7 +156,12 @@ export class DefaultConfig implements Config {
|
||||
tradeShipGold(dist: number): Gold {
|
||||
return 10000 + 150 * Math.pow(dist, 1.1);
|
||||
}
|
||||
tradeShipSpawnRate(): number {
|
||||
tradeShipSpawnRate(numberOfPorts: number): number {
|
||||
if (numberOfPorts <= 3) return 180;
|
||||
if (numberOfPorts <= 5) return 250;
|
||||
if (numberOfPorts <= 8) return 350;
|
||||
if (numberOfPorts <= 10) return 400;
|
||||
if (numberOfPorts <= 12) return 450;
|
||||
return 500;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,10 @@ export class PortExecution implements Execution {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.random.chance(this.mg.config().tradeShipSpawnRate())) {
|
||||
const totalNbOfPorts = this.mg.units(UnitType.Port).length;
|
||||
if (
|
||||
!this.random.chance(this.mg.config().tradeShipSpawnRate(totalNbOfPorts))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user