diff --git a/westreiche_website/app/sheet.php b/westreiche_website/app/sheet.php index f6a78fa..ef4aa9b 100644 --- a/westreiche_website/app/sheet.php +++ b/westreiche_website/app/sheet.php @@ -162,24 +162,64 @@ function character_pdf(array $c, array $extra): string $combatX = $x + 4; $combatW = $W - $M - $combatX; $pdf->rect($combatX, $y, $combatW, $boxH, null, $gold, 0.6); - // Trefferpunkte: Maximum ist aus den Einzelwürfen berechnet, die Würfe - // stehen als eigene Zeile daneben (Nachwürfeln = Zeile korrigieren). $combatRows = [ - ['Trefferpunkte', (int) $c['hp_current'] . ' / ' . hp_max_for($c)], - ['Trefferwürfe', WsPdf::fit(hp_rolls_label($c), 8, 'F2', $combatW - 42)], ['Rüstungsklasse', (string) (int) ($extra['ac']['total'] ?? 10)], ['Angriff', signed((int) $c['attack_bonus'])], ['Gold', (int) $c['gold_coins'] . ' GM'], ]; - $ry = $y + 12; - $rowStep = 11.0; - foreach ($combatRows as $i => [$label, $value]) { + $ry = $y + 14; + $rowStep = 12.0; + foreach ($combatRows as [$label, $value]) { $pdf->text($combatX + 7, $ry, 7.0, 'F1', $soft, $label); - $pdf->textRight($combatX + $combatW - 7, $ry, $i === 1 ? 8 : 9, 'F2', $i === 1 ? $soft : $ink, $value); + $pdf->textRight($combatX + $combatW - 7, $ry, 9, 'F2', $ink, $value); $ry += $rowStep; } $y += $boxH + 6; + /* ----------------------------------------------------- Trefferpunkte */ + // Eigene Zeile: berechnetes Maximum, die Einzelwürfe je Stufe und ein + // leeres Kästchen, in das der Spieler die aktuellen TP einträgt. + $hp = hp_breakdown($c); + $sectionTitle('Trefferpunkte'); + $ensure(50); + $hpRowH = 30.0; + $maxW = 34.0; + $curW = 72.0; + $pdf->rect($M, $y, $maxW, $hpRowH, $parchment2, $gold, 0.5); + $pdf->textCenter($M + $maxW / 2, $y + 8, 6.2, 'F1', $soft, 'MAXIMUM'); + $pdf->textCenter($M + $maxW / 2, $y + 23, 15, 'F4', $ink, (string) $hp['total']); + + $curX = $M + $inner - $curW; + $pdf->rect($curX, $y, $curW, $hpRowH, null, $gold, 0.8); + $pdf->textCenter($curX + $curW / 2, $y + 8, 6.2, 'F1', $soft, 'AKTUELL'); + $pdf->line($curX + 8, $y + 13, $curX + $curW - 8, $y + 13, $goldLight, 0.3); + + // Würfelzellen: Stufe 0 (1W4), dann eine Zelle je Stufenwurf + $slotCount = 1 + count($hp['rolls']); + $cellsX = $M + $maxW + 6; + $cellsW = $curX - 6 - $cellsX; + $cellGap = 3.0; + $cellW = min(26.0, max(9.0, ($cellsW - ($slotCount - 1) * $cellGap) / max(1, $slotCount))); + $cx = $cellsX; + $slotValues = array_merge([$hp['base']], $hp['rolls']); + foreach ($slotValues as $slot => $value) { + $die = $slot === 0 ? WS_HP_LEVEL0_DIE : $hp['die']; + $pdf->rect($cx, $y, $cellW, $hpRowH, $parchment2, $goldLight, 0.4); + $pdf->textCenter($cx + $cellW / 2, $y + 7, 5.4, 'F1', $soft, 'ST. ' . $slot); + $pdf->textCenter($cx + $cellW / 2, $y + 13, 5.2, 'F1', $soft, '1W' . $die); + $pdf->textCenter($cx + $cellW / 2, $y + 25, 12, 'F4', $ink, $value === null ? '' : (string) $value); + $cx += $cellW + $cellGap; + } + $y += $hpRowH + 3; + $pdf->text($M, $y + 7, 6.2, 'F1', $soft, WsPdf::fit( + 'Stufe 0: 1W' . WS_HP_LEVEL0_DIE . ' · je Stufe 1W' . $hp['die'] . ' · KON ' + . str_replace('-', '−', signed((int) $hp['con'])) . ' (einmal)', + 6.2, + 'F1', + $inner + )); + $y += 14; + /* ----------------------------------------------------- Rettungswürfe */ $saves = []; foreach (WS_SAVES as $field => $label) { diff --git a/westreiche_website/assets/app.css b/westreiche_website/assets/app.css index af085ef..9caed82 100644 --- a/westreiche_website/assets/app.css +++ b/westreiche_website/assets/app.css @@ -828,7 +828,6 @@ input[type="file"] { font-variant-numeric: tabular-nums; } .hp-sum span { text-transform: none; } -.hp-sum small { color: var(--parchment-dim); font-size: 0.68rem; letter-spacing: 0.1em; } .hp-roll-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); diff --git a/westreiche_website/views/_fields.php b/westreiche_website/views/_fields.php index 030f728..eb7f51c 100644 --- a/westreiche_website/views/_fields.php +++ b/westreiche_website/views/_fields.php @@ -78,7 +78,6 @@ $hpSlotValue = static fn (int $slot): string => ((int) ($hpRolls[$slot] ?? 0)) >