Compare commits

..

3 commits

Author SHA1 Message Date
WBHarry
27eb4a1430 . 2026-07-19 12:24:49 +02:00
WBHarry
2b9e21bd53 Fixes 2026-07-19 12:16:19 +02:00
WBHarry
274b99d8c6
Apply suggestions from code review
Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com>
2026-07-19 11:43:48 +02:00
7 changed files with 16 additions and 12 deletions

View file

@ -1326,6 +1326,11 @@
"short": "V. Far"
}
},
"ReloadChoices": {
"off": { "label": "Don't Use" },
"button": { "label": "Use button" },
"auto": { "label": "Automatic" }
},
"RollTypes": {
"trait": {
"name": "Trait"

View file

@ -964,8 +964,9 @@ export default class CharacterSheet extends DHBaseActorSheet {
if (!item || !item.system.resource?.max)
return;
await item.update({ 'system.resource.value':
item.system.needsReload ? itemAbleRollParse(item.system.resource.max, this.document, item) : 0
await item.update({
'system.resource.value': item.system.needsReload ?
itemAbleRollParse(item.system.resource.max, this.document, item) : 0
})
}

View file

@ -282,8 +282,6 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
async onRollReloadCheck(_event, messageData) {
const message = game.messages.get(messageData._id);
const needReload = await message.system.action.handleReload?.({ awaitRoll: true });
await message.update({
'system.needReload': needReload
});
await message.update({ 'system.needsReload': needReload });
}
}

View file

@ -63,14 +63,14 @@ export const actionAutomationChoices = {
export const reloadChoices = {
off: {
id: 'off',
label: 'Don\'t Use'
label: 'DAGGERHEART.CONFIG.ReloadChoices.off.label'
},
button: {
id: 'button',
label: 'Use Button'
label: 'DAGGERHEART.CONFIG.ReloadChoices.button.label'
},
auto: {
id: 'auto',
label: 'Automatic'
label: 'DAGGERHEART.CONFIG.ReloadChoices.auto.label'
}
};

View file

@ -53,7 +53,7 @@ export default class DHAttackAction extends DHDamageAction {
async use(event, options) {
if (this.item?.system.needsReload) {
return ui.notifications.error(game.i18n.format('DAGGERHEART.UI.Notifications.reloadRequired', { weapon: this.item.name }));
return ui.notifications.error(_loc('DAGGERHEART.UI.Notifications.reloadRequired', { weapon: this.item.name }));
}
const result = await super.use(event, options);

View file

@ -42,7 +42,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
hasEffect: new fields.BooleanField({ initial: false }),
hasSave: new fields.BooleanField({ initial: false }),
hasTarget: new fields.BooleanField({ initial: false }),
needReload: new fields.BooleanField({ initial: false }),
needsReload: new fields.BooleanField({ initial: false }),
isDirect: new fields.BooleanField({ initial: false }),
onSave: new fields.StringField(),
source: new fields.SchemaField({

View file

@ -2,9 +2,9 @@
<div class="roll-part-title"><span>{{title}}</span></div>
{{#if (eq action.type 'attack')}}
{{#if needReload}}
{{#if needsReload}}
<div class="roll-reload-container">
{{#if needReload}}
{{#if needsReload}}
<p class='reload-warning'>{{localize "DAGGERHEART.ACTIONS.Reload.reloadRequired"}}</p>
{{/if}}
</div>