Merge branch 'main' into feature/beastform-compendium

This commit is contained in:
WBHarry 2025-07-27 19:26:59 +02:00
commit f5a4d8cf94
98 changed files with 4329 additions and 1065 deletions

View file

@ -110,6 +110,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
context.costOptions = this.getCostOptions();
context.disableOption = this.disableOption.bind(this);
context.isNPC = this.action.actor?.isNPC;
context.baseSaveDifficulty = this.action.actor?.baseSaveDifficulty;
context.hasRoll = this.action.hasRoll;
const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers;

View file

@ -55,7 +55,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
},
{
handler: CharacterSheet.#getItemContextOptions,
selector: '[data-item-uuid][data-type="consumable"], [data-item-uuid][data-type="miscellaneous"]',
selector: '[data-item-uuid][data-type="consumable"], [data-item-uuid][data-type="loot"]',
options: {
parentClassHooks: false,
fixed: true
@ -311,7 +311,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
icon: 'fa-solid fa-hands',
condition: target => {
const doc = getDocFromElementSync(target);
return doc && system.equipped;
return doc && doc.system.equipped;
},
callback: (target, event) => CharacterSheet.#toggleEquipItem.call(this, event, target)
}
@ -325,7 +325,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
}
/**
* Get the set of ContextMenu options for Consumable and Miscellaneous.
* Get the set of ContextMenu options for Consumable and Loot.
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
* @this {CharacterSheet}
* @protected

View file

@ -6,6 +6,6 @@ export { default as Community } from './community.mjs';
export { default as Consumable } from './consumable.mjs';
export { default as DomainCard } from './domainCard.mjs';
export { default as Feature } from './feature.mjs';
export { default as Miscellaneous } from './miscellaneous.mjs';
export { default as Loot } from './loot.mjs';
export { default as Subclass } from './subclass.mjs';
export { default as Weapon } from './weapon.mjs';

View file

@ -132,14 +132,14 @@ export default class ClassSheet extends DHBaseItemSheet {
});
}
} else if (target.classList.contains('choice-a-section')) {
if (item.type === 'miscellaneous' || item.type === 'consumable') {
if (item.type === 'loot' || item.type === 'consumable') {
const filteredChoiceA = this.document.system.inventory.choiceA;
if (filteredChoiceA.length < 2)
await this.document.update({
'system.inventory.choiceA': [...filteredChoiceA.map(x => x.uuid), item.uuid]
});
}
} else if (item.type === 'miscellaneous') {
} else if (item.type === 'loot') {
if (target.classList.contains('take-section')) {
const filteredTake = this.document.system.inventory.take.filter(x => x);
if (filteredTake.length < 3)

View file

@ -1,15 +1,15 @@
import DHBaseItemSheet from '../api/base-item.mjs';
export default class MiscellaneousSheet extends DHBaseItemSheet {
export default class LootSheet extends DHBaseItemSheet {
/**@inheritdoc */
static DEFAULT_OPTIONS = {
classes: ['miscellaneous'],
classes: ['loot'],
position: { width: 550 }
};
/**@override */
static PARTS = {
header: { template: 'systems/daggerheart/templates/sheets/items/miscellaneous/header.hbs' },
header: { template: 'systems/daggerheart/templates/sheets/items/loot/header.hbs' },
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
actions: {
@ -17,7 +17,7 @@ export default class MiscellaneousSheet extends DHBaseItemSheet {
scrollable: ['.actions']
},
settings: {
template: 'systems/daggerheart/templates/sheets/items/miscellaneous/settings.hbs',
template: 'systems/daggerheart/templates/sheets/items/loot/settings.hbs',
scrollable: ['.settings']
},
effects: {

View file

@ -1301,9 +1301,9 @@ export const featureTypes = {
id: 'consumable',
label: 'TYPES.Item.consumable'
},
miscellaneous: {
id: 'miscellaneous',
label: 'TYPES.Item.miscellaneous'
loot: {
id: 'loot',
label: 'TYPES.Item.loot'
},
beastform: {
if: 'beastform',

View file

@ -307,7 +307,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
title: 'Roll Save',
roll: {
trait: this.save.trait,
difficulty: this.save.difficulty,
difficulty: this.save.difficulty ?? this.actor?.baseSaveDifficulty,
type: 'reaction'
},
data: target.actor.getRollData()

View file

@ -8,7 +8,7 @@ export default class SaveField extends fields.SchemaField {
initial: null,
choices: CONFIG.DH.ACTOR.abilities
}),
difficulty: new fields.NumberField({ nullable: true, initial: 10, integer: true, min: 0 }),
difficulty: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 }),
damageMod: new fields.StringField({
initial: CONFIG.DH.ACTIONS.damageOnSave.none.id,
choices: CONFIG.DH.ACTIONS.damageOnSave

View file

@ -6,8 +6,7 @@ export default class TargetField extends fields.SchemaField {
type: new fields.StringField({
choices: CONFIG.DH.ACTIONS.targetTypes,
initial: CONFIG.DH.ACTIONS.targetTypes.any.id,
nullable: true,
initial: null
nullable: true
}),
amount: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 })
};

View file

@ -6,7 +6,7 @@ import DHCommunity from './community.mjs';
import DHConsumable from './consumable.mjs';
import DHDomainCard from './domainCard.mjs';
import DHFeature from './feature.mjs';
import DHMiscellaneous from './miscellaneous.mjs';
import DHLoot from './loot.mjs';
import DHSubclass from './subclass.mjs';
import DHWeapon from './weapon.mjs';
import DHBeastform from './beastform.mjs';
@ -20,7 +20,7 @@ export {
DHConsumable,
DHDomainCard,
DHFeature,
DHMiscellaneous,
DHLoot,
DHSubclass,
DHWeapon,
DHBeastform
@ -35,7 +35,7 @@ export const config = {
consumable: DHConsumable,
domainCard: DHDomainCard,
feature: DHFeature,
miscellaneous: DHMiscellaneous,
loot: DHLoot,
subclass: DHSubclass,
weapon: DHWeapon,
beastform: DHBeastform

View file

@ -1,12 +1,11 @@
import BaseDataItem from './base.mjs';
import { ActionField } from '../fields/actionField.mjs';
export default class DHMiscellaneous extends BaseDataItem {
export default class DHLoot extends BaseDataItem {
/** @inheritDoc */
static get metadata() {
return foundry.utils.mergeObject(super.metadata, {
label: 'TYPES.Item.miscellaneous',
type: 'miscellaneous',
label: 'TYPES.Item.loot',
type: 'loot',
hasDescription: true,
isQuantifiable: true,
isInventoryItem: true,

View file

@ -385,6 +385,10 @@ export default class DhpActor extends Actor {
return CONFIG.Dice.daggerheart[['character', 'companion'].includes(this.type) ? 'DualityRoll' : 'D20Roll'];
}
get baseSaveDifficulty() {
return this.system.difficulty ?? 10;
}
getRollData() {
const rollData = super.getRollData();
rollData.system = this.system.getRollData();