diff --git a/src/board/BuildingTile.svelte b/src/board/BuildingTile.svelte index 8d4b356..99b9c6d 100644 --- a/src/board/BuildingTile.svelte +++ b/src/board/BuildingTile.svelte @@ -1,7 +1,7 @@ { #if unitsCount > 0 }
{ unitsCount } - ({ prettyDuration }’) + ({ getPrettyTime(timeToNextRecruit) })
{ /if } diff --git a/src/utils.ts b/src/utils.ts index 36cb3bb..c02408c 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -216,3 +216,9 @@ export function indexToPoint(index: number): Point { y: Math.floor(index / WORLD_MAP_WIDTH), }; } + + +export function getPrettyTime(milliseconds: number) { + const timeInSeconds = Math.ceil(milliseconds / 1000.0); + return `${timeInSeconds}s`; +} diff --git a/src/village.ts b/src/village.ts index eae3aaa..7c87383 100644 --- a/src/village.ts +++ b/src/village.ts @@ -137,7 +137,7 @@ function getInitialState() { // Create the Town hall. const townhall = createBuilding('townhall'); - // townhall.level = 20; + townhall.level = 20; state.villageTiles[0][0] = townhall.id; state.buildings.push(townhall); @@ -160,7 +160,7 @@ function getInitialState() { } const newBuilding = createBuilding(type); newBuilding.tile = new Hex(x, y); - newBuilding.level = 1; //20; //newBuilding.type === 'field' ? 1 : 10; + newBuilding.level = 20; //newBuilding.type === 'field' ? 1 : 10; state.outsideTiles[y][x] = newBuilding.id; state.buildings.push(newBuilding); });