mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-16 13:41:07 +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 DhpRuler from './module/ui/ruler.mjs';
|
||||||
import DhpTokenRuler from './module/ui/tokenRuler.mjs';
|
import DhpTokenRuler from './module/ui/tokenRuler.mjs';
|
||||||
import { dualityRollEnricher, getDualityMessage } from './module/enrichers/DualityRollEnricher.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';
|
import { abilities } from './module/config/actorConfig.mjs';
|
||||||
|
|
||||||
globalThis.SYSTEM = SYSTEM;
|
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 attributeRoll = `${attribute?.data?.value ? `${attribute.data.value > 0 ? `+${attribute.data.value}` : `${attribute.data.value}`}` : ''}`;
|
||||||
const roll = new Roll(`${hopeAndFearRoll}${advantageRoll}${attributeRoll}`);
|
const roll = new Roll(`${hopeAndFearRoll}${advantageRoll}${attributeRoll}`);
|
||||||
await roll.evaluate();
|
await roll.evaluate();
|
||||||
|
|
||||||
|
setDiceSoNiceForDualityRoll(
|
||||||
|
roll,
|
||||||
|
rollCommand.advantage && !rollCommand.disadvantage,
|
||||||
|
rollCommand.disadvantage && !rollCommand.advantage
|
||||||
|
);
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
roll,
|
roll,
|
||||||
attribute: attribute
|
attribute: attribute
|
||||||
|
|
|
||||||
|
|
@ -247,6 +247,53 @@ export const diceTypes = {
|
||||||
d20: 'd20'
|
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 = {
|
export const refreshTypes = {
|
||||||
session: {
|
session: {
|
||||||
id: 'session',
|
id: 'session',
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import DamageSelectionDialog from '../applications/damageSelectionDialog.mjs';
|
||||||
import NpcRollSelectionDialog from '../applications/npcRollSelectionDialog.mjs';
|
import NpcRollSelectionDialog from '../applications/npcRollSelectionDialog.mjs';
|
||||||
import RollSelectionDialog from '../applications/rollSelectionDialog.mjs';
|
import RollSelectionDialog from '../applications/rollSelectionDialog.mjs';
|
||||||
import { GMUpdateEvent, socketEvent } from '../helpers/socket.mjs';
|
import { GMUpdateEvent, socketEvent } from '../helpers/socket.mjs';
|
||||||
|
import { setDiceSoNiceForDualityRoll } from '../helpers/utils.mjs';
|
||||||
|
|
||||||
export default class DhpActor extends Actor {
|
export default class DhpActor extends Actor {
|
||||||
_preCreate(data, changes, user) {
|
_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(' ')}`
|
`1${hopeDice} + 1${fearDice}${advantageDice ? ` + 1${advantageDice}` : disadvantageDice ? ` - 1${disadvantageDice}` : ''} ${modifiers.map(x => `+ ${x.value}`).join(' ')}`
|
||||||
);
|
);
|
||||||
let rollResult = await roll.evaluate();
|
let rollResult = await roll.evaluate();
|
||||||
rollResult.dice[0].options.appearance = {
|
setDiceSoNiceForDualityRoll(rollResult, advantageDice, disadvantageDice);
|
||||||
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'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const hope = rollResult.dice[0].results[0].result;
|
const hope = rollResult.dice[0].results[0].result;
|
||||||
const fear = rollResult.dice[1].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 => {
|
export const loadCompendiumOptions = async compendiums => {
|
||||||
const compendiumValues = [];
|
const compendiumValues = [];
|
||||||
|
|
||||||
|
|
@ -118,3 +120,13 @@ export const getCommandTarget = () => {
|
||||||
|
|
||||||
return target;
|
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