Make debug easier by pushing config to the constants file.

This commit is contained in:
Adrian 2024-12-21 12:35:13 +01:00
parent 4151e68b10
commit 58c6d910bb
2 changed files with 8 additions and 4 deletions

View File

@ -1,3 +1,7 @@
export const CULTURE_TO_WIN = 20000; export const CULTURE_TO_WIN = 20000;
export const WORLD_MAP_HEIGHT = 9; export const WORLD_MAP_HEIGHT = 9;
export const WORLD_MAP_WIDTH = 9; export const WORLD_MAP_WIDTH = 9;
// Debug values.
export const TOWN_HALL_START_LEVEL = 1;
export const RESOURCE_BUILDINGS_START_LEVEL = 1;

View File

@ -5,7 +5,7 @@ import worldmap from "./data/worldmap";
import { getTilesAtDistance, Hex } from "./hexgrid"; import { getTilesAtDistance, Hex } from "./hexgrid";
import { WORLDMAP_TYPES, type BuildingType, type CostType, type HeroType, type QuestType, type RegionType, type ResourcesType } from "./types"; 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 { 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 = { type Board = {
@ -122,7 +122,7 @@ function getInitialState() {
wood: 60, wood: 60,
stone: 60, stone: 60,
iron: 60, iron: 60,
food: 50, food: 60,
culture: 0, culture: 0,
}, },
villageTiles: getInitialVillageBoard(), villageTiles: getInitialVillageBoard(),
@ -137,7 +137,7 @@ function getInitialState() {
// Create the Town hall. // Create the Town hall.
const townhall = createBuilding('townhall'); const townhall = createBuilding('townhall');
townhall.level = 20; townhall.level = TOWN_HALL_START_LEVEL;
state.villageTiles[0][0] = townhall.id; state.villageTiles[0][0] = townhall.id;
state.buildings.push(townhall); state.buildings.push(townhall);
@ -160,7 +160,7 @@ function getInitialState() {
} }
const newBuilding = createBuilding(type); const newBuilding = createBuilding(type);
newBuilding.tile = new Hex(x, y); 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.outsideTiles[y][x] = newBuilding.id;
state.buildings.push(newBuilding); state.buildings.push(newBuilding);
}); });