mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-23 19:09:55 +02:00
Changed to storing the reloadCheckValue. It's included in notification feedback
This commit is contained in:
parent
cb0d22a9a0
commit
b345db4f05
6 changed files with 38 additions and 13 deletions
|
|
@ -126,7 +126,7 @@
|
||||||
"damageOnSave": "Damage on Save",
|
"damageOnSave": "Damage on Save",
|
||||||
"useDefaultItemValues": "Use default Item values"
|
"useDefaultItemValues": "Use default Item values"
|
||||||
},
|
},
|
||||||
"Reload": {
|
"Reload": {
|
||||||
"checkReload": "Check Reload",
|
"checkReload": "Check Reload",
|
||||||
"reloadRequired": "Reload Required!"
|
"reloadRequired": "Reload Required!"
|
||||||
},
|
},
|
||||||
|
|
@ -3274,7 +3274,9 @@
|
||||||
"lackingItemTransferPermission": "User {user} lacks owner permission needed to transfer items to {target}",
|
"lackingItemTransferPermission": "User {user} lacks owner permission needed to transfer items to {target}",
|
||||||
"noTokenTargeted": "No token is targeted",
|
"noTokenTargeted": "No token is targeted",
|
||||||
"behaviorRegionRequiresGM": "Creating a Region with an attached Behavior requires an online GM",
|
"behaviorRegionRequiresGM": "Creating a Region with an attached Behavior requires an online GM",
|
||||||
"reloadRequired": "The {weapon} must be reloaded to be used!"
|
"reloadRequired": "The {weapon} must be reloaded to be used!",
|
||||||
|
"reloadRequiredRollResponse": "Reload Check: 1d6 -> {roll}. Reload required.",
|
||||||
|
"noReloadRequiredRollResponse": "Reload Check: 1d6 -> {roll}. No reload required."
|
||||||
},
|
},
|
||||||
"Progress": {
|
"Progress": {
|
||||||
"migrationLabel": "Performing system migration. Please wait and do not close Foundry."
|
"migrationLabel": "Performing system migration. Please wait and do not close Foundry."
|
||||||
|
|
@ -3329,7 +3331,8 @@
|
||||||
"immune": "Immune",
|
"immune": "Immune",
|
||||||
"middleClick": "[Middle Click] Keep tooltip view",
|
"middleClick": "[Middle Click] Keep tooltip view",
|
||||||
"tokenSize": "The token size used on the canvas",
|
"tokenSize": "The token size used on the canvas",
|
||||||
"previewTokenHelp": "Left-click to place, right-click to cancel"
|
"previewTokenHelp": "Left-click to place, right-click to cancel",
|
||||||
|
"noReloadRequired": "No Reload Required!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,12 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
|
|
||||||
async onRollReloadCheck(_event, messageData) {
|
async onRollReloadCheck(_event, messageData) {
|
||||||
const message = game.messages.get(messageData._id);
|
const message = game.messages.get(messageData._id);
|
||||||
const needsReload = await message.system.action.handleReload?.({ awaitRoll: true });
|
const { needsReload, rollValue } = await message.system.action.handleReload?.({ awaitRoll: true });
|
||||||
await message.update({ 'system.needsReload': needsReload });
|
await message.update({ 'system.reloadCheckValue': rollValue });
|
||||||
|
|
||||||
|
if (needsReload)
|
||||||
|
ui.notifications.info(_loc('DAGGERHEART.UI.Notifications.reloadRequiredRollResponse', { roll: rollValue }));
|
||||||
|
else
|
||||||
|
ui.notifications.info(_loc('DAGGERHEART.UI.Notifications.noReloadRequiredRollResponse', { roll: rollValue }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,13 +74,13 @@ export default class DHAttackAction extends DHDamageAction {
|
||||||
else
|
else
|
||||||
game.dice3d.showForRoll(roll, game.user, true);
|
game.dice3d.showForRoll(roll, game.user, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const needsToReload = roll.total === 1;
|
const needsReload = roll.total === 1;
|
||||||
if (needsToReload) {
|
if (needsReload) {
|
||||||
this.item.update({ 'system.resource.value': 0 });
|
this.item.update({ 'system.resource.value': 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
return needsToReload;
|
return { needsReload, rollValue: roll.total };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
||||||
hasEffect: new fields.BooleanField({ initial: false }),
|
hasEffect: new fields.BooleanField({ initial: false }),
|
||||||
hasSave: new fields.BooleanField({ initial: false }),
|
hasSave: new fields.BooleanField({ initial: false }),
|
||||||
hasTarget: new fields.BooleanField({ initial: false }),
|
hasTarget: new fields.BooleanField({ initial: false }),
|
||||||
needsReload: new fields.BooleanField({ initial: false }),
|
reloadCheckValue: new fields.NumberField({ integer: true, nullable: true, initial: null }),
|
||||||
isDirect: new fields.BooleanField({ initial: false }),
|
isDirect: new fields.BooleanField({ initial: false }),
|
||||||
onSave: new fields.StringField(),
|
onSave: new fields.StringField(),
|
||||||
source: new fields.SchemaField({
|
source: new fields.SchemaField({
|
||||||
|
|
@ -99,6 +99,10 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
||||||
return this.item?.system.hasReload;
|
return this.item?.system.hasReload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get needsReload() {
|
||||||
|
return this.reloadCheckValue === 1;
|
||||||
|
}
|
||||||
|
|
||||||
get action() {
|
get action() {
|
||||||
const { actionActor, actionItem: itemAction } = this;
|
const { actionActor, actionItem: itemAction } = this;
|
||||||
if (!this.source.action) return null;
|
if (!this.source.action) return null;
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,14 @@ export default class DHRoll extends BaseRoll {
|
||||||
item?.system.hasReload &&
|
item?.system.hasReload &&
|
||||||
action?.type === 'attack' &&
|
action?.type === 'attack' &&
|
||||||
reloadSetting === CONFIG.DH.SETTINGS.reloadChoices.auto.id;
|
reloadSetting === CONFIG.DH.SETTINGS.reloadChoices.auto.id;
|
||||||
const needsReload = useReload ? await action?.handleReload?.() : false;
|
const reloadResult = useReload ? await action?.handleReload?.() : {};
|
||||||
|
|
||||||
|
if (useReload) {
|
||||||
|
if (reloadResult.needsReload)
|
||||||
|
ui.notifications.info(_loc('DAGGERHEART.UI.Notifications.reloadRequiredRollResponse', { roll: reloadResult.rollValue }));
|
||||||
|
else
|
||||||
|
ui.notifications.info(_loc('DAGGERHEART.UI.Notifications.noReloadRequiredRollResponse', { roll: reloadResult.rollValue }));
|
||||||
|
}
|
||||||
|
|
||||||
const cls = getDocumentClass('ChatMessage'),
|
const cls = getDocumentClass('ChatMessage'),
|
||||||
msgData = {
|
msgData = {
|
||||||
|
|
@ -148,7 +155,11 @@ export default class DHRoll extends BaseRoll {
|
||||||
title: roll.title,
|
title: roll.title,
|
||||||
speaker: cls.getSpeaker({ actor: roll.data?.parent }),
|
speaker: cls.getSpeaker({ actor: roll.data?.parent }),
|
||||||
sound: config.mute ? null : CONFIG.sounds.dice,
|
sound: config.mute ? null : CONFIG.sounds.dice,
|
||||||
system: { ...config, actionDescription, needsReload },
|
system: {
|
||||||
|
...config,
|
||||||
|
actionDescription,
|
||||||
|
reloadCheckValue: reloadResult.rollValue
|
||||||
|
},
|
||||||
rolls: [roll]
|
rolls: [roll]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
<div class="roll-buttons">
|
<div class="roll-buttons">
|
||||||
{{#if (and parent.system.hasReload (eq automationSettings.reload 'button'))}}
|
{{#if (and parent.system.hasReload (eq automationSettings.reload 'button'))}}
|
||||||
<button class="roll-reload-check" {{#if needsReload}}disabled{{/if}}>{{localize "DAGGERHEART.ACTIONS.Reload.checkReload"}}</button>
|
<button class="roll-reload-check" {{#if reloadCheckValue}}{{#unless parent.system.needsReload}}title="{{localize "DAGGERHEART.UI.Tooltip.noReloadRequired"}}"{{/unless}} disabled{{/if}}>
|
||||||
|
{{localize "DAGGERHEART.ACTIONS.Reload.checkReload"}}
|
||||||
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if areas.length}}<button class="action-areas end-button"><i class="fa-solid fa-crosshairs"></i></button>{{/if}}
|
{{#if areas.length}}<button class="action-areas end-button"><i class="fa-solid fa-crosshairs"></i></button>{{/if}}
|
||||||
{{#if hasDamage}}
|
{{#if hasDamage}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue