Trefferpunkte: Konstitutionsbonus als eigener Summand in der Rechenkette
This commit is contained in:
parent
38ad53254c
commit
ca27992621
3 changed files with 22 additions and 6 deletions
|
|
@ -511,7 +511,12 @@ function hp_rolls_sum(array $character): string
|
|||
foreach ($info['rolls'] as $value) {
|
||||
$parts[] = $value === null ? '–' : (string) $value;
|
||||
}
|
||||
return implode(' + ', $parts) . ' = ' . (int) $info['total'];
|
||||
$chain = implode(' + ', $parts);
|
||||
if ((int) $info['con'] !== 0) {
|
||||
// Konstitutionsbonus als eigener Summand, damit die Kette aufgeht.
|
||||
$chain .= ((int) $info['con'] > 0 ? ' + ' : ' − ') . abs((int) $info['con']) . ' KON';
|
||||
}
|
||||
return $chain . ' = ' . (int) $info['total'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -527,6 +532,6 @@ function hp_rolls_label(array $character): string
|
|||
$parts = ['1W' . WS_HP_LEVEL0_DIE . ' ' . ($info['base'] ?? '–')];
|
||||
$levelDice = implode(' ', array_map(static fn (?int $v): string => $v === null ? '–' : (string) $v, $info['rolls']));
|
||||
$parts[] = 'W' . $info['die'] . ' ' . ($levelDice === '' ? '–' : $levelDice);
|
||||
$parts[] = 'KON ' . signed((int) $info['con']);
|
||||
$parts[] = 'KON ' . str_replace('-', '−', signed((int) $info['con']));
|
||||
return implode(' · ', $parts);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue