Standardized what gets refreshed by which refreshType (#1374)

This commit is contained in:
WBHarry 2025-12-07 00:53:33 +01:00 committed by GitHub
parent 2a622a7363
commit 14ac8977af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 9 deletions

View file

@ -452,6 +452,23 @@ export async function waitForDiceSoNice(message) {
}
}
export function refreshIsAllowed(allowedTypes, typeToCheck) {
switch (typeToCheck) {
case CONFIG.DH.GENERAL.refreshTypes.scene.id:
case CONFIG.DH.GENERAL.refreshTypes.session.id:
case CONFIG.DH.GENERAL.refreshTypes.longRest.id:
return allowedTypes.includes(typeToCheck);
case CONFIG.DH.GENERAL.refreshTypes.shortRest.id:
return allowedTypes.some(
x =>
x === CONFIG.DH.GENERAL.refreshTypes.shortRest.id ||
x === CONFIG.DH.GENERAL.refreshTypes.longRest.id
);
default:
return false;
}
}
export async function getCritDamageBonus(formula) {
const critRoll = new Roll(formula);
return critRoll.dice.reduce((acc, dice) => acc + dice.faces, 0);