From 07fff9b20a1b88ac2db1d979d0582c55de9f5dc6 Mon Sep 17 00:00:00 2001 From: U~man Date: Sat, 4 Jul 2020 12:58:56 +0200 Subject: [PATCH] ENH: Exploration rolls --- src/lang/en.json | 19 ++++++++-------- src/module/actor/character-sheet.js | 7 ++++++ src/module/actor/entity.js | 22 +++++++++++++++++++ src/module/dice.js | 8 +++++++ .../partials/character-abilities-tab.html | 18 +++++++-------- 5 files changed, 56 insertions(+), 18 deletions(-) diff --git a/src/lang/en.json b/src/lang/en.json index 43ac640..f984068 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -54,7 +54,7 @@ "OSE.saves.breath.long": "Dragon Breath", "OSE.saves.spell.short": "S", "OSE.saves.spell.long": "Rod, Staff, Spell", - "OSE.saves.magic.long": "vs Magic", + "OSE.saves.magic.long": "Bonus vs Magic", "OSE.Health": "Hit Points", "OSE.HealthMax": "Maximum Hit Points", @@ -145,12 +145,13 @@ "OSE.abilities.Requirements": "Requirements", - "OSE.exploration.ListenDoor.long": "Listen at Door", - "OSE.exploration.ListenDoor.short": "Listen Door", - "OSE.exploration.OpenDoor.long": "Open Stuck Door", - "OSE.exploration.OpenDoor.short": "Open Door", - "OSE.exploration.SecretDoor.long": "Find Secret Door", - "OSE.exploration.SecretDoor.short": "Secret Door", - "OSE.exploration.RoomTrap.long": "Find Room Trap", - "OSE.exploration.RoomTrap.short": "Find Trap" + "OSE.ExplorationCheck": "Check", + "OSE.exploration.ld.long": "Listen at Door", + "OSE.exploration.ld.short": "Listen Door", + "OSE.exploration.od.long": "Open Stuck Door", + "OSE.exploration.od.short": "Open Door", + "OSE.exploration.sd.long": "Find Secret Door", + "OSE.exploration.sd.short": "Secret Door", + "OSE.exploration.ft.long": "Find Room Trap", + "OSE.exploration.ft.short": "Find Trap" } \ No newline at end of file diff --git a/src/module/actor/character-sheet.js b/src/module/actor/character-sheet.js index 8c8ba0a..b474502 100644 --- a/src/module/actor/character-sheet.js +++ b/src/module/actor/character-sheet.js @@ -123,6 +123,13 @@ export class OseActorSheetCharacter extends OseActorSheet { actorObject.rollCheck(score, { event: event }); }); + html.find(".exploration .attribute-name a").click((ev) => { + let actorObject = this.actor; + let element = event.currentTarget; + let expl = element.parentElement.parentElement.dataset.exploration; + actorObject.rollExploration(expl, { event: event }); + }); + html.find(".attack a").click(ev => { let actorObject = this.actor; let element = event.currentTarget; diff --git a/src/module/actor/entity.js b/src/module/actor/entity.js index 60d87cd..816c223 100644 --- a/src/module/actor/entity.js +++ b/src/module/actor/entity.js @@ -56,6 +56,28 @@ export class OseActor extends Actor { }); } + rollExploration(expl, options = {}) { + const label = game.i18n.localize(`OSE.exploration.${expl}.long`); + const rollParts = ['1d6']; + + const data = {...this.data, ...{ + rollData : { + type: 'Exploration', + stat: expl + } + }}; + + // Roll and return + return OseDice.Roll({ + event: options.event, + parts: rollParts, + data: data, + speaker: ChatMessage.getSpeaker({ actor: this }), + flavor: `${label} ${game.i18n.localize('OSE.ExplorationCheck')}`, + title: `${label} ${game.i18n.localize('OSE.ExplorationCheck')}`, + }); + } + rollAttack(attack, options={}) { const label = game.i18n.localize(`OSE.${attack}`); const rollParts = ['1d20',]; diff --git a/src/module/dice.js b/src/module/dice.js index 9e37804..8850e5b 100644 --- a/src/module/dice.js +++ b/src/module/dice.js @@ -46,6 +46,14 @@ export class OseDice { } else { details = `
Failure (${sc})
`; } + } else if (data.rollData.type == "Exploration") { + // Exploration Checks + let sc = data.data.exploration[data.rollData.stat]; + if (roll.total <= sc) { + details = `
Success! (${sc})
`; + } else { + details = `
Failure (${sc})
`; + } } return details; } diff --git a/src/templates/actors/partials/character-abilities-tab.html b/src/templates/actors/partials/character-abilities-tab.html index 583025f..f859995 100644 --- a/src/templates/actors/partials/character-abilities-tab.html +++ b/src/templates/actors/partials/character-abilities-tab.html @@ -1,29 +1,29 @@