Trefferpunkte aus Einzelwuerfen berechnen (1W4 + 1W je Stufe + KON)

This commit is contained in:
torsten 2026-11-22 19:00:31 +01:00
parent 216a62191e
commit 6a6ce7b197
11 changed files with 277 additions and 11 deletions

View file

@ -146,7 +146,7 @@ function character_pdf(array $c, array $extra): string
/* ---------------------------------------------------------- Attribute */
$sectionTitle('Attribute');
$boxW = 60.0;
$boxH = 54.0;
$boxH = 64.0;
$gap = 6.0;
$x = $M;
foreach (WS_ATTRIBUTES as $field => [$short, $label]) {
@ -162,17 +162,20 @@ 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'] . ' / ' . (int) $c['hp_max']],
['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 = 12.0;
$rowStep = 11.0;
foreach ($combatRows as $i => [$label, $value]) {
$pdf->text($combatX + 7, $ry, 7.0, 'F1', $soft, $label);
$pdf->textRight($combatX + $combatW - 7, $ry, 9, 'F2', $ink, $value);
$pdf->textRight($combatX + $combatW - 7, $ry, $i === 1 ? 8 : 9, 'F2', $i === 1 ? $soft : $ink, $value);
$ry += $rowStep;
}
$y += $boxH + 6;