about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorana <ana@ana.st>2021-08-09 15:24:32 +0200
committerana <ana@ana.st>2021-08-09 15:24:32 +0200
commit231f854a1a7fe3ac99aecb97121727997cf8f23f (patch)
treea1fd219f02dc4b87279f8667b80b95776fb01d46
parent0bc1d415c477e0f73f22de4245ac29b9fb5500ce (diff)
downloadeureka-marks-231f854a1a7fe3ac99aecb97121727997cf8f23f.tar.gz
feat: display sprite spawn times
-rw-r--r--CHANGELOG.md5
-rw-r--r--public/index.css5
-rw-r--r--src/App.svelte37
-rw-r--r--src/bestiary.js25
4 files changed, 64 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 35cda01..d82e44e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,11 @@ The site always runs on the latest released version.
 
 ## [Unreleased]
 
+## Added
+
+- Sprites now know about their spawn time, and will tell you if they're not
+  spawning due to a missing weather condition.
+
 ## [1.0.1] - 2021-08-09
 
 ### Fixed
diff --git a/public/index.css b/public/index.css
index 63bffff..b884f1e 100644
--- a/public/index.css
+++ b/public/index.css
@@ -33,3 +33,8 @@ header ul li {
   font-weight: bold;
   color: tomato;
 }
+
+.strikethrough {
+  text-decoration: line-through;
+  color: gray;
+}
diff --git a/src/App.svelte b/src/App.svelte
index b16929b..cd6102b 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -136,9 +136,16 @@
       <ul>
         {#each upMatches as m (m.name + m.level)}
           <li>
-            <em>(Lv{formatLevel(m)})</em> <strong>{m.name}</strong>
-            ({#if m.mutating}mutates{/if}{#if m.augmenting}augments{/if}
-            {formatUptimeUntil(m.uptime.futureUptime)})
+            <span class={!m.spawning && "strikethrough"}>
+              <em>(Lv{formatLevel(m)})</em> <strong>{m.name}</strong>
+              ({#if m.mutating}mutates{/if}{#if m.augmenting}augments{/if}
+              {formatUptimeUntil(m.uptime.futureUptime)})
+            </span>
+            {#if !m.spawning}
+              &nbsp;(next spawns {m.nextSpawn
+                ? day(m.nextSpawn.date).fromNow()
+                : "in a long time"}
+            {/if}
           </li>
         {/each}
       </ul>
@@ -146,7 +153,16 @@
       <h5>regular enemies</h5>
       <ul>
         {#each normalMatches as m (m.name + m.level)}
-          <li><em>(Lv{formatLevel(m)})</em> <strong>{m.name}</strong></li>
+          <li>
+            <span class={!m.spawning && "strikethrough"}>
+              <em>(Lv{formatLevel(m)})</em> <strong>{m.name}</strong>
+            </span>
+            {#if !m.spawning}
+              &nbsp;(next spawns {m.nextSpawn
+                ? day(m.nextSpawn.date).fromNow()
+                : "in a long time"})
+            {/if}
+          </li>
         {/each}
       </ul>
 
@@ -154,9 +170,16 @@
       <ul>
         {#each otherMatches as m (m.name + m.level)}
           <li>
-            <em>(Lv{formatLevel(m)})</em> <strong>{m.name}</strong>
-            ({#if m.mutating}mutates{/if}{#if m.augmenting}augments{/if}
-            {formatNextUptime(m.uptime.futureUptime)})
+            <span class={!m.spawning && "strikethrough"}>
+              <em>(Lv{formatLevel(m)})</em> <strong>{m.name}</strong>
+              ({#if m.mutating}mutates{/if}{#if m.augmenting}augments{/if}
+              {formatNextUptime(m.uptime.futureUptime)})
+            </span>
+            {#if !m.spawning}
+              &nbsp;(next spawns {m.nextSpawn
+                ? day(m.nextSpawn.date).fromNow()
+                : "in a long time"})
+            {/if}
           </li>
         {/each}
       </ul>
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);