mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
.
This commit is contained in:
parent
3769e2c325
commit
56b9ee2b14
2 changed files with 45 additions and 24 deletions
|
|
@ -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)
|
|
||||||
acc.push(
|
|
||||||
...item.system.actions.reduce((acc, action) => {
|
|
||||||
if (action.hasRoll)
|
|
||||||
acc.push({
|
|
||||||
value: action.uuid,
|
|
||||||
label: action.name,
|
|
||||||
group: item.name
|
|
||||||
});
|
|
||||||
|
|
||||||
return acc;
|
const rollOptions = [];
|
||||||
}, [])
|
const damageRollOptions = [];
|
||||||
);
|
for (const item of actor.items) {
|
||||||
|
if (item.system.metadata.hasActions) {
|
||||||
return acc;
|
const actions = [
|
||||||
}, []);
|
...item.system.actions,
|
||||||
|
...(item.system.attack ? [item.system.attack] : [])
|
||||||
|
];
|
||||||
|
for (const action of actions) {
|
||||||
|
if (action.hasRoll) {
|
||||||
|
const actionItem = {
|
||||||
|
value: action.uuid,
|
||||||
|
label: action.name,
|
||||||
|
group: item.name,
|
||||||
|
baseAction: action.baseAction
|
||||||
|
};
|
||||||
|
rollOptions.push(actionItem);
|
||||||
|
if (action.hasDamage) damageRollOptions.push(actionItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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,17 +438,21 @@ 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;
|
||||||
for (const key in secondaryDamage) {
|
if (systemData.damage) {
|
||||||
const damage = secondaryDamage[key];
|
for (const key in secondaryDamage) {
|
||||||
systemData.damage[key].formula = [systemData.damage[key].formula, damage.formula]
|
const damage = secondaryDamage[key];
|
||||||
.filter(x => x)
|
systemData.damage[key].formula = [systemData.damage[key].formula, damage.formula]
|
||||||
.join(' + ');
|
.filter(x => x)
|
||||||
systemData.damage[key].total += damage.total;
|
.join(' + ');
|
||||||
systemData.damage[key].parts.push(...damage.parts);
|
systemData.damage[key].total += damage.total;
|
||||||
|
systemData.damage[key].parts.push(...damage.parts);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
systemData.damage = secondaryDamage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue