Charakterverwalter: Fertigkeiten-Attribut für eigene Einträge, Stufe ohne Vorzeichen

- eigenedefinierte Fertigkeiten bekommen ein Bezugsattribut (STR…CHA) im
  Selektor und lassen es im Bearbeiten-Abschnitt korrigieren
- neue Spalte character_skills.attribute (Migration 2, schema.sql angepasst);
  character_skills() nutzt COALESCE aus Zeilen- und Katalogattribut
- Fertigkeitsstufe startet bei max(0, Attributsbonus) und wird in Formular,
  Update und Anzeige (Web-Bogen, PDF) nie negativ bzw. nie mit Vorzeichen gezeigt
- MOD- und Stufe-Spalte im Bogen auf gemeinsame Grundlinie gezogen
This commit is contained in:
torsten 2026-11-21 14:05:51 +01:00
parent b4d4c53dd4
commit 929aa52c73
10 changed files with 86 additions and 30 deletions

View file

@ -69,9 +69,17 @@ uksort($grouped, static function (string $a, string $b) use ($order): int {
<span>Name</span>
<input type="text" name="name" maxlength="80" placeholder="z. B. Kochen" required>
</label>
<label class="field" style="max-width:8rem">
<span>Attribut</span>
<select name="attribute">
<?php foreach (WS_ATTRIBUTES as [$short, $label]): ?>
<option value="<?= e($short) ?>"><?= e($short) ?> · <?= e($label) ?></option>
<?php endforeach; ?>
</select>
</label>
<label class="field" style="max-width:7rem">
<span>Bonus</span>
<input type="number" name="bonus" value="0" min="-10" max="20">
<span>Stufe</span>
<input type="number" name="bonus" value="0" min="0" max="20">
</label>
<label class="field grow">
<span>Notiz</span>

View file

@ -87,7 +87,8 @@ $base = url('/characters/' . $cid);
<section class="panel" id="fertigkeiten">
<h2>Fertigkeiten</h2>
<p class="muted">
Startwert jeder Fertigkeit ist der Attributsbonus (Fertigkeitsstufe, Hausregel V1.1);
Startwert jeder Fertigkeit ist der Attributsbonus (Fertigkeitsstufe, Hausregel V1.1),
mindestens jedoch 0 – ein negativer Attributsmodifikator drückt die Stufe nie unter 0.
Steigerungen trägst du rechts ein. Eigene Fertigkeiten sind zusätzlich erlaubt.
</p>
<form method="post" action="<?= e($base . '/skills/reset') ?>" class="inline-form" style="margin-bottom:.8rem">
@ -124,9 +125,19 @@ $base = url('/characters/' . $cid);
<div class="inline-form">
<form method="post" action="<?= e($base . '/skills/' . (int) $skill['id']) ?>" class="inline-form">
<?= csrf_field() ?>
<?php if ((int) ($skill['skill_id'] ?? 0) === 0): ?>
<label class="field" style="max-width:8rem">
<span class="visually-quiet">Attribut</span>
<select name="attribute">
<?php foreach (WS_ATTRIBUTES as [$short, $label]): ?>
<option value="<?= e($short) ?>"<?= strtoupper(trim((string) ($skill['attribute'] ?? ''))) === $short ? ' selected' : '' ?>><?= e($short) ?> · <?= e($label) ?></option>
<?php endforeach; ?>
</select>
</label>
<?php endif; ?>
<label class="field" style="max-width:6rem">
<span class="visually-quiet">Stufe</span>
<input type="number" name="bonus" value="<?= (int) $skill['bonus'] ?>" min="-10" max="30">
<input type="number" name="bonus" value="<?= (int) $skill['bonus'] ?>" min="0" max="30">
</label>
<label class="field grow">
<span class="visually-quiet">Notiz</span>

View file

@ -169,7 +169,7 @@ $equipped = array_values(array_filter($items, static fn ($item) => (int) $item['
<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><?= e(signed((int) $skill['bonus'])) ?></b></td>
<td class="num <?= bonus_class((int) $skill['bonus']) ?>"><b><?= max(0, (int) $skill['bonus']) ?></b></td>
<td class="muted"><?= e((string) $skill['note']) ?></td>
</tr>
<?php endforeach; ?>