mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
custom defeated icons (#1241)
This commit is contained in:
parent
ff79dd19bf
commit
659670c403
5 changed files with 65 additions and 38 deletions
|
|
@ -34,15 +34,6 @@ Hooks.once('init', () => {
|
||||||
|
|
||||||
CONFIG.TextEditor.enrichers.push(...enricherConfig);
|
CONFIG.TextEditor.enrichers.push(...enricherConfig);
|
||||||
|
|
||||||
CONFIG.statusEffects = [
|
|
||||||
...CONFIG.statusEffects.filter(x => !['dead', 'unconscious'].includes(x.id)),
|
|
||||||
...Object.values(SYSTEM.GENERAL.conditions).map(x => ({
|
|
||||||
...x,
|
|
||||||
name: game.i18n.localize(x.name),
|
|
||||||
systemEffect: true
|
|
||||||
}))
|
|
||||||
];
|
|
||||||
|
|
||||||
CONFIG.Dice.daggerheart = {
|
CONFIG.Dice.daggerheart = {
|
||||||
DHRoll: DHRoll,
|
DHRoll: DHRoll,
|
||||||
DualityRoll: DualityRoll,
|
DualityRoll: DualityRoll,
|
||||||
|
|
@ -160,6 +151,17 @@ Hooks.once('init', () => {
|
||||||
return handlebarsRegistration();
|
return handlebarsRegistration();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Hooks.on('setup', () => {
|
||||||
|
CONFIG.statusEffects = [
|
||||||
|
...CONFIG.statusEffects.filter(x => !['dead', 'unconscious'].includes(x.id)),
|
||||||
|
...Object.values(SYSTEM.GENERAL.conditions()).map(x => ({
|
||||||
|
...x,
|
||||||
|
name: game.i18n.localize(x.name),
|
||||||
|
systemEffect: true
|
||||||
|
}))
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
Hooks.on('ready', async () => {
|
Hooks.on('ready', async () => {
|
||||||
ui.resources = new CONFIG.ui.resources();
|
ui.resources = new CONFIG.ui.resources();
|
||||||
if (game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).displayFear !== 'hide')
|
if (game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).displayFear !== 'hide')
|
||||||
|
|
|
||||||
|
|
@ -164,28 +164,31 @@ export const healingTypes = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const defeatedConditions = {
|
export const defeatedConditions = () => {
|
||||||
|
const defeated = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated;
|
||||||
|
return {
|
||||||
defeated: {
|
defeated: {
|
||||||
id: 'defeated',
|
id: 'defeated',
|
||||||
name: 'DAGGERHEART.CONFIG.Condition.defeated.name',
|
name: 'DAGGERHEART.CONFIG.Condition.defeated.name',
|
||||||
img: 'icons/magic/control/fear-fright-mask-orange.webp',
|
img: defeated.defeatedIcon,
|
||||||
description: 'DAGGERHEART.CONFIG.Condition.defeated.description'
|
description: 'DAGGERHEART.CONFIG.Condition.defeated.description'
|
||||||
},
|
},
|
||||||
unconscious: {
|
unconscious: {
|
||||||
id: 'unconscious',
|
id: 'unconscious',
|
||||||
name: 'DAGGERHEART.CONFIG.Condition.unconscious.name',
|
name: 'DAGGERHEART.CONFIG.Condition.unconscious.name',
|
||||||
img: 'icons/magic/control/sleep-bubble-purple.webp',
|
img: defeated.unconsciousIcon,
|
||||||
description: 'DAGGERHEART.CONFIG.Condition.unconscious.description'
|
description: 'DAGGERHEART.CONFIG.Condition.unconscious.description'
|
||||||
},
|
},
|
||||||
dead: {
|
dead: {
|
||||||
id: 'dead',
|
id: 'dead',
|
||||||
name: 'DAGGERHEART.CONFIG.Condition.dead.name',
|
name: 'DAGGERHEART.CONFIG.Condition.dead.name',
|
||||||
img: 'icons/magic/death/grave-tombstone-glow-teal.webp',
|
img: defeated.deadIcon,
|
||||||
description: 'DAGGERHEART.CONFIG.Condition.dead.description'
|
description: 'DAGGERHEART.CONFIG.Condition.dead.description'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const conditions = {
|
export const conditions = () => ({
|
||||||
vulnerable: {
|
vulnerable: {
|
||||||
id: 'vulnerable',
|
id: 'vulnerable',
|
||||||
name: 'DAGGERHEART.CONFIG.Condition.vulnerable.name',
|
name: 'DAGGERHEART.CONFIG.Condition.vulnerable.name',
|
||||||
|
|
@ -204,8 +207,8 @@ export const conditions = {
|
||||||
img: 'icons/magic/control/debuff-chains-shackle-movement-red.webp',
|
img: 'icons/magic/control/debuff-chains-shackle-movement-red.webp',
|
||||||
description: 'DAGGERHEART.CONFIG.Condition.restrained.description'
|
description: 'DAGGERHEART.CONFIG.Condition.restrained.description'
|
||||||
},
|
},
|
||||||
...defeatedConditions
|
...defeatedConditions()
|
||||||
};
|
});
|
||||||
|
|
||||||
export const defaultRestOptions = {
|
export const defaultRestOptions = {
|
||||||
shortRest: () => ({
|
shortRest: () => ({
|
||||||
|
|
|
||||||
|
|
@ -68,21 +68,39 @@ export default class DhAutomation extends foundry.abstract.DataModel {
|
||||||
}),
|
}),
|
||||||
characterDefault: new fields.StringField({
|
characterDefault: new fields.StringField({
|
||||||
required: true,
|
required: true,
|
||||||
choices: CONFIG.DH.GENERAL.defeatedConditions,
|
choices: () => CONFIG.DH.GENERAL.defeatedConditions(),
|
||||||
initial: CONFIG.DH.GENERAL.defeatedConditions.unconscious.id,
|
initial: 'unconscious',
|
||||||
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.characterDefault.label'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.characterDefault.label'
|
||||||
}),
|
}),
|
||||||
adversaryDefault: new fields.StringField({
|
adversaryDefault: new fields.StringField({
|
||||||
required: true,
|
required: true,
|
||||||
choices: CONFIG.DH.GENERAL.defeatedConditions,
|
choices: () => CONFIG.DH.GENERAL.defeatedConditions(),
|
||||||
initial: CONFIG.DH.GENERAL.defeatedConditions.defeated.id,
|
initial: 'defeated',
|
||||||
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.adversaryDefault.label'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.adversaryDefault.label'
|
||||||
}),
|
}),
|
||||||
companionDefault: new fields.StringField({
|
companionDefault: new fields.StringField({
|
||||||
required: true,
|
required: true,
|
||||||
choices: CONFIG.DH.GENERAL.defeatedConditions,
|
choices: () => CONFIG.DH.GENERAL.defeatedConditions(),
|
||||||
initial: CONFIG.DH.GENERAL.defeatedConditions.defeated.id,
|
initial: 'defeated',
|
||||||
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.companionDefault.label'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.companionDefault.label'
|
||||||
|
}),
|
||||||
|
deadIcon: new fields.FilePathField({
|
||||||
|
initial: 'icons/magic/death/grave-tombstone-glow-teal.webp',
|
||||||
|
categories: ['IMAGE'],
|
||||||
|
base64: false,
|
||||||
|
label: 'Dead'
|
||||||
|
}),
|
||||||
|
defeatedIcon: new fields.FilePathField({
|
||||||
|
initial: 'icons/magic/control/fear-fright-mask-orange.webp',
|
||||||
|
categories: ['IMAGE'],
|
||||||
|
base64: false,
|
||||||
|
label: 'Defeated'
|
||||||
|
}),
|
||||||
|
unconsciousIcon: new fields.FilePathField({
|
||||||
|
initial: 'icons/magic/control/sleep-bubble-purple.webp',
|
||||||
|
categories: ['IMAGE'],
|
||||||
|
base64: false,
|
||||||
|
label: 'Unconcious'
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
roll: new fields.SchemaField({
|
roll: new fields.SchemaField({
|
||||||
|
|
|
||||||
|
|
@ -753,7 +753,7 @@ export default class DhpActor extends Actor {
|
||||||
|
|
||||||
async toggleDefeated(defeatedState) {
|
async toggleDefeated(defeatedState) {
|
||||||
const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated;
|
const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated;
|
||||||
const { unconscious, defeated, dead } = CONFIG.DH.GENERAL.conditions;
|
const { unconscious, defeated, dead } = CONFIG.DH.GENERAL.conditions();
|
||||||
const defeatedConditions = new Set([unconscious.id, defeated.id, dead.id]);
|
const defeatedConditions = new Set([unconscious.id, defeated.id, dead.id]);
|
||||||
if (!defeatedState) {
|
if (!defeatedState) {
|
||||||
for (let defeatedId of defeatedConditions) {
|
for (let defeatedId of defeatedConditions) {
|
||||||
|
|
|
||||||
|
|
@ -13,5 +13,9 @@
|
||||||
{{formGroup settingFields.schema.fields.defeated.fields.characterDefault value=settingFields._source.defeated.characterDefault labelAttr="name" localize=true}}
|
{{formGroup settingFields.schema.fields.defeated.fields.characterDefault value=settingFields._source.defeated.characterDefault labelAttr="name" localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.defeated.fields.adversaryDefault value=settingFields._source.defeated.adversaryDefault labelAttr="name" localize=true}}
|
{{formGroup settingFields.schema.fields.defeated.fields.adversaryDefault value=settingFields._source.defeated.adversaryDefault labelAttr="name" localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.defeated.fields.companionDefault value=settingFields._source.defeated.companionDefault labelAttr="name" localize=true}}
|
{{formGroup settingFields.schema.fields.defeated.fields.companionDefault value=settingFields._source.defeated.companionDefault labelAttr="name" localize=true}}
|
||||||
|
|
||||||
|
{{formGroup settingFields.schema.fields.defeated.fields.deadIcon value=settingFields._source.defeated.deadIcon localize=true}}
|
||||||
|
{{formGroup settingFields.schema.fields.defeated.fields.defeatedIcon value=settingFields._source.defeated.defeatedIcon localize=true}}
|
||||||
|
{{formGroup settingFields.schema.fields.defeated.fields.unconsciousIcon value=settingFields._source.defeated.unconsciousIcon localize=true}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue