From f427f4e2b6d360c07d25242719a892827cc45aef Mon Sep 17 00:00:00 2001 From: Adrian Gaudebert Date: Tue, 5 Nov 2024 12:44:24 +0100 Subject: [PATCH] Move the amount of culture to reach to win into a constant. --- src/constants.ts | 1 + src/update.ts | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 src/constants.ts diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..782c886 --- /dev/null +++ b/src/constants.ts @@ -0,0 +1 @@ +export const CULTURE_TO_WIN = 20000; diff --git a/src/update.ts b/src/update.ts index 137f6a7..544ad4b 100644 --- a/src/update.ts +++ b/src/update.ts @@ -1,8 +1,9 @@ import { produce } from 'immer'; -import { getBuilding, getProduction, getStorage, getUnitSource, shuffle } from './utils'; -import village, { type VillageState } from "./village"; +import { CULTURE_TO_WIN } from './constants'; import type { ProductionType } from './types'; +import { getProduction, getStorage, shuffle } from './utils'; +import village, { type VillageState } from "./village"; let lastFrame: number; @@ -84,7 +85,7 @@ export default function update(timestamp: number) { }); // Check if the game is won. - if (V.resources.culture >= 2000) { + if (V.resources.culture >= CULTURE_TO_WIN) { V.victory = true; }