From 58c6d910bb580fd27e5ddb6d7153ba5ea4761cd8 Mon Sep 17 00:00:00 2001 From: Adrian Gaudebert Date: Sat, 21 Dec 2024 12:35:13 +0100 Subject: [PATCH] Make debug easier by pushing config to the constants file. --- src/constants.ts | 4 ++++ src/village.ts | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index fc87389..adb6ef5 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,3 +1,7 @@ export const CULTURE_TO_WIN = 20000; export const WORLD_MAP_HEIGHT = 9; export const WORLD_MAP_WIDTH = 9; + +// Debug values. +export const TOWN_HALL_START_LEVEL = 1; +export const RESOURCE_BUILDINGS_START_LEVEL = 1; diff --git a/src/village.ts b/src/village.ts index 7c87383..fa23ef7 100644 --- a/src/village.ts +++ b/src/village.ts @@ -5,7 +5,7 @@ import worldmap from "./data/worldmap"; import { getTilesAtDistance, Hex } from "./hexgrid"; import { WORLDMAP_TYPES, type BuildingType, type CostType, type HeroType, type QuestType, type RegionType, type ResourcesType } from "./types"; import { distanceBetweenCells, getAdjacentWorldmapCells, getKeysAsNumbers, indexToPoint, shuffle } from "./utils"; -import { WORLD_MAP_HEIGHT, WORLD_MAP_WIDTH } from "./constants"; +import { RESOURCE_BUILDINGS_START_LEVEL, TOWN_HALL_START_LEVEL, WORLD_MAP_HEIGHT, WORLD_MAP_WIDTH } from "./constants"; type Board = { @@ -122,7 +122,7 @@ function getInitialState() { wood: 60, stone: 60, iron: 60, - food: 50, + food: 60, culture: 0, }, villageTiles: getInitialVillageBoard(), @@ -137,7 +137,7 @@ function getInitialState() { // Create the Town hall. const townhall = createBuilding('townhall'); - townhall.level = 20; + townhall.level = TOWN_HALL_START_LEVEL; 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 = 20; //newBuilding.type === 'field' ? 1 : 10; + newBuilding.level = RESOURCE_BUILDINGS_START_LEVEL; state.outsideTiles[y][x] = newBuilding.id; state.buildings.push(newBuilding); });