mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Fixed actionType constants
This commit is contained in:
parent
b8e08fccd1
commit
f786ee5f06
3 changed files with 23 additions and 23 deletions
|
|
@ -195,9 +195,9 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
if (this.config.roll) {
|
if (this.config.roll) {
|
||||||
this.reactionOverride = !this.reactionOverride;
|
this.reactionOverride = !this.reactionOverride;
|
||||||
this.config.actionType = this.reactionOverride
|
this.config.actionType = this.reactionOverride
|
||||||
? CONFIG.DH.ITEM.actionTypes.reaction.id
|
? 'reaction'
|
||||||
: this.config.actionType === CONFIG.DH.ITEM.actionTypes.reaction.id
|
: this.config.actionType === 'reaction'
|
||||||
? CONFIG.DH.ITEM.actionTypes.action.id
|
? 'action'
|
||||||
: this.config.actionType;
|
: this.config.actionType;
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -240,11 +240,13 @@ export default class DHRoll extends Roll {
|
||||||
async function automateHopeFear(config) {
|
async function automateHopeFear(config) {
|
||||||
const automationSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
|
const automationSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
|
||||||
const hopeFearAutomation = automationSettings.hopeFear;
|
const hopeFearAutomation = automationSettings.hopeFear;
|
||||||
if (!config.source?.actor ||
|
if (
|
||||||
|
!config.source?.actor ||
|
||||||
(game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) ||
|
(game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) ||
|
||||||
config.actionType === 'reaction' ||
|
config.actionType === 'reaction' ||
|
||||||
config.tagTeamSelected ||
|
config.tagTeamSelected ||
|
||||||
config.skips?.resources)
|
config.skips?.resources
|
||||||
|
)
|
||||||
return;
|
return;
|
||||||
const actor = await fromUuid(config.source.actor);
|
const actor = await fromUuid(config.source.actor);
|
||||||
let updates = [];
|
let updates = [];
|
||||||
|
|
@ -252,26 +254,22 @@ async function automateHopeFear(config) {
|
||||||
|
|
||||||
if (config.rerolledRoll) {
|
if (config.rerolledRoll) {
|
||||||
if (config.roll.result.duality != config.rerolledRoll.result.duality) {
|
if (config.roll.result.duality != config.rerolledRoll.result.duality) {
|
||||||
const hope = (config.roll.isCritical || config.roll.result.duality === 1 ? 1 : 0)
|
const hope =
|
||||||
- (config.rerolledRoll.isCritical || config.rerolledRoll.result.duality === 1 ? 1 : 0);
|
(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 stress = (config.roll.isCritical ? 1 : 0) - (config.rerolledRoll.isCritical ? 1 : 0);
|
||||||
const fear = (config.roll.result.duality === -1 ? 1 : 0)
|
const fear =
|
||||||
- (config.rerolledRoll.result.duality === -1 ? 1 : 0)
|
(config.roll.result.duality === -1 ? 1 : 0) - (config.rerolledRoll.result.duality === -1 ? 1 : 0);
|
||||||
|
|
||||||
if (hope !== 0)
|
if (hope !== 0) updates.push({ key: 'hope', value: hope, total: -1 * hope, enabled: true });
|
||||||
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 (stress !== 0)
|
if (fear !== 0) updates.push({ key: 'fear', value: fear, total: -1 * fear, enabled: true });
|
||||||
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 {
|
} else {
|
||||||
if (config.roll.isCritical || config.roll.result.duality === 1)
|
if (config.roll.isCritical || config.roll.result.duality === 1)
|
||||||
updates.push({ key: 'hope', value: 1, total: -1, enabled: true });
|
updates.push({ key: 'hope', value: 1, total: -1, enabled: true });
|
||||||
if (config.roll.isCritical)
|
if (config.roll.isCritical) updates.push({ key: 'stress', value: -1, total: 1, enabled: true });
|
||||||
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.result.duality === -1)
|
|
||||||
updates.push({ key: 'fear', value: 1, total: -1, enabled: true });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updates.length) {
|
if (updates.length) {
|
||||||
|
|
@ -287,15 +285,17 @@ export const registerRollDiceHooks = () => {
|
||||||
const automationSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
|
const automationSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
|
||||||
if (
|
if (
|
||||||
automationSettings.countdownAutomation &&
|
automationSettings.countdownAutomation &&
|
||||||
config.actionType !== CONFIG.DH.ITEM.actionTypes.reaction.id &&
|
config.actionType !== 'reaction' &&
|
||||||
!config.tagTeamSelected &&
|
!config.tagTeamSelected &&
|
||||||
!config.skips?.updateCountdowns
|
!config.skips?.updateCountdowns
|
||||||
) {
|
) {
|
||||||
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
|
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
|
||||||
|
|
||||||
if (config.roll.result.duality === -1) {
|
if (config.roll.result.duality === -1) {
|
||||||
await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id,
|
await updateCountdowns(
|
||||||
CONFIG.DH.GENERAL.countdownProgressionTypes.fear.id);
|
CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id,
|
||||||
|
CONFIG.DH.GENERAL.countdownProgressionTypes.fear.id
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id);
|
await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export default class DualityRoll extends D20Roll {
|
||||||
|
|
||||||
get title() {
|
get title() {
|
||||||
return game.i18n.localize(
|
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'}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue