This commit is contained in:
WBHarry 2025-06-29 22:58:21 +02:00
parent 4f5e693c7f
commit b7f962b22d
16 changed files with 844 additions and 212 deletions

View file

@ -1,4 +1,4 @@
import { getDiceSoNicePresets } from '../config/generalConfig.mjs';
import { diceTypes, getDiceSoNicePresets, range } from '../config/generalConfig.mjs';
import Tagify from '@yaireo/tagify';
export const loadCompendiumOptions = async compendiums => {
@ -259,3 +259,17 @@ export const damageKeyToNumber = key => {
return 0;
}
};
export const adjustDice = (dice, decrease) => {
const diceKeys = Object.keys(diceTypes);
const index = diceKeys.indexOf(dice);
const newIndex = decrease ? Math.max(index - 1, 0) : Math.min(index + 1, diceKeys.length - 1);
return diceTypes[diceKeys[newIndex]];
};
export const adjustRange = (rangeVal, decrease) => {
const rangeKeys = Object.keys(range);
const index = rangeKeys.indexOf(rangeVal);
const newIndex = decrease ? Math.max(index - 1, 0) : Math.min(index + 1, rangeKeys.length - 1);
return range[rangeKeys[newIndex]];
};