mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-19 00:19:03 +01:00
* Update the death move descriptions * Renamed to DhDeathMove * Partial Fate Roll creation and Fate Roll Enricher (/fr) * Hide stuff not required for fate roll * Hide formula display; code removal; start to add Fear die as a choice for Fate roll * Fix chat message display; start moving towards supporting Hope and Fear for Fate roll * /fr now supports type=X, where X is Hope or Fear, if not supplied, defaults to Hope * Fixed DSN rolling; removed console messages; chat message clean up * Add localisation entry * Trying to sort out the button for the fate roll * Style the fate message based on Hope/Fear colors. * Partial improvement on the fate template buttons - chat display is correct, but the roll dialog is wrong * Fixed enricher button; localization fixes; debug cleanup * Error checking for the fate type parsing in all potential problem locations * Added localization for the fate type parsing error * Start on Avoid Death death move * debug stuff * More death moves setup/testing * Avoid fate scars update in place, with scars migrating to an integer value. * Remove some debug code; add Blaze Of Glory shell * Start on Guaranteed Critical for Blaze of Glory * Partial implementation of Blaze of Glory * Dice/critical checks/tests * Moved detection of guaranteed critical to before the roll dialog is created, so it can be skipped; removed debug code * Remove debug * Update Blaze of Glory effect description * Risk It All - critical roll - clear all stress and HP * Auto remove all marked stress and HP for Risk It All, if Hope value rolled covers it. * Display the Death Move description in chat expanded if the appropriate config setting is on * Made the Blaze of Glory ActiveEffect image use configured version * Update the current Hope value if the scar value change affects it * Scars management in the Character details editor * Separate less file for the Death Moves instead of reusing Downtime * Added result messages to the Death Move chat output and removed debug statements * Some localization, style and smaller changes * Fixed RiskItAll resource handling method * Risk It All success chat message start * [Add] Hope/Scar Interplay (#1531) * Migrated character.maxHope to homebrew settings * Added a visual for scars * . * . * Pass the hope value in the button data; skeleton risk it all dialog to fill out. * Start on risk it dialog * More dialog stuff * Remove non-existent field * Dialog templating and logic * . * Ensure effect is Applied to Actor (#1547) Co-authored-by: Chris Ryan <chrisr@blackhole> * [Fix] 1548 - Standalone Item Add Actions (#1549) * Fixed so that items not on an actor don't error out on creating actions * Fixed deletion of items error * Raised version * Fix the sliders to do the correct maximums * Pass the actor id through the button; fix /dr and /fr flavor text * Remove debug message --------- Co-authored-by: Chris Ryan <chrisr@blackhole> Co-authored-by: WBHarry <williambjrklund@gmail.com> Co-authored-by: WBHarry <89362246+WBHarry@users.noreply.github.com>
200 lines
8.8 KiB
JavaScript
200 lines
8.8 KiB
JavaScript
import { defaultRestOptions } from '../../config/generalConfig.mjs';
|
|
import { ActionsField } from '../fields/actionField.mjs';
|
|
|
|
const currencyField = (initial, label, icon) =>
|
|
new foundry.data.fields.SchemaField({
|
|
enabled: new foundry.data.fields.BooleanField({ required: true, initial: true }),
|
|
label: new foundry.data.fields.StringField({
|
|
required: true,
|
|
initial,
|
|
label
|
|
}),
|
|
icon: new foundry.data.fields.StringField({ required: true, nullable: false, blank: true, initial: icon })
|
|
});
|
|
|
|
export default class DhHomebrew extends foundry.abstract.DataModel {
|
|
static defineSchema() {
|
|
const fields = foundry.data.fields;
|
|
return {
|
|
maxFear: new fields.NumberField({
|
|
required: true,
|
|
integer: true,
|
|
min: 0,
|
|
initial: 12,
|
|
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxFear.label'
|
|
}),
|
|
maxHope: new fields.NumberField({
|
|
required: true,
|
|
integer: true,
|
|
min: 0,
|
|
initial: 6,
|
|
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxHope.label'
|
|
}),
|
|
maxLoadout: new fields.NumberField({
|
|
required: true,
|
|
integer: true,
|
|
min: 0,
|
|
initial: 5,
|
|
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxLoadout.label'
|
|
}),
|
|
maxDomains: new fields.NumberField({
|
|
required: true,
|
|
integer: true,
|
|
min: 1,
|
|
initial: 2,
|
|
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxDomains.label'
|
|
}),
|
|
traitArray: new fields.ArrayField(new fields.NumberField({ required: true, integer: true }), {
|
|
initial: () => [2, 1, 1, 0, 0, -1]
|
|
}),
|
|
tokenSizes: new fields.SchemaField({
|
|
tiny: new fields.NumberField({
|
|
integer: false,
|
|
initial: 0.5,
|
|
label: 'DAGGERHEART.CONFIG.TokenSize.tiny'
|
|
}),
|
|
small: new fields.NumberField({
|
|
integer: false,
|
|
initial: 0.8,
|
|
label: 'DAGGERHEART.CONFIG.TokenSize.small'
|
|
}),
|
|
medium: new fields.NumberField({
|
|
integer: false,
|
|
initial: 1,
|
|
label: 'DAGGERHEART.CONFIG.TokenSize.medium'
|
|
}),
|
|
large: new fields.NumberField({
|
|
integer: false,
|
|
initial: 2,
|
|
label: 'DAGGERHEART.CONFIG.TokenSize.large'
|
|
}),
|
|
huge: new fields.NumberField({
|
|
integer: false,
|
|
initial: 3,
|
|
label: 'DAGGERHEART.CONFIG.TokenSize.huge'
|
|
}),
|
|
gargantuan: new fields.NumberField({
|
|
integer: false,
|
|
initial: 4,
|
|
label: 'DAGGERHEART.CONFIG.TokenSize.gargantuan'
|
|
})
|
|
}),
|
|
currency: new fields.SchemaField({
|
|
title: new fields.StringField({
|
|
required: true,
|
|
initial: 'Gold',
|
|
label: 'DAGGERHEART.SETTINGS.Homebrew.currency.currencyName'
|
|
}),
|
|
coins: currencyField(
|
|
'Coins',
|
|
'DAGGERHEART.SETTINGS.Homebrew.currency.coinName',
|
|
'fa-solid fa-coin-front'
|
|
),
|
|
handfuls: currencyField(
|
|
'Handfuls',
|
|
'DAGGERHEART.SETTINGS.Homebrew.currency.handfulName',
|
|
'fa-solid fa-coins'
|
|
),
|
|
bags: currencyField('Bags', 'DAGGERHEART.SETTINGS.Homebrew.currency.bagName', 'fa-solid fa-sack'),
|
|
chests: currencyField(
|
|
'Chests',
|
|
'DAGGERHEART.SETTINGS.Homebrew.currency.chestName',
|
|
'fa-solid fa-treasure-chest'
|
|
)
|
|
}),
|
|
restMoves: new fields.SchemaField({
|
|
longRest: new fields.SchemaField({
|
|
nrChoices: new fields.NumberField({ required: true, integer: true, min: 1, initial: 2 }),
|
|
moves: new fields.TypedObjectField(
|
|
new fields.SchemaField({
|
|
name: new fields.StringField({ required: true }),
|
|
icon: new fields.StringField({ required: true }),
|
|
img: new fields.FilePathField({
|
|
initial: 'icons/magic/life/cross-worn-green.webp',
|
|
categories: ['IMAGE'],
|
|
base64: false
|
|
}),
|
|
description: new fields.HTMLField(),
|
|
actions: new ActionsField()
|
|
}),
|
|
{ initial: defaultRestOptions.longRest() }
|
|
)
|
|
}),
|
|
shortRest: new fields.SchemaField({
|
|
nrChoices: new fields.NumberField({ required: true, integer: true, min: 1, initial: 2 }),
|
|
moves: new fields.TypedObjectField(
|
|
new fields.SchemaField({
|
|
name: new fields.StringField({ required: true }),
|
|
icon: new fields.StringField({ required: true }),
|
|
img: new fields.FilePathField({
|
|
initial: 'icons/magic/life/cross-worn-green.webp',
|
|
categories: ['IMAGE'],
|
|
base64: false
|
|
}),
|
|
description: new fields.HTMLField(),
|
|
actions: new ActionsField()
|
|
}),
|
|
{ initial: defaultRestOptions.shortRest() }
|
|
)
|
|
})
|
|
}),
|
|
domains: new fields.TypedObjectField(
|
|
new fields.SchemaField({
|
|
id: new fields.StringField({ required: true }),
|
|
label: new fields.StringField({ required: true, initial: '', label: 'DAGGERHEART.GENERAL.label' }),
|
|
src: new fields.FilePathField({
|
|
categories: ['IMAGE'],
|
|
base64: false,
|
|
label: 'Image'
|
|
}),
|
|
description: new fields.HTMLField()
|
|
})
|
|
),
|
|
adversaryTypes: new fields.TypedObjectField(
|
|
new fields.SchemaField({
|
|
id: new fields.StringField({ required: true }),
|
|
label: new fields.StringField({ required: true, label: 'DAGGERHEART.GENERAL.label' }),
|
|
description: new fields.StringField()
|
|
})
|
|
),
|
|
itemFeatures: new fields.SchemaField({
|
|
weaponFeatures: new fields.TypedObjectField(
|
|
new fields.SchemaField({
|
|
name: new fields.StringField({ required: true }),
|
|
img: new fields.FilePathField({
|
|
initial: 'icons/magic/life/cross-worn-green.webp',
|
|
categories: ['IMAGE'],
|
|
base64: false
|
|
}),
|
|
description: new fields.HTMLField(),
|
|
actions: new ActionsField(),
|
|
effects: new fields.ArrayField(new fields.ObjectField())
|
|
})
|
|
),
|
|
armorFeatures: new fields.TypedObjectField(
|
|
new fields.SchemaField({
|
|
name: new fields.StringField({ required: true }),
|
|
img: new fields.FilePathField({
|
|
initial: 'icons/magic/life/cross-worn-green.webp',
|
|
categories: ['IMAGE'],
|
|
base64: false
|
|
}),
|
|
description: new fields.HTMLField(),
|
|
actions: new ActionsField(),
|
|
effects: new fields.ArrayField(new fields.ObjectField())
|
|
})
|
|
)
|
|
})
|
|
};
|
|
}
|
|
|
|
/** @inheritDoc */
|
|
_initializeSource(source, options = {}) {
|
|
source = super._initializeSource(source, options);
|
|
for (const type of ['coins', 'handfuls', 'bags', 'chests']) {
|
|
const initial = this.schema.fields.currency.fields[type].getInitialValue();
|
|
source.currency[type] = foundry.utils.mergeObject(initial, source.currency[type], { inplace: false });
|
|
}
|
|
return source;
|
|
}
|
|
}
|