mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Fixed TagTeamDialog
This commit is contained in:
parent
fe0cb4468c
commit
714d4edc16
1 changed files with 32 additions and 28 deletions
|
|
@ -452,8 +452,12 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
const dieIndex = diceType === 'hope' ? 0 : diceType === 'fear' ? 1 : 2;
|
||||
const newRoll = game.system.api.dice.DualityRoll.fromData(memberData.rollData);
|
||||
const dice = newRoll.dice[dieIndex];
|
||||
await dice.reroll(`/r1=${dice.total}`, { liveRoll: true });
|
||||
await newRoll._evaluate();
|
||||
await dice.reroll(`/r1=${dice.total}`, {
|
||||
liveRoll: {
|
||||
roll: newRoll,
|
||||
isReaction: true
|
||||
}
|
||||
});
|
||||
const rollData = newRoll.toJSON();
|
||||
this.updatePartyData(
|
||||
{
|
||||
|
|
@ -694,6 +698,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
|
||||
const joinedRoll = await this.getJoinedRoll();
|
||||
const mainRoll = joinedRoll.rollData;
|
||||
const finalRoll = foundry.utils.deepClone(joinedRoll.roll);
|
||||
|
||||
const mainActor = this.party.system.partyMembers.find(x => x.uuid === mainRoll.options.source.actor);
|
||||
mainRoll.options.title = game.i18n.localize('DAGGERHEART.APPLICATIONS.TagTeamSelect.chatMessageRollTitle');
|
||||
|
|
@ -712,34 +717,33 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
await cls.create(msgData);
|
||||
|
||||
/* Handle resource updates from the finished TagTeamRoll */
|
||||
// const tagTeamData = this.party.system.tagTeam;
|
||||
// const fearUpdate = { key: 'fear', value: null, total: null, enabled: true };
|
||||
// for (let memberId in tagTeamData.members) {
|
||||
// const resourceUpdates = [];
|
||||
// const rollGivesHope = mainRoll.options.roll.isCritical || mainRoll.options.roll.result.duality === 1;
|
||||
// if (memberId === tagTeamData.initiator.memberId) {
|
||||
// const value = tagTeamData.initiator.cost
|
||||
// ? rollGivesHope
|
||||
// ? 1 - tagTeamData.initiator.cost
|
||||
// : -tagTeamData.initiator.cost
|
||||
// : 1;
|
||||
// resourceUpdates.push({ key: 'hope', value: value, total: -value, enabled: true });
|
||||
// } else if (rollGivesHope) {
|
||||
// resourceUpdates.push({ key: 'hope', value: 1, total: -1, enabled: true });
|
||||
// }
|
||||
// if (mainRoll.options.roll.isCritical)
|
||||
// resourceUpdates.push({ key: 'stress', value: -1, total: 1, enabled: true });
|
||||
// if (mainRoll.options.roll.result.duality === -1) {
|
||||
// fearUpdate.value = fearUpdate.value === null ? 1 : fearUpdate.value + 1;
|
||||
// fearUpdate.total = fearUpdate.total === null ? -1 : fearUpdate.total - 1;
|
||||
// }
|
||||
const tagTeamData = this.party.system.tagTeam;
|
||||
const fearUpdate = { key: 'fear', value: null, total: null, enabled: true };
|
||||
for (let memberId in tagTeamData.members) {
|
||||
const resourceUpdates = [];
|
||||
const rollGivesHope = finalRoll.isCritical || finalRoll.withHope;
|
||||
if (memberId === tagTeamData.initiator.memberId) {
|
||||
const value = tagTeamData.initiator.cost
|
||||
? rollGivesHope
|
||||
? 1 - tagTeamData.initiator.cost
|
||||
: -tagTeamData.initiator.cost
|
||||
: 1;
|
||||
resourceUpdates.push({ key: 'hope', value: value, total: -value, enabled: true });
|
||||
} else if (rollGivesHope) {
|
||||
resourceUpdates.push({ key: 'hope', value: 1, total: -1, enabled: true });
|
||||
}
|
||||
if (finalRoll.isCritical) resourceUpdates.push({ key: 'stress', value: -1, total: 1, enabled: true });
|
||||
if (finalRoll.withFear) {
|
||||
fearUpdate.value = fearUpdate.value === null ? 1 : fearUpdate.value + 1;
|
||||
fearUpdate.total = fearUpdate.total === null ? -1 : fearUpdate.total - 1;
|
||||
}
|
||||
|
||||
// game.actors.get(memberId).modifyResource(resourceUpdates);
|
||||
// }
|
||||
game.actors.get(memberId).modifyResource(resourceUpdates);
|
||||
}
|
||||
|
||||
// if (fearUpdate.value) {
|
||||
// mainActor.modifyResource([fearUpdate]);
|
||||
// }
|
||||
if (fearUpdate.value) {
|
||||
mainActor.modifyResource([fearUpdate]);
|
||||
}
|
||||
|
||||
/* Fin */
|
||||
this.cancelRoll({ confirm: false });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue