diff --git a/src/module/sheets/characterSheet.mjs b/src/module/sheets/characterSheet.mjs index fe2cd3f4..d859c7a2 100644 --- a/src/module/sheets/characterSheet.mjs +++ b/src/module/sheets/characterSheet.mjs @@ -24,6 +24,7 @@ import {StandaloneLiturgies} from "./character-standalone/liturgies.mjs"; import {StandaloneHealth} from "./character-standalone/health.mjs"; import {SpellDialog} from "../dialog/spellDialog.mjs"; import {displayRoll} from "../globals/displayRoll.js"; +import {evaluateRoll} from "../globals/DSARoll.mjs"; const {HandlebarsApplicationMixin, DocumentSheetV2} = foundry.applications.api const {ActorSheetV2} = foundry.applications.sheets @@ -73,7 +74,8 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) { openStandaloneLiturgies: CharacterSheet.#openStandaloneLiturgies, openStandaloneHealth: CharacterSheet.#openStandaloneHealth, setWounds: CharacterSheet.#setWounds, - switchSet: CharacterSheet.#switchSet + switchSet: CharacterSheet.#switchSet, + openInitiative: CharacterSheet.#openInitiative, } } @@ -157,6 +159,18 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) { new AttributeDialog(this.document, target.dataset.itemId).render(true) } + // TODO: add combat statistics and dialog + static async #openInitiative(event, target) { + const {formula} = target.dataset + const evaluated = await new Roll(formula.replace("w", "d")).evaluate() + const context = { + formula, + initiativeRolled: evaluated.terms[0].results[0].result, + total: evaluated.total + } + await displayRoll(evaluated, game.user, this.document, false, false, 'systems/DSA_4-1/templates/chat/initiative-message.hbs', context) + } + static async #progressCooldown(event, target) { const {cooldownId} = target.dataset const cooldowns = this.document.system.cooldowns diff --git a/src/templates/actor/character/main-sheet.hbs b/src/templates/actor/character/main-sheet.hbs index 46abb8ec..d65cab64 100644 --- a/src/templates/actor/character/main-sheet.hbs +++ b/src/templates/actor/character/main-sheet.hbs @@ -91,7 +91,8 @@ {{/if}} {{#if this.ini}} {{/if}} diff --git a/src/templates/chat/initiative-message.hbs b/src/templates/chat/initiative-message.hbs new file mode 100644 index 00000000..4a19fcf9 --- /dev/null +++ b/src/templates/chat/initiative-message.hbs @@ -0,0 +1,6 @@ +
+
Formel: {{formula}}
+
Gewürfelt: {{initiativeRolled}}
+
+
Initiative: {{total}}
+
\ No newline at end of file