Compare commits

..

No commits in common. "f949e859eee81762065f0fe065f84bb23423500d" and "6a8b0d33b9f9bc8b6be4b18af96d44351ee3b73e" have entirely different histories.

6 changed files with 16 additions and 23 deletions

View file

@ -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`]: {

View file

@ -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() {

View file

@ -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);
}

View file

@ -143,7 +143,6 @@ export default class DHRoll extends Roll {
return foundry.applications.handlebars.renderTemplate(template, {
...chatData,
parent: chatData.parent,
targetMode: chatData.targetMode,
metagamingSettings
});
}

View file

@ -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 => `<i class="fa-solid ${symbol}"></i>`));
}

View file

@ -27,7 +27,7 @@
</select>
</div>
</div>
{{else if (eq member.rollType 'damageAbility')}}
{{else if (eq member.rollType 'abilityDamage')}}
<div class="form-group">
<div class="form-fields">
<label>{{localize "DAGGERHEART.CONFIG.TagTeamRollTypes.damageAbility"}}</label>
@ -79,7 +79,7 @@
<span class="dice-label">{{this.fear.value}}</span>
<img src="{{concat "systems/daggerheart/assets/icons/dice/fear/" this.fear.dice ".svg"}}" />
</a>
{{#if this.advantage.type}}
{{#if this.advantage}}
<span class="roll-operator">{{#if (eq this.advantage.type 1)}}+{{else}}-{{/if}}</span>
<span class="roll-dice">
<span class="dice-label">{{this.advantage.value}}</span>