From c0354b250f84d578b609a7f25d71dee7fc24e9ca Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Tue, 22 Aug 2023 15:01:03 +0200 Subject: currency, save/load --- resources/js/formula.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'resources/js/formula.js') diff --git a/resources/js/formula.js b/resources/js/formula.js index 5a3433f..7223cb8 100644 --- a/resources/js/formula.js +++ b/resources/js/formula.js @@ -91,3 +91,17 @@ function calculateAwardedExperience (opposingMonster, participants) { return awardedExperienceDistribution; } + +/** + * @param {Monster} opposingMonster + * + * @returns {number[]} + */ +function calculateAwardedMoney (opposingMonster) { + let money = opposingMonster.level * opposingMonster.moneyModifier; + + const baseDecimalDiff = 2 - DB.currencies.map[Memory.state.Settings.currency].decimals; + money = money * Math.pow(10, baseDecimalDiff); + + return money; +} -- cgit v1.2.3