summaryrefslogtreecommitdiff
path: root/src/maps/maps.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/maps/maps.js')
-rw-r--r--src/maps/maps.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/maps/maps.js b/src/maps/maps.js
index 08ce779..ce91c24 100644
--- a/src/maps/maps.js
+++ b/src/maps/maps.js
@@ -28,7 +28,7 @@ function getTalentName(talent) {
}
function getTalentRarity(talent) {
- if (talent == 'NoTalent') {
+ if (!talent || talent == 'NoTalent') {
return 'None';
}
@@ -45,14 +45,21 @@ function getTalentRarity(talent) {
}
}
-function getScaledLevel(entry) {
+function getMaxLevel(entry) {
switch (getTalentRarity(entry.Talent)) {
case 'unknown':
case 'None': return -1;
- case 'Rare': return entry.Level / 20;
- case 'Epic': return entry.Level / 10;
- case 'Legendary': return entry.Level / 5;
+ case 'Rare': return 20;
+ case 'Epic': return 10;
+ case 'Legendary': return 5;
+ }
+};
+
+function getScaledLevel(entry) {
+ if (['unknown', 'None'].includes(getTalentRarity(entry.Talent))) {
+ return 0;
}
+ return entry.Level / getMaxLevel(entry);
};
function getHero(actor) {
@@ -75,6 +82,7 @@ module.exports = {
RARITIES,
getTalentName,
getTalentRarity,
+ getMaxLevel,
getScaledLevel,
getHero,
getMode,