From 0b5788b6f628163f521ef71fb546e38cc4233ca0 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sat, 19 Sep 2026 04:33:45 +0200 Subject: [PATCH] Remove ammo data from ranged roll commands --- TASKS.md | 1 + templates/cyberpunk-weapons.js | 7 +++---- tests/test_tabs.mjs | 3 ++- tools/build.py | 1 - 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TASKS.md b/TASKS.md index 1e9dbce..95e8542 100644 --- a/TASKS.md +++ b/TASKS.md @@ -35,6 +35,7 @@ - [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. +- [x] Remove ammunition fields from ranged chat commands while retaining worker-side checks and deductions. ## Live Roll20 checks after local verification diff --git a/templates/cyberpunk-weapons.js b/templates/cyberpunk-weapons.js index c1180b3..b42a81b 100644 --- a/templates/cyberpunk-weapons.js +++ b/templates/cyberpunk-weapons.js @@ -49,9 +49,7 @@ function d10WeaponAttack(event, mode, ranged) { `{{mode=${modeName}}} {{type=${d10Text(get('weapon_type'))}}} ` + `{{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_info=1}} {{ammo=${remaining}}} {{magazine=${d10Whole(get('magazine_size'))}}} ` + - `{{reserve=${d10Whole(get('ammo_reserve'))}}}` : ''); + (mode === 'single' || mode === 'melee' ? ` {{rmax=${d10Whole(get('rmax')) || 'sans limite'}}}` : ''); setAttrs({[prefix + 'weapon_status']: 'Jet en cours…'}); startRoll(command, result => { const successes = d10Whole(result.results.attack_roll.result); @@ -60,7 +58,8 @@ function d10WeaponAttack(event, mode, ranged) { get('damage'), get('damage_per_success')) || 'Aucun dégât'} : {damage: d10Damage(successes, get('damage'), get('damage_per_success'), get('rmax'))}; finishRoll(result.rollId, computed); - if (ranged) setAttrs({[prefix + 'ammo_current']: remaining, [prefix + 'weapon_status']: ''}); + if (ranged) setAttrs({[prefix + 'ammo_current']: remaining, + [prefix + 'weapon_status']: 'Chargeur : ' + remaining + '/' + d10Whole(get('magazine_size'))}); else setAttrs({[prefix + 'weapon_status']: ''}); }); }); diff --git a/tests/test_tabs.mjs b/tests/test_tabs.mjs index 9d3d195..77890e1 100644 --- a/tests/test_tabs.mjs +++ b/tests/test_tabs.mjs @@ -87,8 +87,9 @@ 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), /\{\{ammo_info=1\}\} \{\{ammo=4\}\} \{\{magazine=10\}\} \{\{reserve=3\}\}/); + assert.doesNotMatch(rolls.at(-1), /ammo|magazine|reserve/); assert.equal(attributes[ranged + 'ammo_current'], 4); + assert.equal(attributes[ranged + 'weapon_status'], 'Chargeur : 4/10'); assert.equal(finished.at(-1).computed.damage, 5); assert.match(rolls.at(-1), /rmax=1/); attributes[ranged + 'ammo_current'] = '5'; diff --git a/tools/build.py b/tools/build.py index 5349947..4bca7b7 100644 --- a/tools/build.py +++ b/tools/build.py @@ -456,7 +456,6 @@ def render(model, skills, variant, theme_name, theme, themes, asset_base_url='')
Réussites{{#attack_roll}}{{attack_roll}}{{/attack_roll}}{{#damage_roll}}{{damage_roll}}{{/damage_roll}}{{#damage}}Dégâts{{computed::damage}}{{/damage}}{{#damage_list}}Dégâts par tir{{computed::damage_list}}{{/damage_list}}
{{#threshold}}
Seuil : {{threshold}}
{{/threshold}} {{#rmax}}
Rmax : {{rmax}}
{{/rmax}} -{{#ammo_info}}
Chargeur : {{ammo}} / {{magazine}} · chargeurs de réserve : {{reserve}}
{{/ammo_info}} {{#special}}
{{special}}
{{/special}} '''