mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
[BUG] DiceSoNice fix (#312)
* Fixed DiceSoNice integration again * PR fixes * Improved with tertiary
This commit is contained in:
parent
b3e7c6b9b2
commit
70239ec06a
4 changed files with 9 additions and 15 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import D20RollDialog from '../applications/dialogs/d20RollDialog.mjs';
|
||||
import { setDiceSoNiceForDualityRoll } from '../helpers/utils.mjs';
|
||||
import DHRoll from './dhRoll.mjs';
|
||||
|
||||
export default class D20Roll extends DHRoll {
|
||||
|
|
@ -137,12 +136,7 @@ export default class D20Roll extends DHRoll {
|
|||
|
||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||
if (config.evaluate !== false) await roll.evaluate();
|
||||
const advantageState =
|
||||
config.roll.advantage == this.ADV_MODE.ADVANTAGE
|
||||
? true
|
||||
: config.roll.advantage == this.ADV_MODE.DISADVANTAGE
|
||||
? false
|
||||
: null;
|
||||
|
||||
this.postEvaluate(roll, config);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ export const registerRollDiceHooks = () => {
|
|||
|
||||
if (updates.length) actor.modifyResource(updates);
|
||||
|
||||
if (!config.roll.hasOwnProperty('success') && !config.targets.length) return;
|
||||
if (!config.roll.hasOwnProperty('success') && !config.targets?.length) return;
|
||||
|
||||
const rollResult = config.roll.success || config.targets.some(t => t.hit),
|
||||
looseSpotlight = !rollResult || config.roll.result.duality === -1;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import D20RollDialog from '../applications/dialogs/d20RollDialog.mjs';
|
||||
import D20Roll from './d20Roll.mjs';
|
||||
import { setDiceSoNiceForDualityRoll } from '../helpers/utils.mjs';
|
||||
|
||||
export default class DualityRoll extends D20Roll {
|
||||
_advantageFaces = 6;
|
||||
|
|
@ -80,7 +81,6 @@ export default class DualityRoll extends D20Roll {
|
|||
}
|
||||
|
||||
static getHooks(hooks) {
|
||||
|
||||
return [...(hooks ?? []), 'Duality'];
|
||||
}
|
||||
|
||||
|
|
@ -142,5 +142,7 @@ export default class DualityRoll extends D20Roll {
|
|||
total: roll.dHope.total + roll.dFear.total,
|
||||
label: roll.totalLabel
|
||||
};
|
||||
|
||||
setDiceSoNiceForDualityRoll(roll, config.roll.advantage.type);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,12 +126,10 @@ export const setDiceSoNiceForDualityRoll = (rollResult, advantageState) => {
|
|||
const diceSoNicePresets = getDiceSoNicePresets();
|
||||
rollResult.dice[0].options = { appearance: diceSoNicePresets.hope };
|
||||
rollResult.dice[1].options = { appearance: diceSoNicePresets.fear }; //diceSoNicePresets.fear;
|
||||
if (rollResult.dice[2]) {
|
||||
if (advantageState === true) {
|
||||
rollResult.dice[2].options = { appearance: diceSoNicePresets.advantage };
|
||||
} else if (advantageState === false) {
|
||||
rollResult.dice[2].options = { appearance: diceSoNicePresets.disadvantage };
|
||||
}
|
||||
if (rollResult.dice[2] && advantageState) {
|
||||
rollResult.dice[2].options = {
|
||||
appearance: advantageState === 1 ? diceSoNicePresets.advantage : diceSoNicePresets.disadvantage
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue