diff --git a/module/applications/dialogs/tagTeamDialog.mjs b/module/applications/dialogs/tagTeamDialog.mjs index ddaabcb4..bc35f360 100644 --- a/module/applications/dialogs/tagTeamDialog.mjs +++ b/module/applications/dialogs/tagTeamDialog.mjs @@ -1,6 +1,6 @@ import { MemberData } from '../../data/tagTeamData.mjs'; import { getCritDamageBonus } from '../../helpers/utils.mjs'; -import { emitAsGM, GMUpdateEvent, RefreshType, socketEvent } from '../../systemRegistration/socket.mjs'; +import { RefreshType, socketEvent } from '../../systemRegistration/socket.mjs'; import Party from '../sheets/actors/party.mjs'; const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; @@ -133,9 +133,8 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio group: item.name, baseAction: action.baseAction }; - + rollOptions.push(actionItem); if (action.hasDamage) damageRollOptions.push(actionItem); - else rollOptions.push(actionItem); } } } @@ -180,23 +179,16 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio this.updatePartyData(partyData); } - async updatePartyData(update, options = { render: true }) { - const gmUpdate = async update => { - await this.party.update(update); - this.render(); + async updatePartyData(updata, options = { render: true }) { + await this.party.update(updata); + + if (options.render) { + this.render(true); game.socket.emit(`system.${CONFIG.DH.id}`, { action: socketEvent.Refresh, data: { refreshType: RefreshType.TagTeamRoll, action: 'refresh' } }); - }; - - await emitAsGM( - GMUpdateEvent.UpdateDocument, - gmUpdate, - update, - this.party.uuid, - options.render ? { refreshType: RefreshType.TagTeamRoll, action: 'refresh' } : undefined - ); + } } getIsEditable() { @@ -422,6 +414,8 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio await action.workflow.get('damage').execute(config, null, true); if (!config.damage) return; + // const damage = config.roll.isCritical ? await this.getNonCriticalDamage(config, actor) : config.damage; + const current = this.party.system.tagTeam.members[memberKey].rollData; await this.updatePartyData({ [`system.tagTeam.members.${memberKey}.rollData`]: { diff --git a/module/data/action/baseAction.mjs b/module/data/action/baseAction.mjs index 1fa1e7c0..0cc1f8fa 100644 --- a/module/data/action/baseAction.mjs +++ b/module/data/action/baseAction.mjs @@ -355,11 +355,11 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel } get hasDamage() { - return Boolean(Object.keys(this.damage?.parts ?? {}).length) && this.type !== 'healing'; + return !foundry.utils.isEmpty(this.damage?.parts) && this.type !== 'healing'; } get hasHealing() { - return Boolean(Object.keys(this.damage?.parts ?? {}).length) && this.type === 'healing'; + return !foundry.utils.isEmpty(this.damage?.parts) && this.type === 'healing'; } get hasSave() { diff --git a/module/data/actor/character.mjs b/module/data/actor/character.mjs index d5481cc5..7af4da9c 100644 --- a/module/data/actor/character.mjs +++ b/module/data/actor/character.mjs @@ -757,6 +757,7 @@ export default class DhCharacter extends DhCreature { static migrateData(source) { if (typeof source.scars === 'object') source.scars = 0; + if (source.resources?.hope?.max) source.scars = Math.max(6 - source.resources.hope.max, 0); return super.migrateData(source); } diff --git a/module/dice/dhRoll.mjs b/module/dice/dhRoll.mjs index b74adaf3..b827b490 100644 --- a/module/dice/dhRoll.mjs +++ b/module/dice/dhRoll.mjs @@ -143,7 +143,6 @@ export default class DHRoll extends Roll { return foundry.applications.handlebars.renderTemplate(template, { ...chatData, parent: chatData.parent, - targetMode: chatData.targetMode, metagamingSettings }); } diff --git a/module/helpers/handlebarsHelper.mjs b/module/helpers/handlebarsHelper.mjs index 7f30d970..faf6d7c4 100644 --- a/module/helpers/handlebarsHelper.mjs +++ b/module/helpers/handlebarsHelper.mjs @@ -49,8 +49,7 @@ export default class RegisterHandlebarsHelpers { } static damageSymbols(damageParts) { - const allTypes = [...new Set([...damageParts].flatMap(x => Array.from(x.type)))]; - const symbols = allTypes.map(p => CONFIG.DH.GENERAL.damageTypes[p].icon); + const symbols = new Set(...damageParts.map(x => x.type)).map(p => CONFIG.DH.GENERAL.damageTypes[p].icon); return new Handlebars.SafeString(Array.from(symbols).map(symbol => ``)); } diff --git a/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs b/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs index 30369d52..32464000 100644 --- a/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs +++ b/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs @@ -27,7 +27,7 @@ - {{else if (eq member.rollType 'damageAbility')}} + {{else if (eq member.rollType 'abilityDamage')}}