diff --git a/src/Action/UpgradeResourceToLevel.ts b/src/Action/UpgradeResourceToLevel.ts index 2c8b892..ead02b0 100644 --- a/src/Action/UpgradeResourceToLevel.ts +++ b/src/Action/UpgradeResourceToLevel.ts @@ -31,12 +31,19 @@ export class UpgradeResourceToLevel extends ActionController { notUpgraded.sort((x, y) => x.level - y.level); + // Next two buildings: no delay between start building and scheduling next + const firstNotUpgraded = notUpgraded.shift(); + const secondNotUpgraded = notUpgraded.shift(); if (firstNotUpgraded && this.isTaskNotInQueue(villageId, firstNotUpgraded)) { this.scheduler.scheduleTask(UpgradeBuildingTask.name, { villageId, buildId: firstNotUpgraded.buildId }); } + if (secondNotUpgraded && this.isTaskNotInQueue(villageId, secondNotUpgraded)) { + this.scheduler.scheduleTask(UpgradeBuildingTask.name, { villageId, buildId: secondNotUpgraded.buildId }); + } + throw new TryLaterError(aroundMinutes(10), 'Sleep for next round'); }