diff --git a/TASKS.md b/TASKS.md index eddf595..1e9dbce 100644 --- a/TASKS.md +++ b/TASKS.md @@ -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 diff --git a/templates/cyberpunk-weapons.js b/templates/cyberpunk-weapons.js index e50f89b..c1180b3 100644 --- a/templates/cyberpunk-weapons.js +++ b/templates/cyberpunk-weapons.js @@ -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 diff --git a/tests/test_build.py b/tests/test_build.py index 9d81d27..0adc183 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -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('', 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) diff --git a/tests/test_tabs.mjs b/tests/test_tabs.mjs index 608f554..9d3d195 100644 --- a/tests/test_tabs.mjs +++ b/tests/test_tabs.mjs @@ -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/); diff --git a/tools/build.py b/tools/build.py index f9e0399..5349947 100644 --- a/tools/build.py +++ b/tools/build.py @@ -273,7 +273,7 @@ def render_weapon_block(block, combat_skills): actions.append(('damage_only', 'Dégâts')) parts.append('