Fixed logic

This commit is contained in:
WBHarry 2025-07-16 16:38:10 +02:00
parent f33dc8c4af
commit ea708e85e2
7 changed files with 20 additions and 11 deletions

View file

@ -9,8 +9,10 @@ export default class DHDamageAction extends DHBaseAction {
const isAdversary = this.actor.type === 'adversary';
if (isAdversary && this.actor.system.type === CONFIG.DH.ACTOR.adversaryTypes.horde.id) {
const halfHP = Math.ceil(this.actor.system.resources.hitPoints.max / 2);
if (this.actor.system.resources.hitPoints.value >= halfHP) return part.valueAlt;
const hasHordeDamage = this.actor.effects.find(
x => x.name === game.i18n.localize('DAGGERHEART.CONFIG.AdversaryType.horde.label')
);
if (hasHordeDamage) return part.valueAlt;
}
return formulaValue;

View file

@ -125,7 +125,9 @@ export default class DhpAdversary extends BaseDataActor {
await this.parent.createEmbeddedDocuments('ActiveEffect', [
{
name: game.i18n.localize('DAGGERHEART.CONFIG.AdversaryType.horde.label'),
img: 'icons/magic/movement/chevrons-down-yellow.webp'
img: 'icons/magic/movement/chevrons-down-yellow.webp',
disabled: !game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation)
.hordeDamage
}
]);
} else if (raisedAboveHalf) {

View file

@ -1,6 +1,4 @@
export default class DhAutomation extends foundry.abstract.DataModel {
static LOCALIZATION_PREFIXES = ['DAGGERHEART.SETTINGS.Automation']; // Doesn't work for some reason
static defineSchema() {
const fields = foundry.data.fields;
return {
@ -20,6 +18,11 @@ export default class DhAutomation extends foundry.abstract.DataModel {
required: true,
initial: false,
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.actionPoints.label'
}),
hordeDamage: new fields.BooleanField({
required: true,
initial: true,
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.hordeDamage.label'
})
};
}