summaryrefslogtreecommitdiff
path: root/resources/js/formula.js
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-22 15:01:03 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-22 15:01:03 +0200
commitc0354b250f84d578b609a7f25d71dee7fc24e9ca (patch)
treeaf586e0a4c44a2f2c8df956ca3b992be15daaba3 /resources/js/formula.js
parent54e5ffaeb79f989463c144e58dfcd677b752c5a9 (diff)
currency, save/load
Diffstat (limited to 'resources/js/formula.js')
-rw-r--r--resources/js/formula.js14
1 files changed, 14 insertions, 0 deletions
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;
+}