This commit is contained in:
WBHarry 2026-03-15 14:36:34 +01:00
parent 3769e2c325
commit 56b9ee2b14
2 changed files with 45 additions and 24 deletions

View file

@ -97,23 +97,29 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
for (const actorId in this.party.system.tagTeam.members) { for (const actorId in this.party.system.tagTeam.members) {
const data = this.party.system.tagTeam.members[actorId]; const data = this.party.system.tagTeam.members[actorId];
const actor = game.actors.get(actorId); const actor = game.actors.get(actorId);
const rollOptions = actor.items.reduce((acc, item) => {
if (item.system.metadata.hasActions) const rollOptions = [];
acc.push( const damageRollOptions = [];
...item.system.actions.reduce((acc, action) => { for (const item of actor.items) {
if (action.hasRoll) if (item.system.metadata.hasActions) {
acc.push({ const actions = [
...item.system.actions,
...(item.system.attack ? [item.system.attack] : [])
];
for (const action of actions) {
if (action.hasRoll) {
const actionItem = {
value: action.uuid, value: action.uuid,
label: action.name, label: action.name,
group: item.name group: item.name,
}); baseAction: action.baseAction
};
return acc; rollOptions.push(actionItem);
}, []) if (action.hasDamage) damageRollOptions.push(actionItem);
); }
}
return acc; }
}, []); }
const damage = data.rollData?.options?.damage; const damage = data.rollData?.options?.damage;
partContext.hasDamage |= Boolean(damage); partContext.hasDamage |= Boolean(damage);
@ -125,6 +131,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
readyToRoll: Boolean(data.rollChoice), readyToRoll: Boolean(data.rollChoice),
hasRolled: Boolean(data.rollData), hasRolled: Boolean(data.rollData),
rollOptions, rollOptions,
damageRollOptions,
damage: damage, damage: damage,
critDamage: critHitPointsDamage, critDamage: critHitPointsDamage,
useCritDamage: useCritDamage:
@ -231,6 +238,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
result = await this.makeTraitRoll(member); result = await this.makeTraitRoll(member);
break; break;
case CONFIG.DH.GENERAL.tagTeamRollTypes.ability.id: case CONFIG.DH.GENERAL.tagTeamRollTypes.ability.id:
case CONFIG.DH.GENERAL.tagTeamRollTypes.damageAbility.id:
result = await this.makeAbilityRoll(event, member); result = await this.makeAbilityRoll(event, member);
break; break;
} }
@ -430,10 +438,11 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
const isCritical = overrideIsCritical ?? systemData.roll.isCritical; const isCritical = overrideIsCritical ?? systemData.roll.isCritical;
if (isCritical) systemData.damage = await this.getCriticalDamage(systemData.damage); if (isCritical) systemData.damage = await this.getCriticalDamage(systemData.damage);
if (secondaryRollData?.options.hasDamage && systemData.damage) { if (secondaryRollData?.options.hasDamage) {
const secondaryDamage = (displayVersion ? overrideIsCritical : isCritical) const secondaryDamage = (displayVersion ? overrideIsCritical : isCritical)
? await this.getCriticalDamage(secondaryRollData.options.damage) ? await this.getCriticalDamage(secondaryRollData.options.damage)
: secondaryRollData.options.damage; : secondaryRollData.options.damage;
if (systemData.damage) {
for (const key in secondaryDamage) { for (const key in secondaryDamage) {
const damage = secondaryDamage[key]; const damage = secondaryDamage[key];
systemData.damage[key].formula = [systemData.damage[key].formula, damage.formula] systemData.damage[key].formula = [systemData.damage[key].formula, damage.formula]
@ -442,6 +451,9 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
systemData.damage[key].total += damage.total; systemData.damage[key].total += damage.total;
systemData.damage[key].parts.push(...damage.parts); systemData.damage[key].parts.push(...damage.parts);
} }
} else {
systemData.damage = secondaryDamage;
}
} }
return mainRoll; return mainRoll;

View file

@ -27,6 +27,15 @@
</select> </select>
</div> </div>
</div> </div>
{{else if (eq member.rollType 'abilityDamage')}}
<div class="form-group">
<div class="form-fields">
<label>{{localize "Damage Ability"}}</label>
<select name="{{concat "system.tagTeam.members." key ".rollChoice"}}" {{#if member.hasRolled}}disabled{{/if}}>
{{selectOptions member.damageRollOptions selected=member.rollChoice localize=true blank=""}}
</select>
</div>
</div>
{{else}} {{else}}
<div class="form-group"> <div class="form-group">
<div class="form-fields"> <div class="form-fields">