Merged with main

This commit is contained in:
WBHarry 2025-08-08 00:44:08 +02:00
commit 9b9632cf94
150 changed files with 1077 additions and 930 deletions

View file

@ -4,7 +4,25 @@ export default class BeastformField extends fields.SchemaField {
constructor(options = {}, context = {}) {
const beastformFields = {
tierAccess: new fields.SchemaField({
exact: new fields.NumberField({ integer: true, nullable: true, initial: null })
exact: new fields.NumberField({
integer: true,
nullable: true,
initial: null,
choices: () => {
const settingsTiers = game.settings.get(
CONFIG.DH.id,
CONFIG.DH.SETTINGS.gameSettings.LevelTiers
).tiers;
return Object.values(settingsTiers).reduce(
(acc, tier) => {
acc[tier.tier] = game.i18n.localize(tier.name);
return acc;
},
{ 1: game.i18n.localize('DAGGERHEART.GENERAL.Tiers.1') }
);
},
hint: 'DAGGERHEART.ACTIONS.Config.beastform.exactHint'
})
})
};
super(beastformFields, options, context);

View file

@ -12,7 +12,10 @@ export default class UsesField extends fields.SchemaField {
initial: null,
nullable: true
}),
consumeOnSuccess: new fields.BooleanField({ initial: false, label: "DAGGERHEART.ACTIONS.Settings.consumeOnSuccess.label" })
consumeOnSuccess: new fields.BooleanField({
initial: false,
label: 'DAGGERHEART.ACTIONS.Settings.consumeOnSuccess.label'
})
};
super(usesFields, options, context);
}
@ -30,6 +33,7 @@ export default class UsesField extends fields.SchemaField {
if (!uses) return null;
return {
...uses,
remaining: this.remainingUses,
enabled: uses.hasOwnProperty('enabled') ? uses.enabled : true
};
}

View file

@ -1,4 +1,5 @@
import DHActionConfig from '../../applications/sheets-configs/action-config.mjs';
import { itemAbleRollParse } from '../../helpers/utils.mjs';
import MappingField from './mappingField.mjs';
/**
@ -164,6 +165,15 @@ export function ActionMixin(Base) {
return foundry.utils.getProperty(this.parent, this.systemPath) instanceof Collection;
}
get remainingUses() {
if (!this.uses) return null;
return Math.max(
(this.uses.max ? itemAbleRollParse(this.uses.max, this.actor) : 0) - (this.uses.value ?? 0),
0
);
}
static async create(data, operation = {}) {
const { parent, renderSheet } = operation;
let { type } = data;