mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-13 20:21:06 +01:00
Temp
This commit is contained in:
parent
4f5e693c7f
commit
b7f962b22d
16 changed files with 844 additions and 212 deletions
|
|
@ -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]];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue