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.appliedEffects) {
// Bardic Rally
mods.rally = {
label: 'DAGGERHEART.CLASS.Feature.rallyDice',
values: config.data?.parent?.appliedEffects.reduce((a, c) => {
const rallyChoices = config.data?.parent?.appliedEffects.reduce((a, c) => {
const change = c.changes.find(ch => ch.key === 'system.bonuses.rally');
if (change) a.push({ value: c.id, label: change.value });
return a;
}, []),
value: null,
beforeCrit: true,
callback: part => {
const rallyFaces = config.modifiers.rally.values.find(
r => r.value === config.modifiers.rally.value
)?.label;
part.roll.terms.push(
new foundry.dice.terms.OperatorTerm({ operator: '+' }),
...this.parse(`1${rallyFaces}`)
);
}
};
}, [])
if(rallyChoices.length) {
mods.rally = {
label: 'DAGGERHEART.CLASS.Feature.rallyDice',
values: rallyChoices,
value: null,
beforeCrit: true,
callback: part => {
const rallyFaces = config.modifiers.rally.values.find(
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);

View file

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