mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-03 21:59:38 +00:00
simply start population calculation
This commit is contained in:
@@ -155,6 +155,7 @@ export class Executor {
|
||||
fakeHumanExecutions(): Execution[] {
|
||||
const execs = [];
|
||||
for (const nation of this.mg.nations()) {
|
||||
console.log(`got nation: ${nation.name}`);
|
||||
execs.push(
|
||||
new FakeHumanExecution(
|
||||
this.gameID,
|
||||
@@ -162,13 +163,9 @@ export class Executor {
|
||||
nation.name,
|
||||
PlayerType.FakeHuman,
|
||||
null,
|
||||
this.random.nextID()
|
||||
),
|
||||
nation.cell,
|
||||
nation.strength *
|
||||
this.mg
|
||||
.config()
|
||||
.difficultyModifier(this.mg.config().gameConfig().difficulty)
|
||||
this.random.nextID(),
|
||||
nation
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,12 +43,7 @@ export class FakeHumanExecution implements Execution {
|
||||
private lastEnemyUpdateTick: number = 0;
|
||||
private lastEmojiSent = new Map<Player, Tick>();
|
||||
|
||||
constructor(
|
||||
gameID: GameID,
|
||||
private playerInfo: PlayerInfo,
|
||||
private cell: Cell,
|
||||
private strength: number
|
||||
) {
|
||||
constructor(gameID: GameID, private playerInfo: PlayerInfo) {
|
||||
this.random = new PseudoRandom(
|
||||
simpleHash(playerInfo.id) + simpleHash(gameID)
|
||||
);
|
||||
@@ -77,8 +72,6 @@ export class FakeHumanExecution implements Execution {
|
||||
this.player = this.mg.players().find((p) => p.id() == this.playerInfo.id);
|
||||
if (this.player == null) {
|
||||
return;
|
||||
} else {
|
||||
this.player.setTroops(this.player.troops() * this.strength);
|
||||
}
|
||||
}
|
||||
if (this.firstMove) {
|
||||
@@ -522,8 +515,9 @@ export class FakeHumanExecution implements Execution {
|
||||
let tries = 0;
|
||||
while (tries < 50) {
|
||||
tries++;
|
||||
const x = this.random.nextInt(this.cell.x - delta, this.cell.x + delta);
|
||||
const y = this.random.nextInt(this.cell.y - delta, this.cell.y + delta);
|
||||
const cell = this.playerInfo.nation.cell;
|
||||
const x = this.random.nextInt(cell.x - delta, cell.x + delta);
|
||||
const y = this.random.nextInt(cell.y - delta, cell.y + delta);
|
||||
if (!this.mg.isValidCoord(x, y)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user