Duality Roll Followup (#65)

* Moved the roll total to bottom right. A bunch of label fixes
* Fixed broken attack-roll damage button
* Added AppearanceMenu allowing modification of DiceSoNice Duality presets
This commit is contained in:
WBHarry 2025-05-27 20:07:47 +02:00 committed by GitHub
parent 6fcfce227a
commit c4a03b2d54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 685 additions and 400 deletions

View file

@ -1,4 +1,4 @@
import { DualityRollColor } from '../config/settingsConfig.mjs';
import { DualityRollColor } from './settings/Appearance.mjs';
const fields = foundry.data.fields;
const diceField = () =>
@ -81,7 +81,7 @@ export default class DhpDualityRoll extends foundry.abstract.TypeDataModel {
const total = this.modifiers.reduce((acc, x) => acc + x.value, 0);
return {
value: total,
label: total > 0 ? `+${total}` : total < 0 ? `-${total}` : ''
label: total > 0 ? `+${total}` : total < 0 ? `${total}` : ''
};
}
@ -106,7 +106,7 @@ export default class DhpDualityRoll extends foundry.abstract.TypeDataModel {
get colorful() {
return (
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.DualityRollColor) ===
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme ===
DualityRollColor.colorful.value
);
}

View file

@ -0,0 +1,51 @@
export default class DhAppearance extends foundry.abstract.DataModel {
static defineSchema() {
const fields = foundry.data.fields;
return {
dualityColorScheme: new fields.StringField({
required: true,
choices: DualityRollColor,
initial: DualityRollColor.normal.value
}),
diceSoNice: new fields.SchemaField({
hope: new fields.SchemaField({
foreground: new fields.ColorField({ required: true, initial: '#ffffff' }),
background: new fields.ColorField({ required: true, initial: '#ffe760' }),
outline: new fields.ColorField({ required: true, initial: '#000000' }),
edge: new fields.ColorField({ required: true, initial: '#ffffff' })
}),
fear: new fields.SchemaField({
foreground: new fields.ColorField({ required: true, initial: '#000000' }),
background: new fields.ColorField({ required: true, initial: '#0032b1' }),
outline: new fields.ColorField({ required: true, initial: '#ffffff' }),
edge: new fields.ColorField({ required: true, initial: '#000000' })
}),
advantage: new fields.SchemaField({
foreground: new fields.ColorField({ required: true, initial: '#ffffff' }),
background: new fields.ColorField({ required: true, initial: '#008000' }),
outline: new fields.ColorField({ required: true, initial: '#000000' }),
edge: new fields.ColorField({ required: true, initial: '#ffffff' })
}),
disadvantage: new fields.SchemaField({
foreground: new fields.ColorField({ required: true, initial: '#000000' }),
background: new fields.ColorField({ required: true, initial: '#b30000' }),
outline: new fields.ColorField({ required: true, initial: '#ffffff' }),
edge: new fields.ColorField({ required: true, initial: '#000000' })
})
})
};
}
static defaultSchema = {};
}
export const DualityRollColor = {
colorful: {
value: 'colorful',
label: 'DAGGERHEART.Settings.DualityRollColor.Options.Colorful'
},
normal: {
value: 'normal',
label: 'DAGGERHEART.Settings.DualityRollColor.Options.Normal'
}
};