Fertigkeiten: Praxispunkte (10 Kaestchen) und Wuergel je Fertigkeitsstufe in Bogen und PDF

This commit is contained in:
torsten 2026-11-22 19:31:30 +01:00
parent 3a5d366aba
commit 85fd24a0f0
10 changed files with 185 additions and 7 deletions

View file

@ -334,19 +334,37 @@ function character_pdf(array $c, array $extra): string
$skill = $rows[$index];
$cx = $M + $col * ($colW + 16);
$mod = skill_attribute_modifier($c, $skill);
$right = $cx + $colW;
$skillName = shorten((string) $skill['name'], 34);
$pdf->text($cx, $y + 8.5, 8.4, 'F3', $ink, $skillName);
$skillNote = trim((string) ($skill['note'] ?? ''));
if ($skillNote !== '') {
$noteX = $cx + WsPdf::textWidth($skillName, 8.4, 'F3') + 6;
$noteLimit = $cx + $colW - 84;
$noteLimit = $right - 128;
if ($noteLimit - $noteX > 26) {
$pdf->text($noteX, $y + 8.4, 6.8, 'F1', $soft, WsPdf::fit($skillNote, 6.8, 'F1', $noteLimit - $noteX));
}
}
$pdf->text($cx + $colW - 64, $y + 8.2, 6.6, 'F1', $soft, trim((string) ($skill['attribute'] ?? '')));
$pdf->textRight($cx + $colW - 28, $y + 8.2, 6.8, 'F1', $soft, $mod === null ? '–' : signed($mod));
$pdf->textRight($cx + $colW, $y + 8.5, 8.4, 'F2', $gold, (string) max(0, (int) $skill['bonus']));
$pdf->textRight($right - 112, $y + 8.2, 6.6, 'F1', $soft, trim((string) ($skill['attribute'] ?? '')));
$pdf->textRight($right - 92, $y + 8.2, 6.8, 'F1', $soft, $mod === null ? '–' : signed($mod));
$pdf->textRight($right - 74, $y + 8.5, 8.4, 'F2', $gold, (string) max(0, (int) $skill['bonus']));
// Würfel der Fertigkeitsstufe (W4 ungelernt … 3W6 Großmeister)
$pdf->textRight($right, $y + 8.3, 7.0, 'F2', $ink, skill_die((int) $skill['bonus']));
// Praxispunkte: 10 ankreuzbare Kästchen
$pp = max(0, min(WS_SKILL_PRACTICE_SLOTS, (int) ($skill['pp'] ?? 0)));
$slotW = 4.2;
$slotGap = 0.9;
$slotH = 5.4;
$slotsRight = $right - 22;
$slotsLeft = $slotsRight - (WS_SKILL_PRACTICE_SLOTS * $slotW + (WS_SKILL_PRACTICE_SLOTS - 1) * $slotGap);
for ($slot = 1; $slot <= WS_SKILL_PRACTICE_SLOTS; $slot++) {
$sx = $slotsLeft + ($slot - 1) * ($slotW + $slotGap);
if ($slot <= $pp) {
$pdf->rect($sx, $y + 4.6, $slotW, $slotH, $gold, $gold, 0.2);
} else {
$pdf->rect($sx, $y + 4.6, $slotW, $slotH, null, $goldLight, 0.25);
}
}
$pdf->line($cx, $y + 10.4, $cx + $colW, $y + 10.4, $goldLight, 0.22);
}
$y += 12.6;