Simplify ranged roll ammunition payload

This commit is contained in:
Dandaedre 2026-09-19 04:20:19 +02:00
parent d954e2827c
commit 70704a0df0
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
5 changed files with 8 additions and 4 deletions

View File

@ -34,6 +34,7 @@
- [x] Publish one build per variant and add a base-only Parchemin/Nuit selector.
- [x] Show burst and automatic damage per successful shot, with the per-success bonus on natural 1s.
- [x] Mark combat rolls with cs1cf10 and all other dice rolls with cs1cfX for the selected die.
- [x] Simplify ranged attack ammunition roll data and expose worker progress in the weapon row.
## Live Roll20 checks after local verification

View File

@ -50,7 +50,9 @@ function d10WeaponAttack(event, mode, ranged) {
`{{attack_roll=[[${dice}d10<${threshold}cs1cf10]]}} {{threshold=[[${threshold}]]}} ` +
`${multipleShots ? '{{damage_list=[[0]]}}' : '{{damage=[[0]]}}'} {{special=${d10Text(get('notes'))}}}` +
(mode === 'single' || mode === 'melee' ? ` {{rmax=${d10Whole(get('rmax')) || 'sans limite'}}}` : '') +
(ranged ? ` {{ammo=${remaining}/${d10Whole(get('magazine_size'))} · chargeurs de réserve ${d10Whole(get('ammo_reserve'))}}}` : '');
(ranged ? ` {{ammo_info=1}} {{ammo=${remaining}}} {{magazine=${d10Whole(get('magazine_size'))}}} ` +
`{{reserve=${d10Whole(get('ammo_reserve'))}}}` : '');
setAttrs({[prefix + 'weapon_status']: 'Jet en cours…'});
startRoll(command, result => {
const successes = d10Whole(result.results.attack_roll.result);
const computed = multipleShots

View File

@ -72,6 +72,7 @@ class BuildTests(unittest.TestCase):
for action in ('fire_single', 'fire_burst', 'fire_auto', 'reload', 'damage_only'):
self.assertIn(f'name="act_{action}"', files['sheet.html'])
self.assertIn('name="attr_ammo_current"', files['sheet.html'])
self.assertIn('<span class="sheet-weapon-status" name="attr_weapon_status"></span>', files['sheet.html'])
self.assertIn('name="attr_damage_per_success"', files['sheet.html'])
self.assertIn('d10<${threshold}cs1cf10', files['sheet.html'])
self.assertEqual(files['sheet.html'].count('name="attr_rmax"'), 2)

View File

@ -87,7 +87,7 @@ for (const variant of ['base', 'cyberpunk']) {
});
handlers.get('clicked:repeating_distance:fire_single')({ sourceAttribute: ranged + 'fire_single' });
assert.match(rolls.at(-1), /\?\{Nombre de dés\|1\}d10<8cs1cf10/);
assert.match(rolls.at(-1), /chargeurs de réserve 3/);
assert.match(rolls.at(-1), /\{\{ammo_info=1\}\} \{\{ammo=4\}\} \{\{magazine=10\}\} \{\{reserve=3\}\}/);
assert.equal(attributes[ranged + 'ammo_current'], 4);
assert.equal(finished.at(-1).computed.damage, 5);
assert.match(rolls.at(-1), /rmax=1/);

View File

@ -273,7 +273,7 @@ def render_weapon_block(block, combat_skills):
actions.append(('damage_only', 'Dégâts'))
parts.append('<div class="sheet-weapon-actions">' + ''.join(
f'<button type="action" name="act_{key}">{label}</button>' for key, label in actions) + '</div>')
parts.append('<output class="sheet-weapon-status" name="attr_weapon_status"></output></div></fieldset>')
parts.append('<span class="sheet-weapon-status" name="attr_weapon_status"></span></div></fieldset>')
return ''.join(parts)
@ -456,7 +456,7 @@ def render(model, skills, variant, theme_name, theme, themes, asset_base_url='')
<div class="sheet-roll-values"><span>Réussites</span><span class="sheet-roll-value">{{#attack_roll}}{{attack_roll}}{{/attack_roll}}{{#damage_roll}}{{damage_roll}}{{/damage_roll}}</span>{{#damage}}<span>Dégâts</span><span class="sheet-roll-value">{{computed::damage}}</span>{{/damage}}{{#damage_list}}<span>Dégâts par tir</span><span class="sheet-roll-value sheet-roll-damage-list">{{computed::damage_list}}</span>{{/damage_list}}</div>
{{#threshold}}<div class="sheet-roll-detail">Seuil : {{threshold}}</div>{{/threshold}}
{{#rmax}}<div class="sheet-roll-detail">Rmax : {{rmax}}</div>{{/rmax}}
{{#ammo}}<div class="sheet-roll-detail">Chargeur : {{ammo}}</div>{{/ammo}}
{{#ammo_info}}<div class="sheet-roll-detail">Chargeur : {{ammo}} / {{magazine}} · chargeurs de réserve : {{reserve}}</div>{{/ammo_info}}
{{#special}}<div class="sheet-roll-detail">{{special}}</div>{{/special}}
</rolltemplate>
'''