Fix bardic rally showing in damage dialog when it should not (#783)

This commit is contained in:
Dapoulp 2025-08-10 16:52:36 +02:00 committed by GitHub
parent 080b6bc2da
commit df5373cd20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 18 deletions

View file

@ -159,25 +159,28 @@ export default class DamageRoll extends DHRoll {
if (config.data?.parent) { if (config.data?.parent) {
if (config.data.parent.appliedEffects) { if (config.data.parent.appliedEffects) {
// Bardic Rally // Bardic Rally
mods.rally = { const rallyChoices = config.data?.parent?.appliedEffects.reduce((a, c) => {
label: 'DAGGERHEART.CLASS.Feature.rallyDice',
values: config.data?.parent?.appliedEffects.reduce((a, c) => {
const change = c.changes.find(ch => ch.key === 'system.bonuses.rally'); const change = c.changes.find(ch => ch.key === 'system.bonuses.rally');
if (change) a.push({ value: c.id, label: change.value }); if (change) a.push({ value: c.id, label: change.value });
return a; return a;
}, []), }, [])
value: null, if(rallyChoices.length) {
beforeCrit: true, mods.rally = {
callback: part => { label: 'DAGGERHEART.CLASS.Feature.rallyDice',
const rallyFaces = config.modifiers.rally.values.find( values: rallyChoices,
r => r.value === config.modifiers.rally.value value: null,
)?.label; beforeCrit: true,
part.roll.terms.push( callback: part => {
new foundry.dice.terms.OperatorTerm({ operator: '+' }), const rallyFaces = config.modifiers.rally.values.find(
...this.parse(`1${rallyFaces}`) r => r.value === config.modifiers.rally.value
); )?.label;
} part.roll.terms.push(
}; new foundry.dice.terms.OperatorTerm({ operator: '+' }),
...this.parse(`1${rallyFaces}`)
);
}
};
}
} }
const item = config.data.parent.items?.get(config.source.item); const item = config.data.parent.items?.get(config.source.item);

View file

@ -24,7 +24,7 @@
<input type="text" value="{{extraFormula}}" name="roll.{{ @index }}.extraFormula" placeholder="Situational Bonus"> <input type="text" value="{{extraFormula}}" name="roll.{{ @index }}.extraFormula" placeholder="Situational Bonus">
</div> </div>
{{/each}} {{/each}}
{{#if @root.modifiers}} {{#unless (empty @root.modifiers)}}
<fieldset class="modifier-container two-columns"> <fieldset class="modifier-container two-columns">
<legend>{{localize "DAGGERHEART.GENERAL.Modifier.plural"}}</legend> <legend>{{localize "DAGGERHEART.GENERAL.Modifier.plural"}}</legend>
{{#each @root.modifiers}} {{#each @root.modifiers}}
@ -39,7 +39,7 @@
{{/if}} {{/if}}
{{/each}} {{/each}}
</fieldset> </fieldset>
{{/if}} {{/unless}}
<div class="damage-section-controls"> <div class="damage-section-controls">
{{#if directDamage}} {{#if directDamage}}
<select class="roll-mode-select" name="selectedRollMode"> <select class="roll-mode-select" name="selectedRollMode">