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

@ -55,14 +55,30 @@
</div>
<div class="grid-4">
<?php $hp = hp_breakdown($values); ?>
<label class="field">
<span>TP aktuell</span>
<input type="number" name="hp_current" value="<?= (int) $values['hp_current'] ?>">
</label>
<label class="field">
<span>TP maximal</span>
<input type="number" name="hp_max" min="1" value="<?= (int) $values['hp_max'] ?>">
<span>TP maximal <small class="muted">(berechnet)</small></span>
<input type="text" data-hp-total value="<?= (int) $hp['total'] ?>" readonly
title="1W<?= (int) WS_HP_LEVEL0_DIE ?> (Stufe 0) + 1W<?= (int) $hp['die'] ?> je Stufe + Konstitutionsbonus">
<small class="muted">
1W<?= (int) WS_HP_LEVEL0_DIE ?> + <?= (int) $hp['level'] ?>× 1W<?= (int) $hp['die'] ?> <?= e(signed((int) $hp['con'])) ?> KON
</small>
</label>
<div class="field" style="grid-column: span 2;">
<span>Trefferwürfe <small class="muted">Stufe 0 (1W<?= (int) WS_HP_LEVEL0_DIE ?>), dann Stufe 1 … <?= (int) $hp['level'] ?></small></span>
<div style="display:flex; gap:.4rem; align-items:center;">
<input type="text" name="hp_rolls" data-hp-rolls value="<?= e(hp_rolls_format(hp_rolls_parse($values['hp_rolls']))) ?>"
inputmode="numeric" placeholder="z. B. 3 7 5 2" style="flex:1 1 auto; min-width:0;"
data-hp-die="<?= (int) $hp['die'] ?>" data-hp-base="<?= (int) WS_HP_LEVEL0_DIE ?>"
data-hp-slots="<?= (int) $hp['slots'] ?>" data-hp-con="<?= (int) $hp['con'] ?>">
<button class="btn" type="button" data-hp-roll title="Fehlende Würfe auswürfeln">Würfeln</button>
</div>
<small class="muted" data-hp-label><?= e(hp_rolls_label($values)) ?> = <?= (int) $hp['total'] ?></small>
</div>
<label class="field">
<span>Rüstungsklasse (leer = automatisch)</span>
<input type="number" name="ac" value="<?= $values['ac'] === null ? '' : (int) $values['ac'] ?>"