about summary refs log tree commit diff stats
path: root/src/bestiary.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/bestiary.js')
-rw-r--r--src/bestiary.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/bestiary.js b/src/bestiary.js
index e38fc90..9a2728c 100644
--- a/src/bestiary.js
+++ b/src/bestiary.js
@@ -13,6 +13,18 @@ const bestiaries = {
   hydatos: hydatosB,
 };
 
+export const logograms = {
+  CONCEPTUAL: 0,
+  FUNDAMENTAL: 1,
+  OFFENSIVE: 2,
+  PROTECTIVE: 3,
+  CURATIVE: 4,
+  TACTICAL: 5,
+  INMICAL: 6,
+  MITIGATIVE: 7,
+  OBSCURE: 8,
+};
+
 export function getMatches(forecast, level) {
   let res = [];
   bestiaries[forecast[0].zone].forEach((b) => {
@@ -21,13 +33,18 @@ export function getMatches(forecast, level) {
       (b.levelRange && b.levelRange[0] - 2 <= level && b.levelRange[1] >= level)
     ) {
       res.push({
-        name: b.name,
+        name: b.name.trim(),
         level: b.level,
         levelRange: b.levelRange,
         elem: b.elem,
         special: b.type > 0,
         mutating: b.type === 1,
         augmenting: b.type === 2,
+        spawning:
+          !b.spawnConditions ||
+          b.spawnConditions.includes(forecast[0].currWeather),
+        nextSpawn:
+          !b.spawnConditions || findNextSpawn(forecast, b.spawnConditions),
         uptime: findForecastMatch(forecast, b.conditions),
       });
     }
@@ -51,6 +68,12 @@ function findForecastMatch(forecast, conditions) {
   };
 }
 
+function findNextSpawn(forecast, spawnConditions) {
+  return forecast.find((f) => {
+    return spawnConditions.includes(forecast.currWeather);
+  });
+}
+
 function forecastMatches(forecast, condition, index) {
   const currWeather = forecast[index].currWeather;
   return condition.some((c) => c === currWeather);