feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
import type { BuildingType, Cost, Resource, Resources, TravelMode, UnitType } from '~/types/game'
|
2026-10-28 16:57:43 +00:00
|
|
|
|
|
|
|
|
// Placeholder numbers so the PoC has something to show. They scale linearly with the
|
|
|
|
|
// level on purpose: the real values and formulas belong to the backend
|
|
|
|
|
// (config/game/buildings.php and app/Game/), not to the client.
|
|
|
|
|
|
|
|
|
|
export interface CatalogEntry {
|
2026-10-28 18:54:19 +00:00
|
|
|
/** Building space an instance takes (0 for the wall). */
|
|
|
|
|
space: number
|
2026-10-28 16:57:43 +00:00
|
|
|
max_per_village: number | null
|
2026-10-28 21:26:50 +00:00
|
|
|
/** Level 1 values. Level n costs, takes, needs and produces n times as much. */
|
2026-10-28 16:57:43 +00:00
|
|
|
cost: Cost
|
|
|
|
|
seconds: number
|
|
|
|
|
workers: number
|
|
|
|
|
production: { resource: Resource; per_hour: number } | null
|
|
|
|
|
capacity?: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const MAX_LEVEL = 30
|
|
|
|
|
export const BUILDERS = 2
|
|
|
|
|
export const BASE_TRICKLE = 5
|
|
|
|
|
export const VILLAGER_UPKEEP = 1
|
|
|
|
|
export const DEMOLISH_REFUND = 0.5
|
|
|
|
|
export const DEFAULT_PRIORITY = 5
|
2026-10-28 21:26:50 +00:00
|
|
|
/** Building space at headquarters level 1, and what each level above adds. */
|
2026-10-28 21:17:33 +00:00
|
|
|
export const MAX_SPACE = 40
|
2026-10-29 15:22:52 +00:00
|
|
|
export const SPACE_PER_HQ_LEVEL = 5
|
2026-10-28 16:57:43 +00:00
|
|
|
export const START_RESOURCES: Resources = { wood: 500, clay: 500, iron: 500, food: 100 }
|
|
|
|
|
|
|
|
|
|
export const CATALOG: Record<BuildingType, CatalogEntry> = {
|
2026-10-28 18:54:19 +00:00
|
|
|
headquarters: { space: 9, max_per_village: 1, cost: { wood: 90, clay: 80, iron: 70 }, seconds: 20, workers: 2, production: null },
|
|
|
|
|
storage: { space: 4, max_per_village: null, cost: { wood: 60, clay: 50, iron: 40 }, seconds: 15, workers: 1, production: null, capacity: 1000 },
|
|
|
|
|
farm: { space: 4, max_per_village: null, cost: { wood: 45, clay: 40, iron: 30 }, seconds: 15, workers: 2, production: { resource: 'food', per_hour: 20 } },
|
|
|
|
|
timber_camp: { space: 4, max_per_village: null, cost: { wood: 50, clay: 60, iron: 40 }, seconds: 12, workers: 2, production: { resource: 'wood', per_hour: 30 } },
|
|
|
|
|
clay_pit: { space: 4, max_per_village: null, cost: { wood: 65, clay: 50, iron: 40 }, seconds: 12, workers: 2, production: { resource: 'clay', per_hour: 30 } },
|
|
|
|
|
iron_mine: { space: 4, max_per_village: null, cost: { wood: 75, clay: 65, iron: 70 }, seconds: 14, workers: 2, production: { resource: 'iron', per_hour: 30 } },
|
|
|
|
|
hiding_place: { space: 1, max_per_village: null, cost: { wood: 50, clay: 60, iron: 50 }, seconds: 10, workers: 0, production: null },
|
|
|
|
|
wall: { space: 0, max_per_village: 1, cost: { wood: 50, clay: 100, iron: 20 }, seconds: 20, workers: 1, production: null },
|
|
|
|
|
rally_point: { space: 1, max_per_village: 1, cost: { wood: 10, clay: 40, iron: 30 }, seconds: 10, workers: 0, production: null },
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
watchtower: { space: 2, max_per_village: 1, cost: { wood: 1200, clay: 1400, iron: 1000 }, seconds: 40, workers: 1, production: null },
|
2026-10-28 20:44:41 +00:00
|
|
|
barracks: { space: 6, max_per_village: null, cost: { wood: 200, clay: 170, iron: 90 }, seconds: 30, workers: 3, production: null },
|
|
|
|
|
stable: { space: 6, max_per_village: null, cost: { wood: 270, clay: 240, iron: 260 }, seconds: 40, workers: 3, production: null },
|
|
|
|
|
workshop: { space: 6, max_per_village: null, cost: { wood: 300, clay: 240, iron: 260 }, seconds: 50, workers: 4, production: null },
|
2026-10-30 12:54:57 +00:00
|
|
|
hospital: { space: 4, max_per_village: null, cost: { wood: 160, clay: 200, iron: 120 }, seconds: 30, workers: 2, production: null },
|
2026-10-28 20:44:41 +00:00
|
|
|
academy: { space: 9, max_per_village: 1, cost: { wood: 1500, clay: 2500, iron: 1000 }, seconds: 60, workers: 5, production: null },
|
2026-10-28 16:57:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const BUILDING_TYPES = Object.keys(CATALOG) as BuildingType[]
|
|
|
|
|
|
2026-10-28 21:26:50 +00:00
|
|
|
export const atLevel = (base: number, level: number) => base * Math.max(level, 1)
|
2026-10-28 20:51:43 +00:00
|
|
|
|
|
|
|
|
export interface UnitEntry {
|
|
|
|
|
building: BuildingType
|
|
|
|
|
cost: Cost
|
|
|
|
|
/** Food per hour, and villagers taken per unit. */
|
|
|
|
|
upkeep: number
|
|
|
|
|
/** Seconds per unit, short so the mock shows progress. */
|
|
|
|
|
seconds: number
|
|
|
|
|
requires: Partial<Record<BuildingType, number>>
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
/** Seconds per map field, short so marches finish while you watch. */
|
|
|
|
|
speed: number
|
|
|
|
|
/** Resources one unit carries home. */
|
|
|
|
|
carry: number
|
|
|
|
|
attack: number
|
|
|
|
|
defense: number
|
2026-10-28 20:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const UNITS: Record<UnitType, UnitEntry> = {
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
spear: { building: 'barracks', cost: { wood: 50, clay: 30, iron: 10 }, upkeep: 1, seconds: 10, requires: {}, speed: 6, carry: 25, attack: 10, defense: 15 },
|
|
|
|
|
sword: { building: 'barracks', cost: { wood: 30, clay: 30, iron: 70 }, upkeep: 1, seconds: 15, requires: {}, speed: 7, carry: 15, attack: 25, defense: 50 },
|
|
|
|
|
archer: { building: 'barracks', cost: { wood: 100, clay: 30, iron: 60 }, upkeep: 1, seconds: 18, requires: { barracks: 3 }, speed: 6, carry: 10, attack: 15, defense: 45 },
|
|
|
|
|
scout: { building: 'stable', cost: { wood: 50, clay: 50, iron: 20 }, upkeep: 2, seconds: 9, requires: {}, speed: 2, carry: 0, attack: 0, defense: 0 },
|
|
|
|
|
light_cavalry: { building: 'stable', cost: { wood: 125, clay: 100, iron: 250 }, upkeep: 3, seconds: 18, requires: {}, speed: 3, carry: 80, attack: 130, defense: 30 },
|
|
|
|
|
heavy_cavalry: { building: 'stable', cost: { wood: 200, clay: 150, iron: 600 }, upkeep: 4, seconds: 36, requires: { stable: 5 }, speed: 4, carry: 50, attack: 150, defense: 200 },
|
|
|
|
|
ram: { building: 'workshop', cost: { wood: 300, clay: 200, iron: 200 }, upkeep: 4, seconds: 48, requires: {}, speed: 10, carry: 0, attack: 2, defense: 20 },
|
|
|
|
|
catapult: { building: 'workshop', cost: { wood: 320, clay: 400, iron: 100 }, upkeep: 6, seconds: 72, requires: { workshop: 2 }, speed: 10, carry: 0, attack: 100, defense: 100 },
|
|
|
|
|
nobleman: { building: 'academy', cost: { wood: 40000, clay: 50000, iron: 50000 }, upkeep: 10, seconds: 108, requires: {}, speed: 12, carry: 0, attack: 30, defense: 100 },
|
2026-10-28 20:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const UNIT_TYPES = Object.keys(UNITS) as UnitType[]
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
|
|
|
|
|
/** Defence of one drafted villager. */
|
|
|
|
|
export const MILITIA_DEFENSE = 5
|
|
|
|
|
|
|
|
|
|
// Rally point placeholders: travel modes, spotting radius, recall window, barbarian stock.
|
|
|
|
|
|
|
|
|
|
export const TRAVEL_MODES: { mode: TravelMode; speed: number; visibility: number }[] = [
|
|
|
|
|
{ mode: 'sneaky', speed: 0.5, visibility: 0 },
|
|
|
|
|
{ mode: 'cautious', speed: 0.8, visibility: 4 },
|
|
|
|
|
{ mode: 'normal', speed: 1, visibility: 15 },
|
|
|
|
|
{ mode: 'fast', speed: 1.25, visibility: 30 },
|
|
|
|
|
{ mode: 'forced', speed: 1.5, visibility: 60 },
|
|
|
|
|
]
|
|
|
|
|
export const DEFAULT_MODE: TravelMode = 'normal'
|
|
|
|
|
/** Fields around a village within which incoming groups are spotted; a watchtower adds its level. */
|
|
|
|
|
export const DETECTION = 2
|
|
|
|
|
/** Seconds after sending during which a command can be called back. */
|
|
|
|
|
export const CANCEL_WINDOW = 600
|
|
|
|
|
/** Wood, clay and iron each in every barbarian village; it never runs out. */
|
|
|
|
|
export const BARBARIAN_STOCK = 1000
|
2026-10-31 09:54:49 +00:00
|
|
|
|
|
|
|
|
/** Each copy of a building type works at this share of the one ranked above it, and costs its inverse as much. */
|
|
|
|
|
export const COPY_SHARE = 0.5
|