Remove ammo data from ranged roll commands
Chado/d10_cs_generator/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-09-19 04:33:45 +02:00
parent 70704a0df0
commit 0b5788b6f6
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
4 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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']: ''});
});
});

View File

@ -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';

View File

@ -456,7 +456,6 @@ 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_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>
'''