#80 adds a temporary solution to quickly roll Initiative on a given Weapon
parent
b459c96961
commit
efb9a415e4
|
|
@ -24,6 +24,7 @@ import {StandaloneLiturgies} from "./character-standalone/liturgies.mjs";
|
||||||
import {StandaloneHealth} from "./character-standalone/health.mjs";
|
import {StandaloneHealth} from "./character-standalone/health.mjs";
|
||||||
import {SpellDialog} from "../dialog/spellDialog.mjs";
|
import {SpellDialog} from "../dialog/spellDialog.mjs";
|
||||||
import {displayRoll} from "../globals/displayRoll.js";
|
import {displayRoll} from "../globals/displayRoll.js";
|
||||||
|
import {evaluateRoll} from "../globals/DSARoll.mjs";
|
||||||
|
|
||||||
const {HandlebarsApplicationMixin, DocumentSheetV2} = foundry.applications.api
|
const {HandlebarsApplicationMixin, DocumentSheetV2} = foundry.applications.api
|
||||||
const {ActorSheetV2} = foundry.applications.sheets
|
const {ActorSheetV2} = foundry.applications.sheets
|
||||||
|
|
@ -73,7 +74,8 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
||||||
openStandaloneLiturgies: CharacterSheet.#openStandaloneLiturgies,
|
openStandaloneLiturgies: CharacterSheet.#openStandaloneLiturgies,
|
||||||
openStandaloneHealth: CharacterSheet.#openStandaloneHealth,
|
openStandaloneHealth: CharacterSheet.#openStandaloneHealth,
|
||||||
setWounds: CharacterSheet.#setWounds,
|
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)
|
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) {
|
static async #progressCooldown(event, target) {
|
||||||
const {cooldownId} = target.dataset
|
const {cooldownId} = target.dataset
|
||||||
const cooldowns = this.document.system.cooldowns
|
const cooldowns = this.document.system.cooldowns
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,8 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if this.ini}}
|
{{#if this.ini}}
|
||||||
<div data-tooltip="{{localize "WEAPON.initiative" weapon=this.name}}"
|
<div data-tooltip="{{localize "WEAPON.initiative" weapon=this.name}}"
|
||||||
class="ini sidebar-element rollable" data-action="openInitiative"><label>INI</label>
|
class="ini sidebar-element rollable" data-action="openInitiative" data-formula="{{this.ini}}">
|
||||||
|
<label>INI</label>
|
||||||
<div class="formula">{{this.ini}}</div>
|
<div class="formula">{{this.ini}}</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div>
|
||||||
|
<div>Formel: {{formula}}</div>
|
||||||
|
<div>Gewürfelt: {{initiativeRolled}}</div>
|
||||||
|
<hr/>
|
||||||
|
<div>Initiative: {{total}}</div>
|
||||||
|
</div>
|
||||||
Loading…
Reference in New Issue