V1.27.0: battles that run themselves: track, targets, hit or miss, saves, auto-rolls

- Turn-order track: names coloured by PC, NPC or monster, this round, a flag
  where it ends, and the next round
- Target by clicking a name on the track, the card, or keys 1-9; whoever is
  on turn and every target show what they have in hand
- Attacks and spells are declared, rolled and applied: type or roll the d20
  and the app says hit, miss or critical; a save spell asks each target for
  its save against the caster's DC; the DM overrules anything and applies
- Critical damage by the campaign's rule; a spell spends its slot; a
  concentration save is called for
- Auto-rolled monster and NPC attacks: aimed (weighted), rolled, and offered
  to the DM to accept, edit or discard; hidden from players until accepted
- Monsters can have named attacks and multiattacks; spells say how they land
- A "What now" line tells the DM (and each player) what the scene waits on

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 09:14:04 +02:00
co-authored by Claude Opus 5.5
parent 8811f14732
commit 9b3637576d
29 changed files with 2693 additions and 38 deletions
+269 -4
View File
@@ -875,6 +875,273 @@ input[type='radio'] {
}
}
/* ---------------------------------------------------------------------- */
/* The battle: the turn-order track, the DM's cue, and attacks being */
/* resolved (components/encounter/*.tsx). */
/* ---------------------------------------------------------------------- */
/* Who acts when, as one line of names: this round, a flag, the next round. */
.initiative-track {
position: sticky;
top: 3.6rem;
z-index: 25;
display: flex;
align-items: center;
gap: 0.35rem;
overflow-x: auto;
margin: 0 -0.25rem 0.75rem;
padding: 0.5rem 0.25rem;
background: var(--bg);
border-bottom: 1px solid var(--border-soft);
scrollbar-width: thin;
}
.track-round,
.track-flag {
flex: 0 0 auto;
font-family: var(--font-display);
font-size: 0.72rem;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--text-dim);
white-space: nowrap;
}
.track-flag {
padding: 0.2rem 0.6rem;
margin: 0 0.25rem;
border-left: 2px dashed var(--accent);
border-right: 2px dashed var(--accent);
color: var(--accent-strong);
}
.track-chip {
flex: 0 0 auto;
padding: 0.3rem 0.7rem;
border-radius: 999px;
border: 1px solid transparent;
border-left-width: 5px;
background: var(--bg-inset);
color: var(--text);
font-family: var(--font-body);
font-size: 0.9rem;
white-space: nowrap;
cursor: pointer;
transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.track-chip:hover {
transform: translateY(-1px);
}
/* What they are, by colour: a player character, an NPC, a monster. */
.track-pc {
border-color: var(--arcane-strong);
background: rgba(92, 127, 176, 0.16);
}
.track-npc {
border-color: var(--success-strong);
background: rgba(95, 138, 79, 0.16);
}
.track-monster {
border-color: var(--danger-strong);
background: rgba(178, 58, 58, 0.16);
}
.track-chip.is-active {
font-family: var(--font-display);
font-size: 1.05rem;
font-weight: 700;
padding: 0.4rem 0.9rem;
box-shadow: 0 0 0 2px var(--accent-strong), 0 0 14px rgba(201, 162, 39, 0.35);
}
.track-chip.is-targeted {
box-shadow: 0 0 0 2px var(--danger-strong);
}
.track-chip.is-upcoming {
opacity: 0.6;
}
.track-chip.is-dying {
text-decoration: line-through;
text-decoration-color: var(--danger-strong);
}
.track-legend {
flex: 0 0 auto;
display: flex;
align-items: center;
gap: 0.3rem;
margin-left: 0.75rem;
font-size: 0.72rem;
color: var(--text-dim);
white-space: nowrap;
}
.track-dot {
display: inline-block;
width: 0.7rem;
height: 0.7rem;
border-radius: 50%;
border: 2px solid;
margin-left: 0.4rem;
}
/* What the scene is waiting on, in a sentence. */
.cue-card {
display: flex;
flex-wrap: wrap;
align-items: baseline;
gap: 0.6rem;
padding: 0.55rem 0.9rem;
border-left: 4px solid var(--accent);
}
.cue-card.is-urgent {
border-color: var(--accent-strong);
box-shadow: 0 0 14px rgba(201, 162, 39, 0.2);
}
.cue-label {
font-family: var(--font-display);
font-size: 0.72rem;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--accent-strong);
}
.cue-keys {
margin-left: auto;
font-size: 0.75rem;
}
/* An attack or a spell being resolved. */
.action-card {
border-color: var(--accent);
border-left-width: 4px;
}
.action-card.is-auto {
border-color: var(--danger-strong);
}
.action-card.is-ready {
box-shadow: 0 0 14px rgba(122, 178, 102, 0.25);
}
.action-title {
font-family: var(--font-display);
font-size: 1.05rem;
}
.action-target {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.6rem;
margin-top: 0.5rem;
padding-top: 0.5rem;
border-top: 1px solid var(--border-soft);
}
.action-target-name {
font-family: var(--font-display);
min-width: 7rem;
}
.action-roll {
display: inline-flex;
align-items: center;
gap: 0.4rem;
}
.action-outcome {
font-family: var(--font-display);
font-size: 0.85rem;
font-weight: 700;
letter-spacing: 0.05em;
padding: 0.15rem 0.6rem;
border-radius: 999px;
border: 1px solid var(--border);
}
.action-outcome.is-hit {
color: var(--danger-strong);
border-color: var(--danger-strong);
background: var(--danger-soft);
}
.action-outcome.is-crit {
color: #1a140a;
border-color: var(--accent-strong);
background: var(--accent-strong);
}
.action-outcome.is-miss,
.action-outcome.is-saved {
color: var(--text-muted);
background: var(--bg-inset);
}
.action-outcome.is-waiting {
color: var(--text-dim);
border-style: dashed;
font-weight: 400;
}
.action-damage {
font-family: var(--font-display);
font-weight: 700;
color: var(--danger-strong);
}
.action-overrule {
display: inline-flex;
align-items: center;
gap: 0.25rem;
margin-left: auto;
}
.action-overrule .btn.is-on,
.action-option.is-on {
border-color: var(--accent-strong);
color: var(--accent-strong);
background: var(--accent-soft);
}
.action-damage-roll {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5rem;
margin-top: 0.5rem;
}
.action-damage-roll strong {
font-size: 1.3rem;
color: var(--accent-strong);
}
.action-options {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
gap: 0.4rem;
margin-top: 0.5rem;
}
.action-option {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 0.1rem;
text-align: left;
padding: 0.4rem 0.6rem;
}
.action-option-name {
font-family: var(--font-display);
}
/* The equipped weapon stands out among what can be attacked with. */
.action-option.is-equipped {
border-color: var(--accent-strong);
box-shadow: inset 3px 0 0 var(--accent-strong);
}
/* What whoever is on turn (and anyone targeted) is fighting with. */
.in-hand {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.4rem;
margin-top: 0.5rem;
padding: 0.35rem 0.6rem;
border: 1px solid var(--accent-strong);
border-radius: 6px;
background: var(--accent-soft);
}
.in-hand-label {
font-size: 0.68rem;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--accent-strong);
}
.in-hand-weapon {
font-family: var(--font-display);
font-size: 0.92rem;
}
.in-hand-weapon .mono {
font-size: 0.8rem;
color: var(--text-muted);
}
/* Quick stats drawer */
.drawer-backdrop {
position: fixed;
@@ -1175,11 +1442,9 @@ table.data-table tbody tr:hover {
border-color: var(--danger);
}
/* The DM's attack bar stays in reach while scrolling the initiative order. */
/* The DM's quick damage bar. (Attacks being resolved sit above it, so it no
longer follows the scroll.) */
.attack-bar {
position: sticky;
top: 4.5rem;
z-index: 20;
border-color: var(--danger-strong);
}
.attack-target {