mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Updated DiceSoNice for Duality Rolls
This commit is contained in:
parent
233a3a5407
commit
d81c28ed09
4 changed files with 69 additions and 48 deletions
|
|
@ -11,7 +11,7 @@ import DhpPlayers from './module/ui/players.mjs';
|
|||
import DhpRuler from './module/ui/ruler.mjs';
|
||||
import DhpTokenRuler from './module/ui/tokenRuler.mjs';
|
||||
import { dualityRollEnricher, getDualityMessage } from './module/enrichers/DualityRollEnricher.mjs';
|
||||
import { getCommandTarget, rollCommandToJSON } from './module/helpers/utils.mjs';
|
||||
import { getCommandTarget, rollCommandToJSON, setDiceSoNiceForDualityRoll } from './module/helpers/utils.mjs';
|
||||
import { abilities } from './module/config/actorConfig.mjs';
|
||||
|
||||
globalThis.SYSTEM = SYSTEM;
|
||||
|
|
@ -213,6 +213,13 @@ Hooks.on('chatMessage', (_, message) => {
|
|||
const attributeRoll = `${attribute?.data?.value ? `${attribute.data.value > 0 ? `+${attribute.data.value}` : `${attribute.data.value}`}` : ''}`;
|
||||
const roll = new Roll(`${hopeAndFearRoll}${advantageRoll}${attributeRoll}`);
|
||||
await roll.evaluate();
|
||||
|
||||
setDiceSoNiceForDualityRoll(
|
||||
roll,
|
||||
rollCommand.advantage && !rollCommand.disadvantage,
|
||||
rollCommand.disadvantage && !rollCommand.advantage
|
||||
);
|
||||
|
||||
resolve({
|
||||
roll,
|
||||
attribute: attribute
|
||||
|
|
|
|||
|
|
@ -247,6 +247,53 @@ export const diceTypes = {
|
|||
d20: 'd20'
|
||||
};
|
||||
|
||||
export const diceSoNicePresets = {
|
||||
hope: {
|
||||
colorset: 'inspired',
|
||||
foreground: '#FFFFFF',
|
||||
background: '#ffe760',
|
||||
outline: '#000000',
|
||||
edge: '#FFFFFF',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
},
|
||||
fear: {
|
||||
colorset: 'bloodmoon',
|
||||
foreground: '#000000',
|
||||
background: '#0032b1',
|
||||
outline: '#FFFFFF',
|
||||
edge: '#000000',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
},
|
||||
advantage: {
|
||||
colorset: 'bloodmoon',
|
||||
foreground: '#FFFFFF',
|
||||
background: '#008000',
|
||||
outline: '#000000',
|
||||
edge: '#FFFFFF',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
},
|
||||
disadvantage: {
|
||||
colorset: 'bloodmoon',
|
||||
foreground: '#000000',
|
||||
background: '#b30000',
|
||||
outline: '#FFFFFF',
|
||||
edge: '#000000',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
}
|
||||
};
|
||||
|
||||
export const refreshTypes = {
|
||||
session: {
|
||||
id: 'session',
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import DamageSelectionDialog from '../applications/damageSelectionDialog.mjs';
|
|||
import NpcRollSelectionDialog from '../applications/npcRollSelectionDialog.mjs';
|
||||
import RollSelectionDialog from '../applications/rollSelectionDialog.mjs';
|
||||
import { GMUpdateEvent, socketEvent } from '../helpers/socket.mjs';
|
||||
import { setDiceSoNiceForDualityRoll } from '../helpers/utils.mjs';
|
||||
|
||||
export default class DhpActor extends Actor {
|
||||
_preCreate(data, changes, user) {
|
||||
|
|
@ -164,53 +165,7 @@ export default class DhpActor extends Actor {
|
|||
`1${hopeDice} + 1${fearDice}${advantageDice ? ` + 1${advantageDice}` : disadvantageDice ? ` - 1${disadvantageDice}` : ''} ${modifiers.map(x => `+ ${x.value}`).join(' ')}`
|
||||
);
|
||||
let rollResult = await roll.evaluate();
|
||||
rollResult.dice[0].options.appearance = {
|
||||
colorset: 'inspired',
|
||||
foreground: '#FFFFFF',
|
||||
background: '#008080',
|
||||
outline: '#000000',
|
||||
edge: '#806400',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
};
|
||||
if (advantageDice || disadvantageDice) {
|
||||
rollResult.dice[1].options.appearance = {
|
||||
colorset: 'inspired',
|
||||
foreground: disadvantageDice ? '#b30000' : '#FFFFFF',
|
||||
background: '#008080',
|
||||
outline: disadvantageDice ? '#000000' : '#000000',
|
||||
edge: '#806400',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
};
|
||||
rollResult.dice[2].options.appearance = {
|
||||
colorset: 'bloodmoon',
|
||||
foreground: '#000000',
|
||||
background: '#430070',
|
||||
outline: '#b30000',
|
||||
edge: '#000000',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
};
|
||||
} else {
|
||||
rollResult.dice[1].options.appearance = {
|
||||
colorset: 'bloodmoon',
|
||||
foreground: '#000000',
|
||||
background: '#430070',
|
||||
outline: '#b30000',
|
||||
edge: '#000000',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
};
|
||||
}
|
||||
setDiceSoNiceForDualityRoll(rollResult, advantageDice, disadvantageDice);
|
||||
|
||||
const hope = rollResult.dice[0].results[0].result;
|
||||
const fear = rollResult.dice[1].results[0].result;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { diceSoNicePresets } from '../config/generalConfig.mjs';
|
||||
|
||||
export const loadCompendiumOptions = async compendiums => {
|
||||
const compendiumValues = [];
|
||||
|
||||
|
|
@ -118,3 +120,13 @@ export const getCommandTarget = () => {
|
|||
|
||||
return target;
|
||||
};
|
||||
|
||||
export const setDiceSoNiceForDualityRoll = (rollResult, advantage, disadvantage) => {
|
||||
rollResult.dice[0].options.appearance = diceSoNicePresets.hope;
|
||||
rollResult.dice[1].options.appearance = diceSoNicePresets.fear;
|
||||
if (advantage) {
|
||||
rollResult.dice[2].options.appearance = diceSoNicePresets.advantage;
|
||||
} else if (disadvantage) {
|
||||
rollResult.dice[2].options.appearance = diceSoNicePresets.disadvantage;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue