TagTeam Fixes

This commit is contained in:
WBHarry 2026-03-16 20:29:12 +01:00
parent 3031531b14
commit ad8caabf71
3 changed files with 20 additions and 14 deletions

View file

@ -1,6 +1,6 @@
import { MemberData } from '../../data/tagTeamData.mjs'; import { MemberData } from '../../data/tagTeamData.mjs';
import { getCritDamageBonus } from '../../helpers/utils.mjs'; import { getCritDamageBonus } from '../../helpers/utils.mjs';
import { RefreshType, socketEvent } from '../../systemRegistration/socket.mjs'; import { emitAsGM, GMUpdateEvent, RefreshType, socketEvent } from '../../systemRegistration/socket.mjs';
import Party from '../sheets/actors/party.mjs'; import Party from '../sheets/actors/party.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
@ -133,8 +133,9 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
group: item.name, group: item.name,
baseAction: action.baseAction baseAction: action.baseAction
}; };
rollOptions.push(actionItem);
if (action.hasDamage) damageRollOptions.push(actionItem); if (action.hasDamage) damageRollOptions.push(actionItem);
else rollOptions.push(actionItem);
} }
} }
} }
@ -179,16 +180,23 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
this.updatePartyData(partyData); this.updatePartyData(partyData);
} }
async updatePartyData(updata, options = { render: true }) { async updatePartyData(update, options = { render: true }) {
await this.party.update(updata); const gmUpdate = async update => {
await this.party.update(update);
if (options.render) { this.render();
this.render(true);
game.socket.emit(`system.${CONFIG.DH.id}`, { game.socket.emit(`system.${CONFIG.DH.id}`, {
action: socketEvent.Refresh, action: socketEvent.Refresh,
data: { refreshType: RefreshType.TagTeamRoll, action: '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() { getIsEditable() {
@ -414,8 +422,6 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
await action.workflow.get('damage').execute(config, null, true); await action.workflow.get('damage').execute(config, null, true);
if (!config.damage) return; 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; const current = this.party.system.tagTeam.members[memberKey].rollData;
await this.updatePartyData({ await this.updatePartyData({
[`system.tagTeam.members.${memberKey}.rollData`]: { [`system.tagTeam.members.${memberKey}.rollData`]: {

View file

@ -355,11 +355,11 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
} }
get hasDamage() { get hasDamage() {
return !foundry.utils.isEmpty(this.damage?.parts) && this.type !== 'healing'; return Boolean(Object.keys(this.damage?.parts ?? {}).length) && this.type !== 'healing';
} }
get hasHealing() { get hasHealing() {
return !foundry.utils.isEmpty(this.damage?.parts) && this.type === 'healing'; return Boolean(Object.keys(this.damage?.parts ?? {}).length) && this.type === 'healing';
} }
get hasSave() { get hasSave() {

View file

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