Fixed actionType constants

This commit is contained in:
WBHarry 2025-12-21 15:39:05 +01:00
parent b8e08fccd1
commit f786ee5f06
3 changed files with 23 additions and 23 deletions

View file

@ -195,9 +195,9 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
if (this.config.roll) {
this.reactionOverride = !this.reactionOverride;
this.config.actionType = this.reactionOverride
? CONFIG.DH.ITEM.actionTypes.reaction.id
: this.config.actionType === CONFIG.DH.ITEM.actionTypes.reaction.id
? CONFIG.DH.ITEM.actionTypes.action.id
? 'reaction'
: this.config.actionType === 'reaction'
? 'action'
: this.config.actionType;
this.render();
}

View file

@ -240,11 +240,13 @@ export default class DHRoll extends Roll {
async function automateHopeFear(config) {
const automationSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
const hopeFearAutomation = automationSettings.hopeFear;
if (!config.source?.actor ||
if (
!config.source?.actor ||
(game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) ||
config.actionType === 'reaction' ||
config.tagTeamSelected ||
config.skips?.resources)
config.skips?.resources
)
return;
const actor = await fromUuid(config.source.actor);
let updates = [];
@ -252,26 +254,22 @@ async function automateHopeFear(config) {
if (config.rerolledRoll) {
if (config.roll.result.duality != config.rerolledRoll.result.duality) {
const hope = (config.roll.isCritical || config.roll.result.duality === 1 ? 1 : 0)
- (config.rerolledRoll.isCritical || config.rerolledRoll.result.duality === 1 ? 1 : 0);
const hope =
(config.roll.isCritical || config.roll.result.duality === 1 ? 1 : 0) -
(config.rerolledRoll.isCritical || config.rerolledRoll.result.duality === 1 ? 1 : 0);
const stress = (config.roll.isCritical ? 1 : 0) - (config.rerolledRoll.isCritical ? 1 : 0);
const fear = (config.roll.result.duality === -1 ? 1 : 0)
- (config.rerolledRoll.result.duality === -1 ? 1 : 0)
const fear =
(config.roll.result.duality === -1 ? 1 : 0) - (config.rerolledRoll.result.duality === -1 ? 1 : 0);
if (hope !== 0)
updates.push({ key: 'hope', value: hope, total: -1 * hope, enabled: true });
if (stress !== 0)
updates.push({ key: 'stress', value: -1 * stress, total: stress, enabled: true });
if (fear !== 0)
updates.push({ key: 'fear', value: fear, total: -1 * fear, enabled: true });
if (hope !== 0) updates.push({ key: 'hope', value: hope, total: -1 * hope, enabled: true });
if (stress !== 0) updates.push({ key: 'stress', value: -1 * stress, total: stress, enabled: true });
if (fear !== 0) updates.push({ key: 'fear', value: fear, total: -1 * fear, enabled: true });
}
} else {
if (config.roll.isCritical || config.roll.result.duality === 1)
updates.push({ key: 'hope', value: 1, total: -1, enabled: true });
if (config.roll.isCritical)
updates.push({ key: 'stress', value: -1, total: 1, enabled: true });
if (config.roll.result.duality === -1)
updates.push({ key: 'fear', value: 1, total: -1, enabled: true });
if (config.roll.isCritical) updates.push({ key: 'stress', value: -1, total: 1, enabled: true });
if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1, total: -1, enabled: true });
}
if (updates.length) {
@ -287,15 +285,17 @@ export const registerRollDiceHooks = () => {
const automationSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
if (
automationSettings.countdownAutomation &&
config.actionType !== CONFIG.DH.ITEM.actionTypes.reaction.id &&
config.actionType !== 'reaction' &&
!config.tagTeamSelected &&
!config.skips?.updateCountdowns
) {
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
if (config.roll.result.duality === -1) {
await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id,
CONFIG.DH.GENERAL.countdownProgressionTypes.fear.id);
await updateCountdowns(
CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id,
CONFIG.DH.GENERAL.countdownProgressionTypes.fear.id
);
} else {
await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id);
}

View file

@ -19,7 +19,7 @@ export default class DualityRoll extends D20Roll {
get title() {
return game.i18n.localize(
`DAGGERHEART.GENERAL.${this.options?.actionType === CONFIG.DH.ITEM.actionTypes.reaction.id ? 'reactionRoll' : 'dualityRoll'}`
`DAGGERHEART.GENERAL.${this.options?.actionType === 'reaction' ? 'reactionRoll' : 'dualityRoll'}`
);
}