mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +01:00
Merge branch 'main' into feature/Homebrew-Downtime-Actions
This commit is contained in:
commit
86ffca509f
13 changed files with 103 additions and 35 deletions
|
|
@ -36,10 +36,37 @@ export default class DHAppearanceSettings extends HandlebarsApplicationMixin(App
|
|||
}
|
||||
};
|
||||
|
||||
/** @inheritdoc */
|
||||
static TABS = {
|
||||
diceSoNice: {
|
||||
tabs: [
|
||||
{ id: 'hope', label: 'DAGGERHEART.GENERAL.hope' },
|
||||
{ id: 'fear', label: 'DAGGERHEART.GENERAL.fear' },
|
||||
{ id: 'advantage', label: 'DAGGERHEART.GENERAL.Advantage.full' },
|
||||
{ id: 'disadvantage', label: 'DAGGERHEART.GENERAL.Advantage.full' }
|
||||
],
|
||||
initial: 'hope'
|
||||
}
|
||||
};
|
||||
|
||||
changeTab(tab, group, options) {
|
||||
super.changeTab(tab, group, options);
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.settingFields = this.settings;
|
||||
|
||||
context.diceSoNiceTextures = game.dice3d?.exports?.TEXTURELIST ?? {};
|
||||
context.diceSoNiceColorsets = game.dice3d?.exports?.COLORSETS ?? {};
|
||||
context.diceTab = {
|
||||
key: this.tabGroups.diceSoNice,
|
||||
source: this.settings._source.diceSoNice[this.tabGroups.diceSoNice],
|
||||
fields: this.settings.schema.fields.diceSoNice.fields[this.tabGroups.diceSoNice].fields
|
||||
};
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
|
|
@ -65,4 +92,13 @@ export default class DHAppearanceSettings extends HandlebarsApplicationMixin(App
|
|||
|
||||
this.close();
|
||||
}
|
||||
|
||||
_getTabs(tabs) {
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active;
|
||||
v.cssClass = v.active ? 'active' : '';
|
||||
}
|
||||
|
||||
return tabs;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -517,9 +517,10 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
const item = getDocFromElement(event.currentTarget);
|
||||
if (!item) return;
|
||||
|
||||
const max = item.system.resource.max ? itemAbleRollParse(item.system.resource.max, this.document, item) : null;
|
||||
const max = event.currentTarget.max ? Number(event.currentTarget.max) : null;
|
||||
const value = max ? Math.min(Number(event.currentTarget.value), max) : event.currentTarget.value;
|
||||
await item.update({ 'system.resource.value': value });
|
||||
this.render();
|
||||
}
|
||||
|
||||
async updateItemQuantity(event) {
|
||||
|
|
@ -527,6 +528,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
if (!item) return;
|
||||
|
||||
await item.update({ 'system.quantity': event.currentTarget.value });
|
||||
this.render();
|
||||
}
|
||||
|
||||
async updateArmorMarks(event) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ const attributeField = label =>
|
|||
|
||||
const resourceField = (max = 0, label, reverse = false) =>
|
||||
new fields.SchemaField({
|
||||
value: new fields.NumberField({ initial: 0, integer: true, label }),
|
||||
value: new fields.NumberField({ initial: 0, min: 0, integer: true, label }),
|
||||
max: new fields.NumberField({ initial: max, integer: true }),
|
||||
isReversed: new fields.BooleanField({ initial: reverse })
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,25 +20,33 @@ export default class DhAppearance extends foundry.abstract.DataModel {
|
|||
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' })
|
||||
edge: new fields.ColorField({ required: true, initial: '#ffffff' }),
|
||||
texture: new fields.StringField({ initial: 'bloodmoon' }),
|
||||
colorset: new fields.StringField({ initial: 'inspired' })
|
||||
}),
|
||||
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' })
|
||||
edge: new fields.ColorField({ required: true, initial: '#000000' }),
|
||||
texture: new fields.StringField({ initial: 'bloodmoon' }),
|
||||
colorset: new fields.StringField({ initial: 'inspired' })
|
||||
}),
|
||||
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' })
|
||||
edge: new fields.ColorField({ required: true, initial: '#ffffff' }),
|
||||
texture: new fields.StringField({ initial: 'bloodmoon' }),
|
||||
colorset: new fields.StringField({ initial: 'inspired' })
|
||||
}),
|
||||
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' })
|
||||
edge: new fields.ColorField({ required: true, initial: '#000000' }),
|
||||
texture: new fields.StringField({ initial: 'bloodmoon' }),
|
||||
colorset: new fields.StringField({ initial: 'inspired' })
|
||||
})
|
||||
}),
|
||||
showGenericStatusEffects: new fields.BooleanField({
|
||||
|
|
|
|||
|
|
@ -568,13 +568,7 @@ export default class DhpActor extends Actor {
|
|||
}
|
||||
|
||||
convertDamageToThreshold(damage) {
|
||||
return damage >= this.system.damageThresholds.severe
|
||||
? 3
|
||||
: damage >= this.system.damageThresholds.major
|
||||
? 2
|
||||
: damage >= this.system.damageThresholds.minor
|
||||
? 1
|
||||
: 0;
|
||||
return damage >= this.system.damageThresholds.severe ? 3 : damage >= this.system.damageThresholds.major ? 2 : 1;
|
||||
}
|
||||
|
||||
convertStressDamageToHP(resources) {
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ export default class RegisterHandlebarsHelpers {
|
|||
|
||||
static rollParsed(value, actor, item, numerical) {
|
||||
const isNumerical = typeof numerical === 'boolean' ? numerical : false;
|
||||
const result = itemAbleRollParse(value, actor, item);
|
||||
return isNumerical && !result ? 0 : result;
|
||||
const result = itemAbleRollParse(value, actor.getRollData(), item);
|
||||
return isNumerical ? (!result ? 0 : Number(result)) : result;
|
||||
}
|
||||
|
||||
static setVar(name, value, context) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue