mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Fix chat message display; start moving towards supporting Hope and Fear for Fate roll
This commit is contained in:
parent
fda1581c51
commit
bfd8031ecf
4 changed files with 81 additions and 54 deletions
|
|
@ -119,6 +119,7 @@ export default class DualityRoll extends D20Roll {
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static fromData(data) {
|
static fromData(data) {
|
||||||
|
console.log("data", data);
|
||||||
data.terms[0].class = foundry.dice.terms.Die.name;
|
data.terms[0].class = foundry.dice.terms.Die.name;
|
||||||
data.terms[2].class = foundry.dice.terms.Die.name;
|
data.terms[2].class = foundry.dice.terms.Die.name;
|
||||||
return super.fromData(data);
|
return super.fromData(data);
|
||||||
|
|
@ -174,6 +175,9 @@ export default class DualityRoll extends D20Roll {
|
||||||
|
|
||||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||||
await super.buildEvaluate(roll, config, message);
|
await super.buildEvaluate(roll, config, message);
|
||||||
|
console.log("roll", config);
|
||||||
|
console.log("config", config);
|
||||||
|
console.log("message", message);
|
||||||
|
|
||||||
await setDiceSoNiceForDualityRoll(
|
await setDiceSoNiceForDualityRoll(
|
||||||
roll,
|
roll,
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ export default class FateRoll extends D20Roll {
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static fromData(data) {
|
static fromData(data) {
|
||||||
|
console.log("data", data);
|
||||||
data.terms[0].class = foundry.dice.terms.Die.name;
|
data.terms[0].class = foundry.dice.terms.Die.name;
|
||||||
return super.fromData(data);
|
return super.fromData(data);
|
||||||
}
|
}
|
||||||
|
|
@ -59,19 +60,23 @@ export default class FateRoll extends D20Roll {
|
||||||
|
|
||||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||||
await super.buildEvaluate(roll, config, message);
|
await super.buildEvaluate(roll, config, message);
|
||||||
|
console.log("roll", config);
|
||||||
|
console.log("config", config);
|
||||||
|
console.log("message", message);
|
||||||
|
|
||||||
await setDiceSoNiceForFateRoll(
|
await setDiceSoNiceForFateRoll(
|
||||||
roll,
|
roll,
|
||||||
config.roll.hope.dice
|
config.roll.fate.dice
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static postEvaluate(roll, config = {}) {
|
static postEvaluate(roll, config = {}) {
|
||||||
const data = super.postEvaluate(roll, config);
|
const data = super.postEvaluate(roll, config);
|
||||||
|
|
||||||
data.hope = {
|
data.fate = {
|
||||||
dice: roll.dHope.denomination,
|
dice: roll.dHope.denomination,
|
||||||
value: roll.dHope.total,
|
value: roll.dHope.total,
|
||||||
|
fateDie: roll.fateDie
|
||||||
};
|
};
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ function getFateMessage(roll, flavor) {
|
||||||
data-title="${label}"
|
data-title="${label}"
|
||||||
data-label="${dataLabel}"
|
data-label="${dataLabel}"
|
||||||
data-hope="${roll?.hope ?? 'd12'}"
|
data-hope="${roll?.hope ?? 'd12'}"
|
||||||
data-fear="${roll?.fear ?? 'd12'}"
|
|
||||||
${label}
|
${label}
|
||||||
</button>
|
</button>
|
||||||
`;
|
`;
|
||||||
|
|
|
||||||
|
|
@ -29,58 +29,77 @@
|
||||||
<div class="dice-tooltip">
|
<div class="dice-tooltip">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="roll-dice">
|
<div class="roll-dice">
|
||||||
{{#if roll.hope}}
|
{{#if roll.fate}}
|
||||||
<div class="roll-die">
|
{{#if (eq roll.fate.fateDie "Hope")}}
|
||||||
<label>{{localize "DAGGERHEART.GENERAL.hope"}}</label>
|
<div class="roll-die">
|
||||||
<div class="dice {{roll.hope.dice}} color-hope reroll-button" data-die-index="0" data-type="hope" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}">
|
<label>{{localize "DAGGERHEART.GENERAL.hope"}}</label>
|
||||||
{{#if roll.hope.rerolled.any}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.diceIsRerolled" times=roll.hope.rerolled.rerolls.length}}"></i>{{/if}}
|
<div class="dice {{roll.fate.dice}} color-hope" data-die-index="0" data-type="hope">
|
||||||
{{roll.hope.value}}
|
{{roll.fate.value}}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="roll-die has-plus">
|
|
||||||
<label>{{localize "DAGGERHEART.GENERAL.fear"}}</label>
|
|
||||||
<div class="dice {{roll.fear.dice}} color-fear reroll-button" data-die-index="2" data-type="fear" style="--svg-folder: 'fear';" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}">
|
|
||||||
{{#if roll.fear.rerolled.any}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.diceIsRerolled" times=roll.fear.rerolled.rerolls.length}}"></i>{{/if}}
|
|
||||||
{{roll.fear.value}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{#if roll.advantage.type}}
|
|
||||||
<div class="roll-die has-plus">
|
|
||||||
{{#if (eq roll.advantage.type 1)}}
|
|
||||||
<label>{{localize "DAGGERHEART.GENERAL.Advantage.short"}}</label>
|
|
||||||
<div class="dice {{roll.advantage.dice}} color-adv">{{roll.advantage.value}}</div>
|
|
||||||
{{else}}
|
|
||||||
<label>{{localize "DAGGERHEART.GENERAL.Disadvantage.short"}}</label>
|
|
||||||
<div class="dice {{roll.advantage.dice}} color-dis">{{roll.advantage.value}}</div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{#if roll.rally.dice}}
|
|
||||||
<div class="roll-die has-plus">
|
|
||||||
<label>{{localize "DAGGERHEART.CLASS.Feature.short"}}</label>
|
|
||||||
<div class="dice {{roll.rally.dice}}">{{roll.rally.value}}</div>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{#each roll.extra}}
|
|
||||||
{{#each results}}
|
|
||||||
{{#unless discarded}}
|
|
||||||
<div class="roll-die has-plus">
|
|
||||||
<label></label>
|
|
||||||
<div class="dice {{../dice}}">{{result}}</div>
|
|
||||||
</div>
|
|
||||||
{{/unless}}
|
|
||||||
{{/each}}
|
|
||||||
{{/each}}
|
|
||||||
{{else}}
|
|
||||||
{{#each roll.dice}}
|
|
||||||
{{#each results}}
|
|
||||||
<div class="roll-die {{#unless (or @../first discarded)}} has-plus{{/unless}}">
|
|
||||||
<div class="dice {{../dice}}{{#if discarded}} discarded{{else}}{{#if (and @../first ../../roll.advantage.type)}}{{#if (eq ../../roll.advantage.type 1)}} color-adv{{else}} color-dis{{/if}}{{/if}}{{#if success}} color-adv{{/if}}{{/if}}">
|
|
||||||
{{result}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{#if (eq roll.fate.fateDie "Fear")}}
|
||||||
|
<div class="roll-die">
|
||||||
|
<label>{{localize "DAGGERHEART.GENERAL.fear"}}</label>
|
||||||
|
<div class="dice {{roll.fate.dice}} color-fear" data-die-index="0" data-type="fear">
|
||||||
|
{{roll.fate.value}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{#if roll.hope}}
|
||||||
|
<div class="roll-die">
|
||||||
|
<label>{{localize "DAGGERHEART.GENERAL.hope"}}</label>
|
||||||
|
<div class="dice {{roll.hope.dice}} color-hope reroll-button" data-die-index="0" data-type="hope" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}">
|
||||||
|
{{#if roll.hope.rerolled.any}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.diceIsRerolled" times=roll.hope.rerolled.rerolls.length}}"></i>{{/if}}
|
||||||
|
{{roll.hope.value}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="roll-die has-plus">
|
||||||
|
<label>{{localize "DAGGERHEART.GENERAL.fear"}}</label>
|
||||||
|
<div class="dice {{roll.fear.dice}} color-fear reroll-button" data-die-index="2" data-type="fear" style="--svg-folder: 'fear';" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}">
|
||||||
|
{{#if roll.fear.rerolled.any}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.diceIsRerolled" times=roll.fear.rerolled.rerolls.length}}"></i>{{/if}}
|
||||||
|
{{roll.fear.value}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{#if roll.advantage.type}}
|
||||||
|
<div class="roll-die has-plus">
|
||||||
|
{{#if (eq roll.advantage.type 1)}}
|
||||||
|
<label>{{localize "DAGGERHEART.GENERAL.Advantage.short"}}</label>
|
||||||
|
<div class="dice {{roll.advantage.dice}} color-adv">{{roll.advantage.value}}</div>
|
||||||
|
{{else}}
|
||||||
|
<label>{{localize "DAGGERHEART.GENERAL.Disadvantage.short"}}</label>
|
||||||
|
<div class="dice {{roll.advantage.dice}} color-dis">{{roll.advantage.value}}</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{#if roll.rally.dice}}
|
||||||
|
<div class="roll-die has-plus">
|
||||||
|
<label>{{localize "DAGGERHEART.CLASS.Feature.short"}}</label>
|
||||||
|
<div class="dice {{roll.rally.dice}}">{{roll.rally.value}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{#each roll.extra}}
|
||||||
|
{{#each results}}
|
||||||
|
{{#unless discarded}}
|
||||||
|
<div class="roll-die has-plus">
|
||||||
|
<label></label>
|
||||||
|
<div class="dice {{../dice}}">{{result}}</div>
|
||||||
|
</div>
|
||||||
|
{{/unless}}
|
||||||
|
{{/each}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/each}}
|
{{else}}
|
||||||
|
{{#each roll.dice}}
|
||||||
|
{{#each results}}
|
||||||
|
<div class="roll-die {{#unless (or @../first discarded)}} has-plus{{/unless}}">
|
||||||
|
<div class="dice {{../dice}}{{#if discarded}} discarded{{else}}{{#if (and @../first ../../roll.advantage.type)}}{{#if (eq ../../roll.advantage.type 1)}} color-adv{{else}} color-dis{{/if}}{{/if}}{{#if success}} color-adv{{/if}}{{/if}}">
|
||||||
|
{{result}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -89,4 +108,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue