The basic attack damage shown in the sidebar is modified if horde damage is active (#1071)

This commit is contained in:
WBHarry 2025-08-24 02:21:00 +02:00 committed by GitHub
parent 46ea4addd0
commit fbeff1b908
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View file

@ -51,11 +51,13 @@ export default class DHAttackAction extends DHDamageAction {
const labels = []; const labels = [];
const { roll, range, damage } = this; const { roll, range, damage } = this;
if (roll.trait) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Traits.${roll.trait}.short`)) if (roll.trait) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Traits.${roll.trait}.short`));
if (range) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.short`)); if (range) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.short`));
for (const { value, type } of damage.parts) { const useAltDamage = this.actor?.effects?.find(x => x.type === 'horde')?.active;
const str = Roll.replaceFormulaData(value.getFormula(), this.actor?.getRollData() ?? {}); for (const { value, valueAlt, type } of damage.parts) {
const usedValue = useAltDamage ? valueAlt : value;
const str = Roll.replaceFormulaData(usedValue.getFormula(), this.actor?.getRollData() ?? {});
const icons = Array.from(type) const icons = Array.from(type)
.map(t => CONFIG.DH.GENERAL.damageTypes[t]?.icon) .map(t => CONFIG.DH.GENERAL.damageTypes[t]?.icon)

View file

@ -129,7 +129,7 @@ export default class DhpAdversary extends BaseDataActor {
CONFIG.DH.id, CONFIG.DH.id,
CONFIG.DH.SETTINGS.gameSettings.Automation CONFIG.DH.SETTINGS.gameSettings.Automation
).hordeDamage; ).hordeDamage;
if (autoHordeDamage && changes.system?.resources?.hitPoints?.value) { if (autoHordeDamage && changes.system?.resources?.hitPoints?.value !== undefined) {
const hordeActiveEffect = this.parent.effects.find(x => x.type === 'horde'); const hordeActiveEffect = this.parent.effects.find(x => x.type === 'horde');
if (hordeActiveEffect) { if (hordeActiveEffect) {
const halfHP = Math.ceil(this.resources.hitPoints.max / 2); const halfHP = Math.ceil(this.resources.hitPoints.max / 2);