mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 20:51:07 +01:00
Fixed adversary dice
This commit is contained in:
parent
dfb2c6bd3c
commit
ceb74296a1
6 changed files with 39 additions and 11 deletions
|
|
@ -166,8 +166,6 @@ class DhpRangeSettings extends FormApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const registerDHSettings = () => {
|
export const registerDHSettings = () => {
|
||||||
// const debouncedReload = foundry.utils.debounce(() => window.location.reload(), 100);
|
|
||||||
|
|
||||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.General.AbilityArray, {
|
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.General.AbilityArray, {
|
||||||
name: game.i18n.localize('DAGGERHEART.Settings.General.AbilityArray.Name'),
|
name: game.i18n.localize('DAGGERHEART.Settings.General.AbilityArray.Name'),
|
||||||
hint: game.i18n.localize('DAGGERHEART.Settings.General.AbilityArray.Hint'),
|
hint: game.i18n.localize('DAGGERHEART.Settings.General.AbilityArray.Hint'),
|
||||||
|
|
@ -274,7 +272,7 @@ export const registerDHSettings = () => {
|
||||||
name: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Name'),
|
name: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Name'),
|
||||||
hint: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Hint'),
|
hint: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Hint'),
|
||||||
scope: 'world',
|
scope: 'world',
|
||||||
config: true,
|
config: false,
|
||||||
type: Number,
|
type: Number,
|
||||||
choices: Object.values(DualityRollColor),
|
choices: Object.values(DualityRollColor),
|
||||||
default: DualityRollColor.colorful.value
|
default: DualityRollColor.colorful.value
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,20 @@ export default class DHAppearanceSettings extends HandlebarsApplicationMixin(App
|
||||||
|
|
||||||
static async save() {
|
static async save() {
|
||||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance, this.settings.toObject());
|
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance, this.settings.toObject());
|
||||||
|
const reload = await foundry.applications.api.DialogV2.confirm({
|
||||||
|
id: 'reload-world-confirm',
|
||||||
|
modal: true,
|
||||||
|
rejectClose: false,
|
||||||
|
window: { title: 'SETTINGS.ReloadPromptTitle' },
|
||||||
|
position: { width: 400 },
|
||||||
|
content: `<p>${game.i18n.localize('SETTINGS.ReloadPromptBody')}</p>`
|
||||||
|
});
|
||||||
|
|
||||||
|
if (reload) {
|
||||||
|
await game.socket.emit('reload');
|
||||||
|
foundry.utils.debouncedReload();
|
||||||
|
}
|
||||||
|
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel {
|
||||||
return {
|
return {
|
||||||
title: new fields.StringField(),
|
title: new fields.StringField(),
|
||||||
origin: new fields.StringField({ required: true }),
|
origin: new fields.StringField({ required: true }),
|
||||||
|
dice: new fields.DataField(),
|
||||||
roll: new fields.DataField(),
|
roll: new fields.DataField(),
|
||||||
modifiers: new fields.ArrayField(
|
modifiers: new fields.ArrayField(
|
||||||
new fields.SchemaField({
|
new fields.SchemaField({
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,12 @@ export default class DhpActor extends Actor {
|
||||||
}
|
}
|
||||||
formula += ` ${modifiers.map(x => `+ ${x.value}`).join(' ')}`;
|
formula += ` ${modifiers.map(x => `+ ${x.value}`).join(' ')}`;
|
||||||
const roll = await Roll.create(formula).evaluate();
|
const roll = await Roll.create(formula).evaluate();
|
||||||
roll.rolledDice = roll.dice; // Perpetuating getter field
|
const dice = roll.dice.flatMap(dice => ({
|
||||||
|
denomination: dice.denomination,
|
||||||
|
number: dice.number,
|
||||||
|
total: dice.total,
|
||||||
|
results: dice.results.map(result => ({ result: result.result, discarded: !result.active }))
|
||||||
|
}));
|
||||||
|
|
||||||
if (this.type === 'character') {
|
if (this.type === 'character') {
|
||||||
setDiceSoNiceForDualityRoll(roll, advantage);
|
setDiceSoNiceForDualityRoll(roll, advantage);
|
||||||
|
|
@ -246,6 +251,7 @@ export default class DhpActor extends Actor {
|
||||||
const configRoll = {
|
const configRoll = {
|
||||||
title: config.title,
|
title: config.title,
|
||||||
origin: this.id,
|
origin: this.id,
|
||||||
|
dice,
|
||||||
roll,
|
roll,
|
||||||
modifiers: modifiers.filter(x => x.label),
|
modifiers: modifiers.filter(x => x.label),
|
||||||
advantageState: advantage
|
advantageState: advantage
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<section class="tooltip-part">
|
<section class="tooltip-part">
|
||||||
<div class="dice">
|
<div class="dice">
|
||||||
{{#each roll.dice}}
|
{{#each dice}}
|
||||||
<header class="part-header flexrow">
|
<header class="part-header flexrow">
|
||||||
<span class="part-formula">{{number}}{{denomination}}</span>
|
<span class="part-formula">{{number}}{{denomination}}</span>
|
||||||
<span class="part-total">{{total}}</span>
|
<span class="part-total">{{total}}</span>
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<li class="roll die {{../denomination}}{{#if discarded}} discarded{{/if}} min">{{result}}</li>
|
<li class="roll die {{../denomination}}{{#if discarded}} discarded{{/if}} min">{{result}}</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ol>
|
</ol>
|
||||||
<div class="attack-roll-advantage-container">{{#if (eq ../advantageState 1)}}{{localize "DAGGERHEART.General.Advantage.Full"}}{{/if}}{{#if (eq ../advantageState 2)}}{{localize "DAGGERHEART.General.Disadvantage.Full"}}{{/if}}</div>
|
<div class="attack-roll-advantage-container">{{#if ../advantageState}}{{localize "DAGGERHEART.General.Advantage.Full"}}{{/if}}{{#if (eq ../advantageState false)}}{{localize "DAGGERHEART.General.Disadvantage.Full"}}{{/if}}</div>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,23 @@
|
||||||
<div class="dice-roll daggerheart chat roll">
|
<div class="dice-roll daggerheart chat roll" data-action="expandRoll">
|
||||||
<div class="dice-result">
|
<div class="dice-result">
|
||||||
<div class="dice-formula">{{roll.formula}}</div>
|
<div class="dice-formula">{{roll.formula}}</div>
|
||||||
<div class="dice-tooltip">
|
<div class="dice-tooltip">
|
||||||
<ol class="dice-rolls">
|
<ol class="dice-rolls">
|
||||||
<div class="dice-hope-container">
|
<div class="dice-hope-container">
|
||||||
{{#each roll.dice}}
|
{{#each dice}}
|
||||||
{{#each results}}
|
<header class="part-header flexrow">
|
||||||
<li class="roll die {{../denomination}}{{#if discarded}} discarded{{/if}}">{{result}}</li>
|
<span class="part-formula">{{number}}{{denomination}}</span>
|
||||||
|
<span class="part-total">{{total}}</span>
|
||||||
|
</header>
|
||||||
|
<div class="flexrow">
|
||||||
|
<ol class="dice-rolls">
|
||||||
|
{{#each results}}
|
||||||
|
<li class="roll die {{../denomination}}{{#if discarded}} discarded{{/if}} min">{{result}}</li>
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
|
<div class="attack-roll-advantage-container">{{#if ../advantageState}}{{localize "DAGGERHEART.General.Advantage.Full"}}{{/if}}{{#if (eq ../advantageState false)}}{{localize "DAGGERHEART.General.Disadvantage.Full"}}{{/if}}</div>
|
||||||
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/each}}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modifiers-container">
|
<div class="modifiers-container">
|
||||||
{{#each modifiers}}
|
{{#each modifiers}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue