diff --git a/module/applications/characterCreation/characterCreation.mjs b/module/applications/characterCreation/characterCreation.mjs index ddcaaaea..2b251a8b 100644 --- a/module/applications/characterCreation/characterCreation.mjs +++ b/module/applications/characterCreation/characterCreation.mjs @@ -1,6 +1,6 @@ import { abilities } from '../../config/actorConfig.mjs'; import { burden } from '../../config/generalConfig.mjs'; -import { createEmbeddedItemWithEffects } from '../../helpers/utils.mjs'; +import { createEmbeddedItemsWithEffects, createEmbeddedItemWithEffects } from '../../helpers/utils.mjs'; const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; @@ -555,13 +555,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl await createEmbeddedItemWithEffects(this.character, this.setup.community); await createEmbeddedItemWithEffects(this.character, this.setup.class); await createEmbeddedItemWithEffects(this.character, this.setup.subclass); - await this.character.createEmbeddedDocuments( - 'Item', - Object.values(this.setup.domainCards).map(x => ({ - ...x, - effects: x.effects?.map(effect => effect.toObject()) - })) - ); + await createEmbeddedItemsWithEffects(this.character, Object.values(this.setup.domainCards)); if (this.equipment.armor.uuid) await createEmbeddedItemWithEffects(this.character, this.equipment.armor, { @@ -583,14 +577,9 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl if (this.equipment.inventory.choiceB.uuid) await createEmbeddedItemWithEffects(this.character, this.equipment.inventory.choiceB); - await this.character.createEmbeddedDocuments( - 'Item', - this.setup.class.system.inventory.take - .filter(x => x) - .map(x => ({ - ...x, - effects: x.effects?.map(effect => effect.toObject()) - })) + await createEmbeddedItemsWithEffects( + this.character, + this.setup.class.system.inventory.take.filter(x => x) ); await this.character.update({ diff --git a/module/applications/levelup/levelup.mjs b/module/applications/levelup/levelup.mjs index 172b7e40..1c3f2de7 100644 --- a/module/applications/levelup/levelup.mjs +++ b/module/applications/levelup/levelup.mjs @@ -44,10 +44,12 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2) static PARTS = { tabs: { template: 'systems/daggerheart/templates/levelup/tabs/tab-navigation.hbs' }, - advancements: { template: 'systems/daggerheart/templates/levelup/tabs/advancements.hbs' }, + advancements: { + template: 'systems/daggerheart/templates/levelup/tabs/advancements.hbs' + }, selections: { template: 'systems/daggerheart/templates/levelup/tabs/selections.hbs', - scrollable: ['.selections'] + scrollable: ['.levelup-selections-container'] }, summary: { template: 'systems/daggerheart/templates/levelup/tabs/summary.hbs' }, footer: { template: 'systems/daggerheart/templates/levelup/tabs/footer.hbs' } diff --git a/module/config/generalConfig.mjs b/module/config/generalConfig.mjs index 09814f1a..0968c0c1 100644 --- a/module/config/generalConfig.mjs +++ b/module/config/generalConfig.mjs @@ -479,7 +479,8 @@ export const multiplierTypes = { cast: 'Spellcast', scale: 'Cost Scaling', result: 'Roll Result', - flat: 'Flat' + flat: 'Flat', + tier: 'Tier' }; export const diceSetNumbers = { diff --git a/module/data/action/baseAction.mjs b/module/data/action/baseAction.mjs index 8f04d1a0..070864da 100644 --- a/module/data/action/baseAction.mjs +++ b/module/data/action/baseAction.mjs @@ -115,7 +115,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel if (!this.actor) throw new Error("An Action can't be used outside of an Actor context."); if (this.chatDisplay) await this.toChat(); - + let { byPassRoll } = options, config = this.prepareConfig(event, byPassRoll); for (let i = 0; i < this.constructor.extraSchemas.length; i++) { @@ -222,16 +222,13 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel }; } } - + const resources = config.costs - .filter(c => - c.enabled !== false - && - ( - (!successCost && (!c.consumeOnSuccess || config.roll?.success)) - || - (successCost && c.consumeOnSuccess) - ) + .filter( + c => + c.enabled !== false && + ((!successCost && (!c.consumeOnSuccess || config.roll?.success)) || + (successCost && c.consumeOnSuccess)) ) .map(c => { const resource = usefulResources[c.key]; @@ -244,17 +241,15 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel }); await this.actor.modifyResource(resources); - if (config.uses?.enabled - && - ( - (!successCost && (!config.uses?.consumeOnSuccess || config.roll?.success)) - || - (successCost && config.uses?.consumeOnSuccess) - ) - ) this.update({ 'uses.value': this.uses.value + 1 }); + if ( + config.uses?.enabled && + ((!successCost && (!config.uses?.consumeOnSuccess || config.roll?.success)) || + (successCost && config.uses?.consumeOnSuccess)) + ) + this.update({ 'uses.value': this.uses.value + 1 }); - if(config.roll?.success || successCost) - (config.message ?? config.parent).update({'system.successConsumed': true}) + if (config.roll?.success || successCost) + (config.message ?? config.parent).update({ 'system.successConsumed': true }); } /* */ @@ -307,11 +302,9 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel } async applyEffect(effect, actor) { - const origin = effect.parent?.parent ? effect.parent.parent.uuid : effect.parent.uuid; - // Enable an existing effect on the target if it originated from this effect - const existingEffect = actor.effects.find(e => e.origin === origin); + const existingEffect = actor.effects.find(e => e.origin === effect.uuid); if (existingEffect) { - return existingEffect.update( + return effect.update( foundry.utils.mergeObject({ ...effect.constructor.getInitialDuration(), disabled: false @@ -324,7 +317,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel ...effect.toObject(), disabled: false, transfer: false, - origin: origin + origin: effect.uuid }); await ActiveEffect.implementation.create(effectData, { parent: actor }); } diff --git a/module/documents/activeEffect.mjs b/module/documents/activeEffect.mjs index 337805a7..3aced0bf 100644 --- a/module/documents/activeEffect.mjs +++ b/module/documents/activeEffect.mjs @@ -75,7 +75,8 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect { if (isOriginTarget && change.effect.origin) { change.value = change.value.replaceAll(/origin\.@/gi, '@'); try { - const doc = foundry.utils.fromUuidSync(change.effect.origin); + const effect = foundry.utils.fromUuidSync(change.effect.origin); + const doc = effect.parent?.parent; if (doc) parseModel = doc; } catch (_) {} } diff --git a/module/helpers/utils.mjs b/module/helpers/utils.mjs index f1df4723..2447727a 100644 --- a/module/helpers/utils.mjs +++ b/module/helpers/utils.mjs @@ -371,6 +371,21 @@ export async function createEmbeddedItemWithEffects(actor, baseData, update) { return doc; } +export async function createEmbeddedItemsWithEffects(actor, baseData) { + const effectData = []; + for (let d of baseData) { + const data = d.uuid.startsWith('Compendium') ? await foundry.utils.fromUuid(d.uuid) : d; + effectData.push({ + ...data, + id: data.id, + uuid: data.uuid, + effects: data.effects?.map(effect => effect.toObject()) + }); + } + + await actor.createEmbeddedDocuments('Item', effectData); +} + export const slugify = name => { return name.toLowerCase().replaceAll(' ', '-').replaceAll('.', ''); }; diff --git a/styles/less/dialog/character-creation/selections-container.less b/styles/less/dialog/character-creation/selections-container.less index 9f81f93b..bc7a6987 100644 --- a/styles/less/dialog/character-creation/selections-container.less +++ b/styles/less/dialog/character-creation/selections-container.less @@ -112,6 +112,10 @@ flex-direction: column; text-align: center; + .card-preview-container { + flex: 1; + } + .card-preview-container { border-color: light-dark(@dark-blue, @golden); } @@ -157,7 +161,10 @@ .selections-outer-container { display: flex; justify-content: space-evenly; - height: 210px; + + &.enlarged { + height: 240px; + } } .section-container { diff --git a/styles/less/dialog/level-up/selections-container.less b/styles/less/dialog/level-up/selections-container.less index 843fead0..da5d5273 100644 --- a/styles/less/dialog/level-up/selections-container.less +++ b/styles/less/dialog/level-up/selections-container.less @@ -83,10 +83,15 @@ background: grey; padding: 0 12px; border-radius: 6px; + z-index: 2; } img { height: 124px; + + &.svg { + filter: @beige-filter; + } } .levelup-domain-selected { @@ -138,6 +143,10 @@ padding: 0 12px; } + .levelup-trait-increases { + width: 100%; + } + .levelup-radio-choices { display: flex; gap: 8px; diff --git a/styles/less/dialog/level-up/tiers-container.less b/styles/less/dialog/level-up/tiers-container.less index 1149ede3..225c31fb 100644 --- a/styles/less/dialog/level-up/tiers-container.less +++ b/styles/less/dialog/level-up/tiers-container.less @@ -27,6 +27,7 @@ } .checkbox-group-container { + width: 100%; display: grid; grid-template-columns: 1fr 3fr; gap: 4px; diff --git a/templates/characterCreation/setupTabs/ancestry.hbs b/templates/characterCreation/setupTabs/ancestry.hbs index 1c87ca47..c5895472 100644 --- a/templates/characterCreation/setupTabs/ancestry.hbs +++ b/templates/characterCreation/setupTabs/ancestry.hbs @@ -19,7 +19,7 @@ -
+
{{#> "systems/daggerheart/templates/components/card-preview.hbs" primaryAncestry altPartialBlock=true secondaryDisabled=secondaryAncestry.uuid mixedAncestry=mixedAncestry }} {{#if uuid}} diff --git a/templates/levelup/tabs/selections.hbs b/templates/levelup/tabs/selections.hbs index edfca6b4..7ebe32bb 100644 --- a/templates/levelup/tabs/selections.hbs +++ b/templates/levelup/tabs/selections.hbs @@ -99,7 +99,7 @@ {{#each this.multiclass.domains}}
{{localize this.label}}
- + {{#if this.selected}}