Merged with main

This commit is contained in:
WBHarry 2025-07-25 21:35:30 +02:00
commit a5b656f533
51 changed files with 650 additions and 1032 deletions

View file

@ -568,13 +568,7 @@ export default class DhpActor extends Actor {
}
convertDamageToThreshold(damage) {
return damage >= this.system.damageThresholds.severe
? 3
: damage >= this.system.damageThresholds.major
? 2
: damage >= this.system.damageThresholds.minor
? 1
: 0;
return damage >= this.system.damageThresholds.severe ? 3 : damage >= this.system.damageThresholds.major ? 2 : 1;
}
convertStressDamageToHP(resources) {

View file

@ -1,3 +1,5 @@
import ActionSelectionDialog from '../applications/dialogs/actionSelectionDialog.mjs';
/**
* Override and extend the basic Item implementation.
* @extends {foundry.documents.Item}
@ -94,46 +96,16 @@ export default class DHItem extends foundry.documents.Item {
});
}
async selectActionDialog(prevEvent) {
const content = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/dialogs/actionSelect.hbs',
{
actions: this.system.actionsList,
itemName: this.name
}
),
title = game.i18n.localize('DAGGERHEART.CONFIG.SelectAction.selectAction');
return foundry.applications.api.DialogV2.prompt({
window: { title },
classes: ['daggerheart', 'dh-style'],
content,
ok: {
label: title,
callback: (event, button, dialog) => {
Object.defineProperty(prevEvent, 'shiftKey', {
get() {
return event.shiftKey;
}
});
return this.system.actionsList.find(a => a._id === button.form.elements.actionId.value);
}
}
});
}
async use(event) {
const actions = new Set(this.system.actionsList);
if (actions?.size) {
let action = actions.first();
if (actions.size > 1 && !event?.shiftKey) {
// Actions Choice Dialog
action = await this.selectActionDialog(event);
action = await ActionSelectionDialog.create(this, event);
}
if (action) return action.use(event);
}
return this.toChat();
}
async toChat(origin) {