PDF: TP-Zeile mit GESAMT statt MAXIMUM, AKTUELL-Feld fuellt die restliche Breite
This commit is contained in:
parent
1acb99dc51
commit
4f6acf43d9
1 changed files with 20 additions and 15 deletions
|
|
@ -177,29 +177,28 @@ function character_pdf(array $c, array $extra): string
|
|||
$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.
|
||||
// Eigene Zeile: berechnete Gesamtsumme, die Einzelwürfe je Stufe und ein
|
||||
// großes 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
|
||||
// Das Feld „Aktuell“ füllt den Rest der Zeile aus und behält mindestens
|
||||
// diese Breite; die Würfelzellen davor schrumpfen notfalls.
|
||||
$curMinW = 96.0;
|
||||
$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)));
|
||||
$cellSpace = ($M + $inner - $curMinW - 6 - $cellsX) - ($slotCount - 1) * $cellGap;
|
||||
$cellW = min(26.0, max(9.0, $cellSpace / max(1, $slotCount)));
|
||||
$cellsW = $slotCount * $cellW + ($slotCount - 1) * $cellGap;
|
||||
|
||||
$pdf->rect($M, $y, $maxW, $hpRowH, $parchment2, $gold, 0.5);
|
||||
$pdf->textCenter($M + $maxW / 2, $y + 8, 6.2, 'F1', $soft, 'GESAMT');
|
||||
$pdf->textCenter($M + $maxW / 2, $y + 23, 15, 'F4', $ink, (string) $hp['total']);
|
||||
|
||||
// Würfelzellen: Stufe 0 (1W4), dann eine Zelle je Stufenwurf
|
||||
$cx = $cellsX;
|
||||
$slotValues = array_merge([$hp['base']], $hp['rolls']);
|
||||
foreach ($slotValues as $slot => $value) {
|
||||
|
|
@ -210,6 +209,12 @@ function character_pdf(array $c, array $extra): string
|
|||
$pdf->textCenter($cx + $cellW / 2, $y + 25, 12, 'F4', $ink, $value === null ? '' : (string) $value);
|
||||
$cx += $cellW + $cellGap;
|
||||
}
|
||||
|
||||
$curX = $cellsX + $cellsW + 6;
|
||||
$curW = max($curMinW, $M + $inner - $curX);
|
||||
$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);
|
||||
$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 '
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue