From 0ee34e6831bc4dea29457306e8b9852c40906ff4 Mon Sep 17 00:00:00 2001 From: Adrian Gaudebert Date: Thu, 21 Nov 2024 14:53:03 +0100 Subject: [PATCH] Show a pretty time for durations. Increase recruitment time for soldiers and philosophers. --- src/board/BuildingTile.svelte | 5 ++--- src/data/buildings.ts | 4 ++-- src/hud/BuildingPanel.svelte | 4 ++-- src/hud/Quests.svelte | 3 ++- src/hud/RecruitmentQueue.svelte | 4 ++-- src/utils.ts | 6 ++++++ src/village.ts | 4 ++-- 7 files changed, 18 insertions(+), 12 deletions(-) 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); });