diff --git a/backend/package.json b/backend/package.json index 2089263..715b005 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "backend", - "version": "1.8.0", + "version": "1.8.1", "private": true, "type": "commonjs", "main": "src/index.js", diff --git a/docs/ENCOUNTERS.md b/docs/ENCOUNTERS.md index 8bfebfe..fe94cf9 100644 --- a/docs/ENCOUNTERS.md +++ b/docs/ENCOUNTERS.md @@ -46,7 +46,7 @@ time from the top of the page. | | Battle | NPC quest | |---|---|---| | For | A fight | A scene built around people and an objective | -| Layout | Everyone in one list, in initiative order | Three groups: "People you meet", "The party", "Creatures" | +| Layout | Everyone in one list, in initiative order; once in progress, those who have had their turn move to "Next Round" at the bottom | Three groups: "People you meet", "The party", "Creatures" | | Rounds and turns | Yes | No | | Initiative | The d20 roll, typed in per combatant; the bonus is added | The same; each group lists highest first | | Start button | Begin Battle | Begin Quest | @@ -247,6 +247,13 @@ battles only. combatant it returns to the top and the **round** goes up by one. - **Next Round** skips straight to the top of the next round. - Anyone out of the fight (section 6, "The fallen") is passed over. +- **The list follows the turn.** While a battle is in progress, whoever is on + turn is at the top of "Initiative order" with those still to act this round + beneath them. Each combatant whose turn has passed moves down to a **Next + Round** section at the bottom, still in initiative order. When the round + rolls over everyone is back in "Initiative order". Everyone sees the same + arrangement. Before the battle begins, and once it is complete, it is one + plain list. ### Targets diff --git a/frontend/package.json b/frontend/package.json index a1df1e1..def34a7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "frontend", "private": true, - "version": "1.8.0", + "version": "1.8.1", "type": "module", "scripts": { "dev": "vite", diff --git a/frontend/src/pages/EncounterPage.tsx b/frontend/src/pages/EncounterPage.tsx index c29132a..8f9c1c2 100644 --- a/frontend/src/pages/EncounterPage.tsx +++ b/frontend/src/pages/EncounterPage.tsx @@ -927,10 +927,20 @@ export function EncounterPage() { /> ); + // In a battle under way the turn passes down the initiative order, so + // everyone above whoever is on turn has had their go this round. They drop + // to "Next Round" at the bottom, which leaves the combatant on turn at the + // top with those still to act beneath them. A new round puts everyone back. + const turnIndex = active ? participants.indexOf(active) : -1; + const hasActed = (p: EncounterParticipant) => participants.indexOf(p) < turnIndex; + // A quest scene is grouped by who is there; within each group the order is // still initiative, highest first. const groups: [string, EncounterParticipant[]][] = isBattle - ? [['Initiative order', standing]] + ? [ + ['Initiative order', standing.filter((p) => !hasActed(p))], + ['Next Round', standing.filter(hasActed)], + ] : [ ['People you meet', standing.filter((p) => p.kind === 'NPC')], ['The party', standing.filter((p) => p.kind === 'CHARACTER')], diff --git a/package-lock.json b/package-lock.json index eec9cf2..6adbca5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,19 @@ { "name": "dnd-campaign-manager", - "version": "1.8.0", + "version": "1.8.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dnd-campaign-manager", - "version": "1.8.0", + "version": "1.8.1", "workspaces": [ "backend", "frontend" ] }, "backend": { - "version": "1.8.0", + "version": "1.8.1", "dependencies": { "@prisma/client": "^5.20.0", "bcrypt": "^5.1.1", @@ -31,7 +31,7 @@ } }, "frontend": { - "version": "1.8.0", + "version": "1.8.1", "dependencies": { "@tanstack/react-query": "^5.103.2", "axios": "^1.20.0", diff --git a/package.json b/package.json index 3b4a69d..78c82b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dnd-campaign-manager", - "version": "1.8.0", + "version": "1.8.1", "private": true, "description": "D&D 5e campaign manager — monorepo root", "workspaces": [