- Introduced contentHelpers for table and room template lookups. - Created level1Rooms.ts with various room templates for level 1. - Added level1Tables.ts containing encounter tables for animals, martial, dogs, people, fungal, guards, workers, and room types. - Implemented room generation functions in rooms.ts to create rooms based on templates and tables. - Added tests for room generation logic in rooms.test.ts to ensure correct functionality.
220 lines
4.3 KiB
TypeScript
220 lines
4.3 KiB
TypeScript
import type { ContentReference, DiceKind, RuleEffect } from "./rules";
|
|
|
|
export type TableCategory =
|
|
| "generic"
|
|
| "random-list"
|
|
| "loot"
|
|
| "level"
|
|
| "optional"
|
|
| "town"
|
|
| "room";
|
|
|
|
export type TableEntry = {
|
|
key: string;
|
|
min?: number;
|
|
max?: number;
|
|
exact?: number;
|
|
d66?: number;
|
|
label: string;
|
|
text?: string;
|
|
effects?: RuleEffect[];
|
|
references?: ContentReference[];
|
|
};
|
|
|
|
export type TableDefinition = {
|
|
id: string;
|
|
code: string;
|
|
name: string;
|
|
category: TableCategory;
|
|
level?: number;
|
|
page: number;
|
|
diceKind: DiceKind;
|
|
usesModifiedRangesRule?: boolean;
|
|
entries: TableEntry[];
|
|
notes?: string[];
|
|
mvp: boolean;
|
|
};
|
|
|
|
export type WeaponCategory = "melee" | "ranged";
|
|
|
|
export type WeaponDefinition = {
|
|
id: string;
|
|
name: string;
|
|
category: WeaponCategory;
|
|
handedness: "one-handed" | "two-handed";
|
|
baseDamage: number;
|
|
allowedManoeuvreIds: string[];
|
|
tags: string[];
|
|
startingOption: boolean;
|
|
};
|
|
|
|
export type ManoeuvreDefinition = {
|
|
id: string;
|
|
name: string;
|
|
weaponCategories: WeaponCategory[];
|
|
shiftCost?: number;
|
|
disciplineModifier?: number;
|
|
precisionModifier?: number;
|
|
damageModifier?: number;
|
|
exactStrikeBonus?: boolean;
|
|
interruptRule?: string;
|
|
effectText?: string;
|
|
mvp: boolean;
|
|
};
|
|
|
|
export type ArmourDefinition = {
|
|
id: string;
|
|
name: string;
|
|
armourValue: number;
|
|
penalties?: {
|
|
shift?: number;
|
|
discipline?: number;
|
|
precision?: number;
|
|
};
|
|
deflectionRule?: string;
|
|
startingOption: boolean;
|
|
valueGp?: number;
|
|
mvp: boolean;
|
|
};
|
|
|
|
export type ItemType =
|
|
| "gear"
|
|
| "treasure"
|
|
| "quest"
|
|
| "herb"
|
|
| "rune"
|
|
| "misc"
|
|
| "ration"
|
|
| "light-source";
|
|
|
|
export type ItemDefinition = {
|
|
id: string;
|
|
name: string;
|
|
itemType: ItemType;
|
|
stackable: boolean;
|
|
consumable: boolean;
|
|
valueGp?: number;
|
|
weight?: number;
|
|
rulesText?: string;
|
|
effects?: RuleEffect[];
|
|
mvp: boolean;
|
|
};
|
|
|
|
export type PotionUseTiming = "combat" | "exploration" | "town" | "any";
|
|
|
|
export type PotionDefinition = {
|
|
id: string;
|
|
name: string;
|
|
tableSource: string;
|
|
useTiming: PotionUseTiming;
|
|
effects: RuleEffect[];
|
|
valueGp?: number;
|
|
mvp: boolean;
|
|
};
|
|
|
|
export type ScrollDefinition = {
|
|
id: string;
|
|
name: string;
|
|
tableSource: string;
|
|
castCheck?: {
|
|
diceKind: Extract<DiceKind, "d6" | "2d6">;
|
|
successMin?: number;
|
|
successMax?: number;
|
|
};
|
|
onSuccess: RuleEffect[];
|
|
onFailureTableCode?: string;
|
|
valueGp?: number;
|
|
startingOption: boolean;
|
|
mvp: boolean;
|
|
};
|
|
|
|
export type CreatureDefinition = {
|
|
id: string;
|
|
name: string;
|
|
level: number;
|
|
category: string;
|
|
hp: number;
|
|
attackProfile: {
|
|
discipline: number;
|
|
precision: number;
|
|
damage: number;
|
|
numberAppearing?: string;
|
|
};
|
|
defenceProfile?: {
|
|
armour?: number;
|
|
specialRules?: string[];
|
|
};
|
|
xpReward?: number;
|
|
lootTableCodes?: string[];
|
|
interruptRules?: string[];
|
|
traits?: string[];
|
|
sourcePage: number;
|
|
mvp: boolean;
|
|
};
|
|
|
|
export type ExitType = "open" | "door" | "locked" | "secret" | "shaft" | "stairs";
|
|
|
|
export type ExitTemplate = {
|
|
direction?: "north" | "east" | "south" | "west";
|
|
exitType: ExitType;
|
|
destinationLevel?: number;
|
|
};
|
|
|
|
export type RoomClass = "normal" | "small" | "large" | "special" | "start" | "stairs";
|
|
|
|
export type RoomTemplate = {
|
|
id: string;
|
|
level: number;
|
|
sourcePage?: number;
|
|
roomClass: RoomClass;
|
|
tableCode: string;
|
|
tableEntryKey: string;
|
|
title: string;
|
|
text?: string;
|
|
encounterText?: string;
|
|
exitHint?: string;
|
|
unique?: boolean;
|
|
dimensions?: {
|
|
width: number;
|
|
height: number;
|
|
};
|
|
exits?: ExitTemplate[];
|
|
encounterRefs?: ContentReference[];
|
|
objectRefs?: ContentReference[];
|
|
tags: string[];
|
|
mvp: boolean;
|
|
};
|
|
|
|
export type TownServiceType =
|
|
| "market"
|
|
| "temple"
|
|
| "tavern"
|
|
| "healer"
|
|
| "smith"
|
|
| "quest";
|
|
|
|
export type TownServiceDefinition = {
|
|
id: string;
|
|
name: string;
|
|
serviceType: TownServiceType;
|
|
tableCodes?: string[];
|
|
costRules?: string[];
|
|
effects?: RuleEffect[];
|
|
mvp: boolean;
|
|
};
|
|
|
|
export type ContentPack = {
|
|
version: string;
|
|
sourceBooks: string[];
|
|
tables: TableDefinition[];
|
|
weapons: WeaponDefinition[];
|
|
manoeuvres: ManoeuvreDefinition[];
|
|
armour: ArmourDefinition[];
|
|
items: ItemDefinition[];
|
|
potions: PotionDefinition[];
|
|
scrolls: ScrollDefinition[];
|
|
creatures: CreatureDefinition[];
|
|
roomTemplates: RoomTemplate[];
|
|
townServices: TownServiceDefinition[];
|
|
};
|