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 dieIndex = diceType === 'hope' ? 0 : diceType === 'fear' ? 1 : 2;
|
||||||
const newRoll = game.system.api.dice.DualityRoll.fromData(memberData.rollData);
|
const newRoll = game.system.api.dice.DualityRoll.fromData(memberData.rollData);
|
||||||
const dice = newRoll.dice[dieIndex];
|
const dice = newRoll.dice[dieIndex];
|
||||||
await dice.reroll(`/r1=${dice.total}`, { liveRoll: true });
|
await dice.reroll(`/r1=${dice.total}`, {
|
||||||
await newRoll._evaluate();
|
liveRoll: {
|
||||||
|
roll: newRoll,
|
||||||
|
isReaction: true
|
||||||
|
}
|
||||||
|
});
|
||||||
const rollData = newRoll.toJSON();
|
const rollData = newRoll.toJSON();
|
||||||
this.updatePartyData(
|
this.updatePartyData(
|
||||||
{
|
{
|
||||||
|
|
@ -694,6 +698,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
|
|
||||||
const joinedRoll = await this.getJoinedRoll();
|
const joinedRoll = await this.getJoinedRoll();
|
||||||
const mainRoll = joinedRoll.rollData;
|
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);
|
const mainActor = this.party.system.partyMembers.find(x => x.uuid === mainRoll.options.source.actor);
|
||||||
mainRoll.options.title = game.i18n.localize('DAGGERHEART.APPLICATIONS.TagTeamSelect.chatMessageRollTitle');
|
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);
|
await cls.create(msgData);
|
||||||
|
|
||||||
/* Handle resource updates from the finished TagTeamRoll */
|
/* Handle resource updates from the finished TagTeamRoll */
|
||||||
// const tagTeamData = this.party.system.tagTeam;
|
const tagTeamData = this.party.system.tagTeam;
|
||||||
// const fearUpdate = { key: 'fear', value: null, total: null, enabled: true };
|
const fearUpdate = { key: 'fear', value: null, total: null, enabled: true };
|
||||||
// for (let memberId in tagTeamData.members) {
|
for (let memberId in tagTeamData.members) {
|
||||||
// const resourceUpdates = [];
|
const resourceUpdates = [];
|
||||||
// const rollGivesHope = mainRoll.options.roll.isCritical || mainRoll.options.roll.result.duality === 1;
|
const rollGivesHope = finalRoll.isCritical || finalRoll.withHope;
|
||||||
// if (memberId === tagTeamData.initiator.memberId) {
|
if (memberId === tagTeamData.initiator.memberId) {
|
||||||
// const value = tagTeamData.initiator.cost
|
const value = tagTeamData.initiator.cost
|
||||||
// ? rollGivesHope
|
? rollGivesHope
|
||||||
// ? 1 - tagTeamData.initiator.cost
|
? 1 - tagTeamData.initiator.cost
|
||||||
// : -tagTeamData.initiator.cost
|
: -tagTeamData.initiator.cost
|
||||||
// : 1;
|
: 1;
|
||||||
// resourceUpdates.push({ key: 'hope', value: value, total: -value, enabled: true });
|
resourceUpdates.push({ key: 'hope', value: value, total: -value, enabled: true });
|
||||||
// } else if (rollGivesHope) {
|
} else if (rollGivesHope) {
|
||||||
// resourceUpdates.push({ key: 'hope', value: 1, total: -1, enabled: true });
|
resourceUpdates.push({ key: 'hope', value: 1, total: -1, enabled: true });
|
||||||
// }
|
}
|
||||||
// if (mainRoll.options.roll.isCritical)
|
if (finalRoll.isCritical) resourceUpdates.push({ key: 'stress', value: -1, total: 1, enabled: true });
|
||||||
// resourceUpdates.push({ key: 'stress', value: -1, total: 1, enabled: true });
|
if (finalRoll.withFear) {
|
||||||
// if (mainRoll.options.roll.result.duality === -1) {
|
fearUpdate.value = fearUpdate.value === null ? 1 : fearUpdate.value + 1;
|
||||||
// fearUpdate.value = fearUpdate.value === null ? 1 : fearUpdate.value + 1;
|
fearUpdate.total = fearUpdate.total === null ? -1 : fearUpdate.total - 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) {
|
if (fearUpdate.value) {
|
||||||
// mainActor.modifyResource([fearUpdate]);
|
mainActor.modifyResource([fearUpdate]);
|
||||||
// }
|
}
|
||||||
|
|
||||||
/* Fin */
|
/* Fin */
|
||||||
this.cancelRoll({ confirm: false });
|
this.cancelRoll({ confirm: false });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue