Roll classes

This commit is contained in:
Dapoolp 2025-06-17 03:04:20 +02:00
parent 4a044db77f
commit 7cc92d153b
25 changed files with 793 additions and 337 deletions

View file

@ -62,6 +62,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
if (!!this.action.effects) context.effects = this.action.effects.map(e => this.action.item.effects.get(e._id));
if (this.action.damage?.hasOwnProperty('includeBase') && this.action.type === 'attack') context.hasBaseDamage = !!this.action.parent.damage;
context.getRealIndex = this.getRealIndex.bind(this);
context.disableOption = this.disableOption.bind(this);
return context;
}
@ -70,6 +71,14 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
this.render(true);
}
disableOption(index, options, choices) {
const filtered = foundry.utils.deepClone(options);
Object.keys(filtered).forEach(o => {
if(choices.find((c, idx) => c.type === o && index !== idx)) delete filtered[o];
});
return filtered
}
getRealIndex(index) {
const data = this.action.toObject(false);
return data.damage.parts.find(d => d.base) ? index - 1 : index;