diff --git a/lang/en.json b/lang/en.json index cb020a93..d4c81546 100755 --- a/lang/en.json +++ b/lang/en.json @@ -450,7 +450,8 @@ }, "DaggerheartMenu": { "title": "GM Tools", - "refreshFeatures": "Refresh Features" + "refreshFeatures": "Refresh Features", + "fallingAndCollision": "Falling And Collision Damage" }, "DeleteConfirmation": { "title": "Delete {type} - {name}", @@ -1155,6 +1156,12 @@ "description": "" } }, + "fallAndCollision": { + "veryClose": { "label": "Very Close", "chatTitle": "Fall Damage: Very Close" }, + "close": { "label": "Close", "chatTitle": "Fall Damage: Close" }, + "far": { "label": "Far", "chatTitle": "Fall Damage: Far" }, + "collision": { "label": "Collision", "chatTitle": "Dangerous Collision" } + }, "FeatureForm": { "label": "Feature Form", "passive": "Passive", diff --git a/module/applications/sheets/api/base-actor.mjs b/module/applications/sheets/api/base-actor.mjs index 4b0fd7d9..4a550d72 100644 --- a/module/applications/sheets/api/base-actor.mjs +++ b/module/applications/sheets/api/base-actor.mjs @@ -228,7 +228,6 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) { 'systems/daggerheart/templates/ui/chat/action.hbs', systemData ), - title: game.i18n.localize('DAGGERHEART.ACTIONS.Config.displayInChat'), speaker: cls.getSpeaker(), flags: { daggerheart: { diff --git a/module/applications/sidebar/tabs/daggerheartMenu.mjs b/module/applications/sidebar/tabs/daggerheartMenu.mjs index 26ae484b..86c1b8cb 100644 --- a/module/applications/sidebar/tabs/daggerheartMenu.mjs +++ b/module/applications/sidebar/tabs/daggerheartMenu.mjs @@ -31,7 +31,8 @@ export default class DaggerheartMenu extends HandlebarsApplicationMixin(Abstract }, actions: { selectRefreshable: DaggerheartMenu.#selectRefreshable, - refreshActors: DaggerheartMenu.#refreshActors + refreshActors: DaggerheartMenu.#refreshActors, + createFallCollisionDamage: DaggerheartMenu.#createFallCollisionDamage } }; @@ -50,6 +51,7 @@ export default class DaggerheartMenu extends HandlebarsApplicationMixin(Abstract const context = await super._prepareContext(options); context.refreshables = this.refreshSelections; context.disableRefresh = Object.values(this.refreshSelections).every(x => !x.selected); + context.fallAndCollision = CONFIG.DH.GENERAL.fallAndCollisionDamage; return context; } @@ -71,4 +73,22 @@ export default class DaggerheartMenu extends HandlebarsApplicationMixin(Abstract this.refreshSelections = DaggerheartMenu.defaultRefreshSelections(); this.render(); } + + static async #createFallCollisionDamage(_event, button) { + const data = CONFIG.DH.GENERAL.fallAndCollisionDamage[button.dataset.key]; + const roll = new Roll(data.damageFormula); + await roll.evaluate(); + + /* class BaseRoll needed to get rendered by foundryRoll.hbs */ + const rollJSON = roll.toJSON(); + rollJSON.class = 'BaseRoll'; + + foundry.documents.ChatMessage.implementation.create({ + title: game.i18n.localize(data.chatTitle), + author: game.user.id, + speaker: foundry.documents.ChatMessage.implementation.getSpeaker(), + rolls: [rollJSON], + sound: CONFIG.sounds.dice + }); + } } diff --git a/module/config/generalConfig.mjs b/module/config/generalConfig.mjs index c15cae56..f3484e43 100644 --- a/module/config/generalConfig.mjs +++ b/module/config/generalConfig.mjs @@ -1057,3 +1057,30 @@ export const activeEffectDurations = { label: 'DAGGERHEART.CONFIG.ActiveEffectDuration.custom' } }; + +export const fallAndCollisionDamage = { + veryClose: { + id: 'veryClose', + label: 'DAGGERHEART.CONFIG.fallAndCollision.veryClose.label', + chatTitle: 'DAGGERHEART.CONFIG.fallAndCollision.veryClose.chatTitle', + damageFormula: '1d10 + 3' + }, + close: { + id: 'veryClose', + label: 'DAGGERHEART.CONFIG.fallAndCollision.close.label', + chatTitle: 'DAGGERHEART.CONFIG.fallAndCollision.close.chatTitle', + damageFormula: '1d20 + 5' + }, + far: { + id: 'veryClose', + label: 'DAGGERHEART.CONFIG.fallAndCollision.far.label', + chatTitle: 'DAGGERHEART.CONFIG.fallAndCollision.far.chatTitle', + damageFormula: '1d100 + 15' + }, + collision: { + id: 'veryClose', + label: 'DAGGERHEART.CONFIG.fallAndCollision.collision.label', + chatTitle: 'DAGGERHEART.CONFIG.fallAndCollision.collision.chatTitle', + damageFormula: '1d20 + 5' + } +}; diff --git a/module/documents/item.mjs b/module/documents/item.mjs index 56048a81..d1a618c7 100644 --- a/module/documents/item.mjs +++ b/module/documents/item.mjs @@ -197,7 +197,6 @@ export default class DHItem extends foundry.documents.Item { actor: item.parent, speaker: cls.getSpeaker(), system: systemData, - title: game.i18n.localize('DAGGERHEART.ACTIONS.Config.displayInChat'), content: await foundry.applications.handlebars.renderTemplate( 'systems/daggerheart/templates/ui/chat/ability-use.hbs', systemData diff --git a/styles/less/ui/sidebar/daggerheartMenu.less b/styles/less/ui/sidebar/daggerheartMenu.less index 677214d7..88b139c5 100644 --- a/styles/less/ui/sidebar/daggerheartMenu.less +++ b/styles/less/ui/sidebar/daggerheartMenu.less @@ -15,17 +15,17 @@ font-weight: bold; } - .menu-refresh-container { + .menu-options-container { display: flex; flex-direction: column; gap: 8px; - .menu-refresh-inner-container { + .menu-options-inner-container { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; - .experience-chip { + .option-chip { display: flex; align-items: center; border-radius: 5px; diff --git a/templates/sidebar/daggerheart-menu/main.hbs b/templates/sidebar/daggerheart-menu/main.hbs index 4d948409..a1ea8730 100644 --- a/templates/sidebar/daggerheart-menu/main.hbs +++ b/templates/sidebar/daggerheart-menu/main.hbs @@ -4,10 +4,10 @@