V1.1.0: gear levels, encounter overhaul, guided builder, trading, docs
Characters - Builder: pick-then-Next on every step with live preview, Back button, plain-language help throughout, and "Suggest for me" for ability scores - Motivation is picked from a list; new steps for special abilities, background and appearance, all composed from fixed lists and DM-only to edit afterwards - Copy a character to another campaign - Characters can give gold, weapons, items and spells to each other - Money tracker: gold only changes through a logged ledger - Fixes: level/XP/location are DM-only, HP stays within 0..max, physical dice ability rolls, every die is rolled once Gear - DM-managed item pool; weapons, items and spells are handed out by the DM - Starting-option flag per pool entry - Gear levels 1-9 per held copy with a damage ladder, growth rate and starting level; spells gated by spell level with a fixed damage value - Spell library carries default damage; damage is picked from a list Encounters - Battle and NPC quest modes, turn tracking, scene description, DM notes - NPCs, richer combatant cards, conditions from a list - Rewards (gold, weapons, items) lined up and awarded, with gold splitting - Character HP is shared between the sheet and the encounter - Monster stat blocks and NPC secrets are never sent to players Other - Dice roller on every page - Docs for characters, weapons, spells, items, encounters, monsters and NPCs, with full lists generated from the data (npm run docs:lists) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+145
-10
@@ -86,6 +86,9 @@ enum BuildStage {
|
||||
ROLLING_MOTIVATION
|
||||
ASSIGNING_SCORES
|
||||
ASSIGNING_PROFICIENCIES
|
||||
CHOOSING_ABILITIES
|
||||
CHOOSING_BACKGROUND
|
||||
CHOOSING_APPEARANCE
|
||||
CHOOSING_EQUIPMENT
|
||||
COMPLETE
|
||||
}
|
||||
@@ -96,6 +99,25 @@ enum EncounterStatus {
|
||||
COMPLETE
|
||||
}
|
||||
|
||||
// What kind of scene an encounter is: a fight run in initiative order, or a
|
||||
// quest scene built around NPCs and an objective.
|
||||
enum EncounterMode {
|
||||
BATTLE
|
||||
QUEST
|
||||
}
|
||||
|
||||
enum NpcDisposition {
|
||||
FRIENDLY
|
||||
NEUTRAL
|
||||
HOSTILE
|
||||
}
|
||||
|
||||
enum RewardType {
|
||||
GOLD
|
||||
WEAPON
|
||||
ITEM
|
||||
}
|
||||
|
||||
enum NoteVisibility {
|
||||
DM_ONLY
|
||||
SHARED
|
||||
@@ -122,6 +144,7 @@ model User {
|
||||
charactersOwned Character[] @relation("PlayerCharacters")
|
||||
charactersCreated Character[] @relation("CreatedBy")
|
||||
notesAuthored Note[]
|
||||
goldTransactions GoldTransaction[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -143,7 +166,9 @@ model Campaign {
|
||||
characters Character[]
|
||||
weapons Weapon[]
|
||||
spells Spell[]
|
||||
items Item[]
|
||||
monsters Monster[]
|
||||
npcs Npc[]
|
||||
encounters Encounter[]
|
||||
notes Note[]
|
||||
locations Location[]
|
||||
@@ -211,11 +236,13 @@ model Character {
|
||||
armorBonus Int @default(0) // flat AC bonus from equipped armor/shield
|
||||
speedOverride Int?
|
||||
|
||||
specialAbilities String? // free-text list shown in the quick-stats panel
|
||||
// The next three are composed by the builder from the player's picks
|
||||
// (game/data/characterOptions.js). After that only the DM can edit them.
|
||||
specialAbilities String? // shown in the quick-stats panel
|
||||
gold Int @default(0)
|
||||
|
||||
background String? // free-text story background, player-editable
|
||||
appearance String? // free-text character look/description, player-editable
|
||||
background String?
|
||||
appearance String?
|
||||
privateNotes String? // visible to the owning player only — not even the DM
|
||||
|
||||
diceMode DiceMode @default(DIGITAL) // chosen once, before the first build roll
|
||||
@@ -236,6 +263,7 @@ model Character {
|
||||
skillProficiencies CharacterSkillProficiency[]
|
||||
saveProficiencies CharacterSaveProficiency[]
|
||||
inventoryItems InventoryItem[]
|
||||
goldTransactions GoldTransaction[]
|
||||
weapons CharacterWeapon[]
|
||||
spells CharacterSpell[]
|
||||
notes Note[]
|
||||
@@ -283,10 +311,20 @@ model Weapon {
|
||||
properties String[] // e.g. ["finesse", "light", "thrown"]
|
||||
rangeNormal Int?
|
||||
rangeLong Int?
|
||||
// damageDice is the level-1 damage; a held copy's dice climb the damage
|
||||
// ladder (game/calculations.js) by this many rungs per level above 1.
|
||||
damageScaling Int @default(1)
|
||||
// The level this weapon starts at: a held copy is never below it, and
|
||||
// damageDice is the damage at this level.
|
||||
minLevel Int @default(1)
|
||||
// Offered in the character builder's starting-equipment step. Off by default:
|
||||
// the DM opts entries in, so the pool can hold gear that must be earned.
|
||||
isStartingOption Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
|
||||
assigned CharacterWeapon[]
|
||||
rewards EncounterReward[]
|
||||
|
||||
@@map("weapons")
|
||||
}
|
||||
@@ -297,6 +335,7 @@ model CharacterWeapon {
|
||||
weaponId String
|
||||
quantity Int @default(1)
|
||||
equipped Boolean @default(false)
|
||||
level Int @default(1) // this copy's level; the character must be at least this level to use it
|
||||
|
||||
character Character @relation(fields: [characterId], references: [id], onDelete: Cascade)
|
||||
weapon Weapon @relation(fields: [weaponId], references: [id], onDelete: Cascade)
|
||||
@@ -305,19 +344,58 @@ model CharacterWeapon {
|
||||
@@map("character_weapons")
|
||||
}
|
||||
|
||||
// Campaign-level item pool, DM-managed like weapons and spells.
|
||||
model Item {
|
||||
id String @id @default(cuid())
|
||||
campaignId String
|
||||
name String
|
||||
description String?
|
||||
damageDice String? // optional dice (damage, healing...) at its starting level; scales like a weapon's
|
||||
damageScaling Int @default(1)
|
||||
minLevel Int @default(1)
|
||||
isStartingOption Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
|
||||
held InventoryItem[]
|
||||
rewards EncounterReward[]
|
||||
|
||||
@@map("items")
|
||||
}
|
||||
|
||||
// An Item from the campaign pool held by a character.
|
||||
model InventoryItem {
|
||||
id String @id @default(cuid())
|
||||
characterId String
|
||||
name String
|
||||
description String?
|
||||
itemId String
|
||||
quantity Int @default(1)
|
||||
equipped Boolean @default(false)
|
||||
level Int @default(1)
|
||||
|
||||
character Character @relation(fields: [characterId], references: [id], onDelete: Cascade)
|
||||
item Item @relation(fields: [itemId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([characterId, itemId])
|
||||
@@map("inventory_items")
|
||||
}
|
||||
|
||||
// Ledger behind Character.gold: every change to the balance is one row here.
|
||||
model GoldTransaction {
|
||||
id String @id @default(cuid())
|
||||
characterId String
|
||||
amount Int // signed: positive = gained, negative = spent
|
||||
balanceAfter Int
|
||||
reason String?
|
||||
createdById String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
character Character @relation(fields: [characterId], references: [id], onDelete: Cascade)
|
||||
createdBy User? @relation(fields: [createdById], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([characterId, createdAt])
|
||||
@@map("gold_transactions")
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Spells
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -326,12 +404,14 @@ model Spell {
|
||||
id String @id @default(cuid())
|
||||
campaignId String
|
||||
name String
|
||||
level Int // 0 = cantrip
|
||||
level Int // 0 = cantrip. Also the character level needed to use the spell.
|
||||
damageDice String? // fixed; spells don't level up
|
||||
school String?
|
||||
castingTime String?
|
||||
range String?
|
||||
duration String?
|
||||
description String?
|
||||
isStartingOption Boolean @default(false)
|
||||
|
||||
campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
|
||||
known CharacterSpell[]
|
||||
@@ -381,30 +461,84 @@ model Monster {
|
||||
@@map("monsters")
|
||||
}
|
||||
|
||||
// A non-player character the DM runs: a quest-giver, shopkeeper, rival...
|
||||
// Combat stats are optional — most NPCs are there to be talked to.
|
||||
model Npc {
|
||||
id String @id @default(cuid())
|
||||
campaignId String
|
||||
name String
|
||||
role String? // e.g. "Innkeeper", "Captain of the Watch"
|
||||
disposition NpcDisposition @default(NEUTRAL)
|
||||
description String? // what the party can see and knows
|
||||
dmNotes String? // secrets, motives — never sent to players
|
||||
ac Int?
|
||||
maxHp Int?
|
||||
attackBonus Int?
|
||||
damageDice String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
|
||||
encounterAppearances EncounterParticipant[]
|
||||
|
||||
@@map("npcs")
|
||||
}
|
||||
|
||||
model Encounter {
|
||||
id String @id @default(cuid())
|
||||
campaignId String
|
||||
name String
|
||||
mode EncounterMode @default(BATTLE)
|
||||
status EncounterStatus @default(PLANNING)
|
||||
currentRound Int @default(1)
|
||||
// Whose turn it is in a battle; null until the fight starts.
|
||||
activeParticipantId String?
|
||||
description String? // the scene / objective, shown to everyone
|
||||
dmNotes String? // never sent to players
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
|
||||
participants EncounterParticipant[]
|
||||
rewards EncounterReward[]
|
||||
|
||||
@@map("encounters")
|
||||
}
|
||||
|
||||
// A row per combatant in an encounter — either a character or a monster.
|
||||
// currentHp/maxHp are snapshotted here (not just read off Character/Monster)
|
||||
// so damage tracking during a fight doesn't need to mutate the character's or
|
||||
// monster's permanent record until the DM chooses to apply it back.
|
||||
// Loot the DM lines up for an encounter and later hands to a character. Until
|
||||
// it is awarded it is the DM's secret; awarding it is what actually changes
|
||||
// the character (gold ledger entry, or the weapon/item added to what they hold).
|
||||
model EncounterReward {
|
||||
id String @id @default(cuid())
|
||||
encounterId String
|
||||
type RewardType
|
||||
gold Int? // GOLD
|
||||
weaponId String? // WEAPON
|
||||
itemId String? // ITEM
|
||||
quantity Int @default(1)
|
||||
level Int @default(1) // gear level the weapon/item is handed over at
|
||||
note String?
|
||||
awardedTo String? // who received it, as display text ("Aria", "Aria, Bo")
|
||||
awardedAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
encounter Encounter @relation(fields: [encounterId], references: [id], onDelete: Cascade)
|
||||
weapon Weapon? @relation(fields: [weaponId], references: [id], onDelete: Cascade)
|
||||
item Item? @relation(fields: [itemId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("encounter_rewards")
|
||||
}
|
||||
|
||||
// A row per combatant in an encounter — a character, a monster or an NPC.
|
||||
// A monster's currentHp/maxHp live here, per instance. A character's HP has
|
||||
// one source of truth, the Character row: encounters read and write that, and
|
||||
// the columns here only hold the last values seen (used if the character is
|
||||
// later deleted and the row loses its link).
|
||||
model EncounterParticipant {
|
||||
id String @id @default(cuid())
|
||||
encounterId String
|
||||
characterId String?
|
||||
monsterId String?
|
||||
npcId String?
|
||||
displayName String // denormalized so a monster can be renamed per-instance, e.g. "Goblin #2"
|
||||
initiative Int @default(0)
|
||||
currentHp Int
|
||||
@@ -415,6 +549,7 @@ model EncounterParticipant {
|
||||
encounter Encounter @relation(fields: [encounterId], references: [id], onDelete: Cascade)
|
||||
character Character? @relation(fields: [characterId], references: [id], onDelete: SetNull)
|
||||
monster Monster? @relation(fields: [monsterId], references: [id], onDelete: SetNull)
|
||||
npc Npc? @relation(fields: [npcId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@map("encounter_participants")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user