diff --git a/daggerheart.mjs b/daggerheart.mjs index 7ae01590..992d1cd7 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -307,7 +307,6 @@ Hooks.on('chatMessage', (_, message) => { ? CONFIG.DH.ACTIONS.advantageState.disadvantage.value : undefined; const difficulty = rollCommand.difficulty; - const grantResources = Boolean(rollCommand.grantResources); const target = getCommandTarget({ allowNull: true }); const title = @@ -325,8 +324,7 @@ Hooks.on('chatMessage', (_, message) => { title, label: game.i18n.localize('DAGGERHEART.GENERAL.dualityRoll'), actionType: null, - advantage, - grantResources + advantage }); return false; } diff --git a/lang/en.json b/lang/en.json index 8825f6de..b573b4ff 100755 --- a/lang/en.json +++ b/lang/en.json @@ -330,12 +330,6 @@ "title": "{actor} - Character Setup", "traitIncreases": "Trait Increases" }, - "CharacterReset": { - "title": "Reset Character", - "alwaysDeleteSection": "Deleted Data", - "optionalDeleteSection": "Optional Data", - "headerTitle": "Select which data you'd like to keep" - }, "CombatTracker": { "combatStarted": "Active", "giveSpotlight": "Give The Spotlight", @@ -980,10 +974,6 @@ "outsideRange": "Outside Range" }, "Condition": { - "deathMove": { - "name": "Death Move", - "description": "The character is about to make a Death Move" - }, "dead": { "name": "Dead", "description": "The character is dead" @@ -2221,7 +2211,6 @@ "single": "Player", "plurial": "Players" }, - "portrait": "Portrait", "proficiency": "Proficiency", "quantity": "Quantity", "range": "Range", @@ -2453,11 +2442,7 @@ "overlay": { "label": "Overlay Effect" }, "characterDefault": { "label": "Character Default Defeated Status" }, "adversaryDefault": { "label": "Adversary Default Defeated Status" }, - "companionDefault": { "label": "Companion Default Defeated Status" }, - "deathMove": { "label": "Death Move" }, - "dead": { "label": "Dead" }, - "defeated": { "label": "Defeated" }, - "unconscious": { "label": "Unconscious" } + "companionDefault": { "label": "Companion Default Defeated Status" } }, "hopeFear": { "label": "Hope & Fear", @@ -2891,8 +2876,7 @@ "documentIsMissing": "The {documentType} is missing from the world.", "tokenActorMissing": "{name} is missing an Actor", "tokenActorsMissing": "[{names}] missing Actors", - "domainTouchRequirement": "This domain card requires {nr} {domain} cards in the loadout to be used", - "knowTheTide": "Know The Tide gained a token" + "domainTouchRequirement": "This domain card requires {nr} {domain} cards in the loadout to be used" }, "Sidebar": { "actorDirectory": { diff --git a/module/applications/dialogs/_module.mjs b/module/applications/dialogs/_module.mjs index 4eda8579..d43045e6 100644 --- a/module/applications/dialogs/_module.mjs +++ b/module/applications/dialogs/_module.mjs @@ -1,6 +1,5 @@ export { default as AttributionDialog } from './attributionDialog.mjs'; export { default as BeastformDialog } from './beastformDialog.mjs'; -export { default as CharacterResetDialog } from './characterResetDialog.mjs'; export { default as d20RollDialog } from './d20RollDialog.mjs'; export { default as DamageDialog } from './damageDialog.mjs'; export { default as DamageReductionDialog } from './damageReductionDialog.mjs'; diff --git a/module/applications/dialogs/characterResetDialog.mjs b/module/applications/dialogs/characterResetDialog.mjs deleted file mode 100644 index 0836af9c..00000000 --- a/module/applications/dialogs/characterResetDialog.mjs +++ /dev/null @@ -1,105 +0,0 @@ -const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api; - -export default class CharacterResetDialog extends HandlebarsApplicationMixin(ApplicationV2) { - constructor(actor, options = {}) { - super(options); - - this.actor = actor; - this.data = { - delete: { - class: { keep: false, label: 'TYPES.Item.class' }, - subclass: { keep: false, label: 'TYPES.Item.subclass' }, - ancestry: { keep: false, label: 'TYPES.Item.ancestry' }, - community: { keep: false, label: 'TYPES.Item.community' } - }, - optional: { - portrait: { keep: true, label: 'DAGGERHEART.GENERAL.portrait' }, - name: { keep: true, label: 'Name' }, - biography: { keep: true, label: 'DAGGERHEART.GENERAL.Tabs.biography' }, - inventory: { keep: true, label: 'DAGGERHEART.GENERAL.inventory' } - } - }; - } - - static DEFAULT_OPTIONS = { - tag: 'form', - classes: ['daggerheart', 'dialog', 'dh-style', 'views', 'character-reset'], - window: { - icon: 'fa-solid fa-arrow-rotate-left', - title: 'DAGGERHEART.APPLICATIONS.CharacterReset.title' - }, - actions: { - finishSelection: this.#finishSelection - }, - form: { - handler: this.updateData, - submitOnChange: true, - submitOnClose: false - } - }; - - /** @override */ - static PARTS = { - resourceDice: { - id: 'resourceDice', - template: 'systems/daggerheart/templates/dialogs/characterReset.hbs' - } - }; - - async _prepareContext(_options) { - const context = await super._prepareContext(_options); - context.data = this.data; - - return context; - } - - static async updateData(event, _, formData) { - const { data } = foundry.utils.expandObject(formData.object); - - this.data = foundry.utils.mergeObject(this.data, data); - this.render(); - } - - static getUpdateData() { - const update = {}; - if (!this.data.optional.portrait) update.if(!this.data.optional.biography); - - if (!this.data.optional.inventory) return update; - } - - static async #finishSelection() { - const update = {}; - if (!this.data.optional.name.keep) { - const defaultName = game.system.api.documents.DhpActor.defaultName({ type: 'character' }); - foundry.utils.setProperty(update, 'name', defaultName); - foundry.utils.setProperty(update, 'prototypeToken.name', defaultName); - } - - if (!this.data.optional.portrait.keep) { - foundry.utils.setProperty(update, 'img', this.actor.schema.fields.img.initial(this.actor)); - foundry.utils.setProperty(update, 'prototypeToken.==texture', {}); - foundry.utils.setProperty(update, 'prototypeToken.==ring', {}); - } - - if (this.data.optional.biography.keep) - foundry.utils.setProperty(update, 'system.biography', this.actor.system.biography); - - if (this.data.optional.inventory.keep) foundry.utils.setProperty(update, 'system.gold', this.actor.system.gold); - - const { system, ...rest } = update; - await this.actor.update({ - ...rest, - '==system': system ?? {} - }); - - const inventoryItemTypes = ['weapon', 'armor', 'consumable', 'loot']; - await this.actor.deleteEmbeddedDocuments( - 'Item', - this.actor.items - .filter(x => !inventoryItemTypes.includes(x.type) || !this.data.optional.inventory.keep) - .map(x => x.id) - ); - - this.close(); - } -} diff --git a/module/applications/dialogs/deathMove.mjs b/module/applications/dialogs/deathMove.mjs index 3eadede6..01df6057 100644 --- a/module/applications/dialogs/deathMove.mjs +++ b/module/applications/dialogs/deathMove.mjs @@ -54,9 +54,10 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV if (!config.roll.fate) return; - let returnMessage = game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.avoidScar'); if (config.roll.fate.value <= this.actor.system.levelData.level.current) { + // apply scarring - for now directly apply - later add a button. const newScarAmount = this.actor.system.scars + 1; + await this.actor.update({ system: { scars: newScarAmount @@ -64,15 +65,13 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV }); if (newScarAmount >= this.actor.system.resources.hope.max) { - await this.actor.setDeathMoveDefeated(CONFIG.DH.GENERAL.defeatedConditionChoices.dead.id); return game.i18n.format('DAGGERHEART.UI.Chat.deathMove.journeysEnd', { scars: newScarAmount }); } - returnMessage = game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.gainScar'); + return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.gainScar'); } - await this.actor.setDeathMoveDefeated(CONFIG.DH.GENERAL.defeatedConditionChoices.unconscious.id); - return returnMessage; + return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.avoidScar'); } async handleRiskItAll() { @@ -85,7 +84,6 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV label: game.i18n.localize('DAGGERHEART.GENERAL.dualityDice'), actionType: null, advantage: null, - grantResources: false, customConfig: { skips: { resources: true, reaction: true } } }); @@ -120,7 +118,6 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV } if (config.roll.result.duality == -1) { - await this.actor.setDeathMoveDefeated(CONFIG.DH.GENERAL.defeatedConditionChoices.dead.id); chatMessage = game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.riskItAllFailure'); } @@ -144,7 +141,6 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV } ]); - await this.actor.setDeathMoveDefeated(CONFIG.DH.GENERAL.defeatedConditionChoices.dead.id); return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.blazeOfGlory'); } diff --git a/module/applications/levelup/levelupViewMode.mjs b/module/applications/levelup/levelupViewMode.mjs index afd7dbc4..b3d7c30f 100644 --- a/module/applications/levelup/levelupViewMode.mjs +++ b/module/applications/levelup/levelupViewMode.mjs @@ -70,10 +70,7 @@ export default class DhlevelUpViewMode extends HandlebarsApplicationMixin(Applic return checkbox; }); - let label = - optionKey === 'domainCard' - ? game.i18n.format(option.label, { maxLevel: tier.levels.end }) - : game.i18n.localize(option.label); + let label = game.i18n.localize(option.label); return { label: label, checkboxGroups: chunkify(checkboxes, option.minCost, chunkedBoxes => { diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs index 4ecaeb06..5c6bac3a 100644 --- a/module/applications/sheets/actors/character.mjs +++ b/module/applications/sheets/actors/character.mjs @@ -669,7 +669,26 @@ export default class CharacterSheet extends DHBaseActorSheet { * Resets the character data and removes all embedded documents. */ static async #resetCharacter() { - new game.system.api.applications.dialogs.CharacterResetDialog(this.document).render({ force: true }); + const confirmed = await foundry.applications.api.DialogV2.confirm({ + window: { + title: game.i18n.localize('DAGGERHEART.ACTORS.Character.resetCharacterConfirmationTitle') + }, + content: game.i18n.localize('DAGGERHEART.ACTORS.Character.resetCharacterConfirmationContent') + }); + + if (!confirmed) return; + + await this.document.update({ + '==system': {} + }); + await this.document.deleteEmbeddedDocuments( + 'Item', + this.document.items.map(x => x.id) + ); + await this.document.deleteEmbeddedDocuments( + 'ActiveEffect', + this.document.effects.map(x => x.id) + ); } /** @@ -734,9 +753,8 @@ export default class CharacterSheet extends DHBaseActorSheet { if (!result) return; /* This could be avoided by baking config.costs into config.resourceUpdates. Didn't feel like messing with it at the time */ - const costResources = - result.costs?.filter(x => x.enabled).map(cost => ({ ...cost, value: -cost.value, total: -cost.total })) || - {}; + const costResources = result.costs?.filter(x => x.enabled) + .map(cost => ({ ...cost, value: -cost.value, total: -cost.total })) || {}; config.resourceUpdates.addResources(costResources); await config.resourceUpdates.updateResources(); } diff --git a/module/applications/sheets/rollTables/rollTable.mjs b/module/applications/sheets/rollTables/rollTable.mjs index f7031461..95c8e5c8 100644 --- a/module/applications/sheets/rollTables/rollTable.mjs +++ b/module/applications/sheets/rollTables/rollTable.mjs @@ -11,7 +11,7 @@ export default class DhRollTableSheet extends foundry.applications.sheets.RollTa }; static buildParts() { - const { footer, header, sheet, results, ...parts } = super.PARTS; + const { footer, header, sheet, ...parts } = super.PARTS; return { sheet: { ...sheet, @@ -19,11 +19,6 @@ export default class DhRollTableSheet extends foundry.applications.sheets.RollTa }, header: { template: 'systems/daggerheart/templates/sheets/rollTable/header.hbs' }, ...parts, - results: { - template: 'systems/daggerheart/templates/sheets/rollTable/results.hbs', - templates: ['templates/sheets/roll-table/result-details.hbs'], - scrollable: ['table[data-results] tbody'] - }, summary: { template: 'systems/daggerheart/templates/sheets/rollTable/summary.hbs' }, footer }; @@ -59,7 +54,6 @@ export default class DhRollTableSheet extends foundry.applications.sheets.RollTa }; context.activeAltFormula = this.daggerheartFlag.activeAltFormula; context.selectedFormula = this.daggerheartFlag.getActiveFormula(this.document.formula); - context.results = this.getExtendedResults(context.results); break; case 'header': context.altFormula = this.daggerheartFlag.altFormula; @@ -75,26 +69,11 @@ export default class DhRollTableSheet extends foundry.applications.sheets.RollTa context.altFormula = this.daggerheartFlag.altFormula; context.formulaName = this.daggerheartFlag.formulaName; break; - case 'results': - context.results = this.getExtendedResults(context.results); - break; } return context; } - getExtendedResults(results) { - const bodyDarkMode = document.body.classList.contains('theme-dark'); - const elementLightMode = this.element.classList.contains('theme-light'); - const elementDarkMode = this.element.classList.contains('theme-dark'); - const isDarkMode = elementDarkMode || (!elementLightMode && bodyDarkMode); - - return results.map(x => ({ - ...x, - displayImg: isDarkMode && x.img === 'icons/svg/d20-black.svg' ? 'icons/svg/d20.svg' : x.img - })); - } - /* -------------------------------------------- */ /* Flag SystemData update methods */ /* -------------------------------------------- */ diff --git a/module/config/generalConfig.mjs b/module/config/generalConfig.mjs index be1dfce1..37894644 100644 --- a/module/config/generalConfig.mjs +++ b/module/config/generalConfig.mjs @@ -171,7 +171,7 @@ export const defeatedConditions = () => { acc[key] = { ...choice, img: defeated[`${choice.id}Icon`], - description: game.i18n.localize(`DAGGERHEART.CONFIG.Condition.${choice.id}.description`) + description: `DAGGERHEART.CONFIG.Condition.${choice.id}.description` }; return acc; @@ -179,10 +179,6 @@ export const defeatedConditions = () => { }; export const defeatedConditionChoices = { - deathMove: { - id: 'deathMove', - name: 'DAGGERHEART.CONFIG.Condition.deathMove.name' - }, defeated: { id: 'defeated', name: 'DAGGERHEART.CONFIG.Condition.defeated.name' diff --git a/module/data/actor/character.mjs b/module/data/actor/character.mjs index 12396384..a7f99ca8 100644 --- a/module/data/actor/character.mjs +++ b/module/data/actor/character.mjs @@ -549,18 +549,7 @@ export default class DhCharacter extends BaseDataActor { } get deathMoveViable() { - const { characterDefault } = game.settings.get( - CONFIG.DH.id, - CONFIG.DH.SETTINGS.gameSettings.Automation - ).defeated; - const deathMoveOutcomeStatuses = Object.keys(CONFIG.DH.GENERAL.defeatedConditionChoices).filter( - key => key !== characterDefault - ); - const deathMoveNotResolved = this.parent.statuses.every(status => !deathMoveOutcomeStatuses.includes(status)); - - const allHitPointsMarked = - this.resources.hitPoints.max > 0 && this.resources.hitPoints.value >= this.resources.hitPoints.max; - return deathMoveNotResolved && allHitPointsMarked; + return this.resources.hitPoints.max > 0 && this.resources.hitPoints.value >= this.resources.hitPoints.max; } get armorApplicableDamageTypes() { diff --git a/module/data/registeredTriggers.mjs b/module/data/registeredTriggers.mjs index ee4f3b49..8a100585 100644 --- a/module/data/registeredTriggers.mjs +++ b/module/data/registeredTriggers.mjs @@ -20,7 +20,6 @@ export default class RegisteredTriggers extends Map { } registerItemTriggers(item, registerOverride) { - if (!item.actor || !item._stats.createdTime) return; for (const action of item.system.actions ?? []) { if (!action.actor) continue; @@ -72,21 +71,10 @@ export default class RegisteredTriggers extends Map { } } - unregisterSceneEnvironmentTriggers(flagSystemData) { - const sceneData = new game.system.api.data.scenes.DHScene(flagSystemData); - for (const environment of sceneData.sceneEnvironments) { - if (environment.pack) continue; - this.unregisterItemTriggers(environment.system.features); - } - } - unregisterSceneTriggers(scene) { - this.unregisterSceneEnvironmentTriggers(scene.flags.daggerheart); - for (const triggerKey of Object.keys(CONFIG.DH.TRIGGER.triggers)) { const existingTrigger = this.get(triggerKey); if (!existingTrigger) continue; - const filtered = new Map(); for (const [uuid, data] of existingTrigger.entries()) { if (!uuid.startsWith(scene.uuid)) filtered.set(uuid, data); @@ -95,17 +83,14 @@ export default class RegisteredTriggers extends Map { } } - registerSceneEnvironmentTriggers(flagSystemData) { - const sceneData = new game.system.api.data.scenes.DHScene(flagSystemData); - for (const environment of sceneData.sceneEnvironments) { - for (const feature of environment.system.features) { - if (feature) this.registerItemTriggers(feature, true); - } - } - } - registerSceneTriggers(scene) { - this.registerSceneEnvironmentTriggers(scene.flags.daggerheart); + /* TODO: Finish sceneEnvironment registration and unreg */ + // const systemData = new game.system.api.data.scenes.DHScene(scene.flags.daggerheart); + // for (const environment of systemData.sceneEnvironments) { + // for (const feature of environment.system.features) { + // if(feature) this.registerItemTriggers(feature, true); + // } + // } for (const actor of scene.tokens.filter(x => x.actor).map(x => x.actor)) { if (actor.prototypeToken.actorLink) continue; @@ -122,11 +107,13 @@ export default class RegisteredTriggers extends Map { if (!triggerSettings.enabled) return updates; const dualityTrigger = this.get(trigger); - if (dualityTrigger?.size) { - const triggerActors = ['character', 'adversary', 'environment']; + if (dualityTrigger) { + const tokenBoundActors = ['adversary', 'environment']; + const triggerActors = ['character', ...tokenBoundActors]; for (let [itemUuid, { actor: actorUuid, triggeringActorType, commands }] of dualityTrigger.entries()) { const actor = await foundry.utils.fromUuid(actorUuid); if (!actor || !triggerActors.includes(actor.type)) continue; + if (tokenBoundActors.includes(actor.type) && !actor.getActiveTokens().length) continue; const triggerData = CONFIG.DH.TRIGGER.triggers[trigger]; if (triggerData.usesActor && triggeringActorType !== 'any') { diff --git a/module/data/settings/Automation.mjs b/module/data/settings/Automation.mjs index 436f0eb7..bff0bae9 100644 --- a/module/data/settings/Automation.mjs +++ b/module/data/settings/Automation.mjs @@ -58,7 +58,7 @@ export default class DhAutomation extends foundry.abstract.DataModel { defeated: new fields.SchemaField({ enabled: new fields.BooleanField({ required: true, - initial: true, + initial: false, label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.enabled.label' }), overlay: new fields.BooleanField({ @@ -69,7 +69,7 @@ export default class DhAutomation extends foundry.abstract.DataModel { characterDefault: new fields.StringField({ required: true, choices: CONFIG.DH.GENERAL.defeatedConditionChoices, - initial: CONFIG.DH.GENERAL.defeatedConditionChoices.deathMove.id, + initial: CONFIG.DH.GENERAL.defeatedConditionChoices.unconscious.id, label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.characterDefault.label' }), adversaryDefault: new fields.StringField({ @@ -84,29 +84,23 @@ export default class DhAutomation extends foundry.abstract.DataModel { initial: CONFIG.DH.GENERAL.defeatedConditionChoices.defeated.id, label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.companionDefault.label' }), - deathMoveIcon: new fields.FilePathField({ - initial: 'icons/magic/life/heart-cross-purple-orange.webp', - categories: ['IMAGE'], - base64: false, - label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.deathMove.label' - }), deadIcon: new fields.FilePathField({ initial: 'icons/magic/death/grave-tombstone-glow-teal.webp', categories: ['IMAGE'], base64: false, - label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.dead.label' + label: 'Dead' }), defeatedIcon: new fields.FilePathField({ initial: 'icons/magic/control/fear-fright-mask-orange.webp', categories: ['IMAGE'], base64: false, - label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.defeated.label' + label: 'Defeated' }), unconsciousIcon: new fields.FilePathField({ initial: 'icons/magic/control/sleep-bubble-purple.webp', categories: ['IMAGE'], base64: false, - label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.unconscious.label' + label: 'Unconcious' }) }), roll: new fields.SchemaField({ diff --git a/module/dice/dualityRoll.mjs b/module/dice/dualityRoll.mjs index e65d0ff5..0edbe5ad 100644 --- a/module/dice/dualityRoll.mjs +++ b/module/dice/dualityRoll.mjs @@ -274,7 +274,7 @@ export default class DualityRoll extends D20Roll { } static async handleTriggers(roll, config) { - if (!config.source?.actor || config.skips?.triggers) return; + if (!config.source?.actor) return; const updates = []; const dualityUpdates = await game.system.registeredTriggers.runTrigger( diff --git a/module/documents/actor.mjs b/module/documents/actor.mjs index 9cfe3385..9704a94c 100644 --- a/module/documents/actor.mjs +++ b/module/documents/actor.mjs @@ -849,8 +849,8 @@ export default class DhpActor extends Actor { async toggleDefeated(defeatedState) { const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated; - const { deathMove, unconscious, defeated, dead } = CONFIG.DH.GENERAL.conditions(); - const defeatedConditions = new Set([deathMove.id, unconscious.id, defeated.id, dead.id]); + const { unconscious, defeated, dead } = CONFIG.DH.GENERAL.conditions(); + const defeatedConditions = new Set([unconscious.id, defeated.id, dead.id]); if (!defeatedState) { for (let defeatedId of defeatedConditions) { await this.toggleStatusEffect(defeatedId, { overlay: settings.overlay, active: defeatedState }); @@ -864,18 +864,6 @@ export default class DhpActor extends Actor { } } - async setDeathMoveDefeated(defeatedIconId) { - const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated; - const actorDefault = settings[`${this.type}Default`]; - if (!settings.enabled || !settings.enabled || !actorDefault || actorDefault === defeatedIconId) return; - - for (let defeatedId of Object.keys(CONFIG.DH.GENERAL.defeatedConditionChoices)) { - await this.toggleStatusEffect(defeatedId, { overlay: settings.overlay, active: false }); - } - - if (defeatedIconId) await this.toggleStatusEffect(defeatedIconId, { overlay: settings.overlay, active: true }); - } - queueScrollText(scrollingTextData) { this.#scrollTextQueue.push(...scrollingTextData.map(data => () => createScrollText(this, data))); if (!this.#scrollTextInterval) { diff --git a/module/documents/scene.mjs b/module/documents/scene.mjs index 9e2a3f5b..7f880b1d 100644 --- a/module/documents/scene.mjs +++ b/module/documents/scene.mjs @@ -51,27 +51,6 @@ export default class DhScene extends Scene { } } - async _preUpdate(changes, options, user) { - const allowed = await super._preUpdate(changes, options, user); - if (allowed === false) return false; - - if (changes.flags?.daggerheart) { - if (this._source.flags.daggerheart) { - const unregisterTriggerData = this._source.flags.daggerheart.sceneEnvironments.reduce( - (acc, env) => { - if (!changes.flags.daggerheart.sceneEnvironments.includes(env)) acc.sceneEnvironments.push(env); - - return acc; - }, - { ...this._source.flags.daggerheart, sceneEnvironments: [] } - ); - game.system.registeredTriggers.unregisterSceneEnvironmentTriggers(unregisterTriggerData); - } - - game.system.registeredTriggers.registerSceneEnvironmentTriggers(changes.flags.daggerheart); - } - } - _onDelete(options, userId) { super._onDelete(options, userId); diff --git a/module/enrichers/DualityRollEnricher.mjs b/module/enrichers/DualityRollEnricher.mjs index 91149fd8..f6f022f9 100644 --- a/module/enrichers/DualityRollEnricher.mjs +++ b/module/enrichers/DualityRollEnricher.mjs @@ -47,7 +47,6 @@ function getDualityMessage(roll, flavor) { ${roll?.trait && abilities[roll.trait] ? `data-trait="${roll.trait}"` : ''} ${roll?.advantage ? 'data-advantage="true"' : ''} ${roll?.disadvantage ? 'data-disadvantage="true"' : ''} - ${roll?.grantResources ? 'data-grant-resources="true"' : ''} > ${roll?.reaction ? '' : ''} ${label} @@ -64,8 +63,7 @@ export const renderDualityButton = async event => { traitValue = button.dataset.trait?.toLowerCase(), target = getCommandTarget({ allowNull: true }), difficulty = button.dataset.difficulty, - advantage = button.dataset.advantage ? Number(button.dataset.advantage) : undefined, - grantResources = Boolean(button.dataset?.grantResources); + advantage = button.dataset.advantage ? Number(button.dataset.advantage) : undefined; await enrichedDualityRoll( { @@ -75,15 +73,14 @@ export const renderDualityButton = async event => { difficulty, title: button.dataset.title, label: button.dataset.label, - advantage, - grantResources + advantage }, event ); }; export const enrichedDualityRoll = async ( - { reaction, traitValue, target, difficulty, title, label, advantage, grantResources, customConfig }, + { reaction, traitValue, target, difficulty, title, label, advantage, customConfig }, event ) => { const config = { @@ -96,18 +93,13 @@ export const enrichedDualityRoll = async ( advantage, type: reaction ? 'reaction' : null }, - skips: { - resources: !grantResources, - triggers: !grantResources - }, type: 'trait', hasRoll: true, ...(customConfig ?? {}) }; if (target) { - const result = await target.diceRoll(config); - result.resourceUpdates.updateResources(); + await target.diceRoll(config); } else { // For no target, call DualityRoll directly with basic data config.data = { experiences: {}, traits: {}, rules: {} }; diff --git a/src/packs/communities/feature_Know_the_Tide_07x6Qe6qMzDw2xN4.json b/src/packs/communities/feature_Know_the_Tide_07x6Qe6qMzDw2xN4.json index 41f11a74..069fe6ba 100644 --- a/src/packs/communities/feature_Know_the_Tide_07x6Qe6qMzDw2xN4.json +++ b/src/packs/communities/feature_Know_the_Tide_07x6Qe6qMzDw2xN4.json @@ -9,47 +9,13 @@ "resource": { "type": "simple", "value": 0, - "max": "@system.levelData.level.current", - "icon": "fa-solid fa-water", - "recovery": "session", + "max": "", + "icon": "", + "recovery": null, "diceStates": {}, "dieFaces": "d4" }, - "actions": { - "tFlus34KotJjHfTe": { - "type": "effect", - "_id": "tFlus34KotJjHfTe", - "systemPath": "actions", - "baseAction": false, - "description": "", - "chatDisplay": true, - "originItem": { - "type": "itemCollection" - }, - "actionType": "action", - "triggers": [ - { - "trigger": "fearRoll", - "triggeringActorType": "self", - "command": "const { max, value } = this.item.system.resource;\nconst maxValue = actor.system.levelData.level.current;\nconst afterUpdate = value+1;\nif (afterUpdate > maxValue) return;\n\nui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.knowTheTide'));\nreturn { updates: [{\n key: 'resource',\n itemId: this.item.id,\n target: this.item,\n value: 1,\n}]};" - } - ], - "cost": [], - "uses": { - "value": null, - "max": "", - "recovery": null, - "consumeOnSuccess": false - }, - "effects": [], - "target": { - "type": "any", - "amount": null - }, - "name": "Know The Tide", - "range": "" - } - }, + "actions": {}, "originItemType": null, "subType": null, "originId": null, diff --git a/styles/less/dialog/character-reset/sheet.less b/styles/less/dialog/character-reset/sheet.less deleted file mode 100644 index 44312a3e..00000000 --- a/styles/less/dialog/character-reset/sheet.less +++ /dev/null @@ -1,27 +0,0 @@ -.daggerheart.dh-style.dialog.views.character-reset { - .character-reset-container { - display: flex; - flex-direction: column; - gap: 8px; - - legend { - padding: 0 4px; - } - - .character-reset-header { - font-size: var(--font-size-18); - text-align: center; - } - - .reset-data-container { - display: grid; - grid-template-columns: 3fr 2fr; - align-items: center; - gap: 4px; - - label { - font-weight: bold; - } - } - } -} diff --git a/styles/less/dialog/index.less b/styles/less/dialog/index.less index 733cdd1c..01a3f954 100644 --- a/styles/less/dialog/index.less +++ b/styles/less/dialog/index.less @@ -41,5 +41,3 @@ @import './settings/change-currency-icon.less'; @import './risk-it-all/sheet.less'; - -@import './character-reset/sheet.less'; diff --git a/templates/dialogs/characterReset.hbs b/templates/dialogs/characterReset.hbs deleted file mode 100644 index 298826e5..00000000 --- a/templates/dialogs/characterReset.hbs +++ /dev/null @@ -1,33 +0,0 @@ -
-
-
{{localize "DAGGERHEART.APPLICATIONS.CharacterReset.headerTitle"}}
- -
- {{localize "DAGGERHEART.APPLICATIONS.CharacterReset.alwaysDeleteSection"}} - -
- {{#each this.data.delete as | data key|}} -
- - -
- {{/each}} -
-
- -
- {{localize "DAGGERHEART.APPLICATIONS.CharacterReset.optionalDeleteSection"}} - -
- {{#each this.data.optional as | data key|}} -
- - -
- {{/each}} -
-
- - -
-
\ No newline at end of file diff --git a/templates/settings/automation-settings/rules.hbs b/templates/settings/automation-settings/rules.hbs index 24f0b262..a12c2999 100644 --- a/templates/settings/automation-settings/rules.hbs +++ b/templates/settings/automation-settings/rules.hbs @@ -9,12 +9,11 @@ {{formGroup settingFields.schema.fields.defeated.fields.enabled value=settingFields._source.defeated.enabled localize=true}} - {{formGroup settingFields.schema.fields.defeated.fields.overlay value=settingFields._source.defeated.overlay localize=true}} + {{formGroup settingFields.schema.fields.defeated.fields.overlay value=settingFields._source.defeated.overlay 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.companionDefault value=settingFields._source.defeated.companionDefault labelAttr="name" localize=true}} - {{formGroup settingFields.schema.fields.defeated.fields.deathMoveIcon value=settingFields._source.defeated.deathMoveIcon 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}} diff --git a/templates/sheets/rollTable/results.hbs b/templates/sheets/rollTable/results.hbs deleted file mode 100644 index 5e7944b0..00000000 --- a/templates/sheets/rollTable/results.hbs +++ /dev/null @@ -1,55 +0,0 @@ -
- - - - - - - - - - - - {{#each results as |result i|}} - - - - - - - - - - - - - - {{/each}} - -
- - {{localize "TABLE_RESULT.Details"}}{{localize "TABLE_RESULT.FIELDS.weight.label"}}{{localize "TABLE_RESULT.FIELDS.range.label"}} - -
- {{localize - - {{> "templates/sheets/roll-table/result-details.hbs" result=result}} - - - - - - - - - - -
-
diff --git a/templates/sheets/rollTable/sheet.hbs b/templates/sheets/rollTable/sheet.hbs index f066825a..2c793906 100644 --- a/templates/sheets/rollTable/sheet.hbs +++ b/templates/sheets/rollTable/sheet.hbs @@ -30,7 +30,7 @@ {{#each results as |result i|}} - {{localize + {{localize {{result.range}}