mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
159 - Companion (#224)
* Initial datamodel * Fixed attack * Temp * Fixed normal levelup * Fixed showing summary of new experiences * Touchups * level sync fixes * Reworked Action storage * Companions now take stress when damaged * Fixed Feature flow * Removed retroactive companion levelup * Restored delevel on partner removal * PR fixes * Added a check for card duplicates on character
This commit is contained in:
parent
6f1529fefe
commit
b7e4169079
57 changed files with 1682 additions and 1012 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 => {
|
||||
|
|
@ -225,10 +225,10 @@ export const getDeleteKeys = (property, innerProperty, innerPropertyDefaultValue
|
|||
|
||||
// Fix on Foundry native formula replacement for DH
|
||||
const nativeReplaceFormulaData = Roll.replaceFormulaData;
|
||||
Roll.replaceFormulaData = function (formula, data={}, { missing, warn = false } = {}) {
|
||||
Roll.replaceFormulaData = function (formula, data = {}, { missing, warn = false } = {}) {
|
||||
const terms = Object.keys(SYSTEM.GENERAL.multiplierTypes).map(type => {
|
||||
return { term: type, default: 1}
|
||||
})
|
||||
return { term: type, default: 1 };
|
||||
});
|
||||
formula = terms.reduce((a, c) => a.replaceAll(`@${c.term}`, data[c.term] ?? c.default), formula);
|
||||
return nativeReplaceFormulaData(formula, data, { missing, warn });
|
||||
};
|
||||
|
|
@ -258,3 +258,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