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

@ -157,23 +157,40 @@ $equipped = array_values(array_filter($items, static fn ($item) => (int) $item['
<?php endif; ?>
</section>
<section class="panel">
<section class="panel" id="fertigkeiten">
<h2>Fertigkeiten</h2>
<p class="muted" style="margin-top:0">
Die Stufe bestimmt den Würfel: 0 = W4 (ungelernt), 1 = W6, 2 = W8, 3 = W10,
4 = W12, 5 = 2W6, 6+ = 3W6. Die Kästchen sind die Praxispunkte (max. <?= (int) WS_SKILL_PRACTICE_SLOTS ?>).
</p>
<?php if ($skills === []): ?>
<p class="muted">Noch keine Fertigkeiten eingetragen. <a href="<?= e($base . '/edit#fertigkeiten') ?>">Ergänzen</a></p>
<?php else: ?>
<?php foreach (skills_grouped($skills) as $group => $groupSkills): ?>
<h3 class="skill-group"><?= e($group) ?></h3>
<table class="data skill-table">
<thead><tr><th>Fertigkeit</th><th>Attribut</th><th class="num">MOD</th><th class="num">Stufe</th><th>Notiz</th></tr></thead>
<thead><tr><th>Fertigkeit</th><th>Attribut</th><th class="num">MOD</th><th class="num">Stufe</th><th class="num">Würfel</th><th>PP</th><th>Notiz</th></tr></thead>
<tbody>
<?php foreach ($groupSkills as $skill): ?>
<?php $mod = skill_attribute_modifier($character, $skill); ?>
<?php $pp = max(0, min(WS_SKILL_PRACTICE_SLOTS, (int) ($skill['pp'] ?? 0))); ?>
<tr>
<td class="skill-name"><?= e((string) $skill['name']) ?></td>
<td class="muted"><?= e((string) ($skill['attribute'] ?? '')) ?></td>
<td class="num <?= $mod === null ? 'muted' : bonus_class($mod) ?>"><?= $mod === null ? '–' : e(signed($mod)) ?></td>
<td class="num <?= bonus_class((int) $skill['bonus']) ?>"><b><?= max(0, (int) $skill['bonus']) ?></b></td>
<td class="num die"><b><?= e(skill_die((int) $skill['bonus'])) ?></b></td>
<td class="pp-cell">
<form method="post" action="<?= e($base . '/skills/' . (int) $skill['id'] . '/pp') ?>" class="pp-slots" data-pp-form aria-label="Praxispunkte <?= e((string) $skill['name']) ?>">
<?= csrf_field() ?>
<?php for ($slot = 1; $slot <= WS_SKILL_PRACTICE_SLOTS; $slot++): ?>
<button type="submit" name="pp" value="<?= $slot ?>"
class="pp-slot<?= $slot <= $pp ? ' is-filled' : '' ?>"
title="<?= $slot ?> Praxispunkt<?= $slot === 1 ? '' : 'e' ?>"
aria-pressed="<?= $slot <= $pp ? 'true' : 'false' ?>"></button>
<?php endfor; ?>
</form>
</td>
<td class="muted"><?= e((string) $skill['note']) ?></td>
</tr>
<?php endforeach; ?>