Fraser commited on
Commit
c6c9271
·
1 Parent(s): 54ca588
src/lib/components/Battle/FieldEffectIndicator.svelte CHANGED
@@ -2,6 +2,12 @@
2
  export let fieldEffects: Array<{ effect: string; turnsRemaining?: number; side?: string }> = [];
3
 
4
  function getFieldEffectColor(effect: string): string {
 
 
 
 
 
 
5
  if (effect.includes('weather')) return '#4dabf7';
6
  if (effect.includes('terrain')) return '#51cf66';
7
  if (effect.includes('hazard')) return '#ff6b6b';
@@ -9,6 +15,12 @@
9
  }
10
 
11
  function getFieldEffectIcon(effect: string): string {
 
 
 
 
 
 
12
  if (effect.includes('storm')) return '⛈️';
13
  if (effect.includes('rain')) return '🌧️';
14
  if (effect.includes('sun')) return '☀️';
 
2
  export let fieldEffects: Array<{ effect: string; turnsRemaining?: number; side?: string }> = [];
3
 
4
  function getFieldEffectColor(effect: string): string {
5
+ // Defensive check: ensure effect is a string
6
+ if (typeof effect !== 'string') {
7
+ console.warn('FieldEffectIndicator: effect is not a string:', effect);
8
+ return '#868e96';
9
+ }
10
+
11
  if (effect.includes('weather')) return '#4dabf7';
12
  if (effect.includes('terrain')) return '#51cf66';
13
  if (effect.includes('hazard')) return '#ff6b6b';
 
15
  }
16
 
17
  function getFieldEffectIcon(effect: string): string {
18
+ // Defensive check: ensure effect is a string
19
+ if (typeof effect !== 'string') {
20
+ console.warn('FieldEffectIndicator: effect is not a string:', effect);
21
+ return '🌀';
22
+ }
23
+
24
  if (effect.includes('storm')) return '⛈️';
25
  if (effect.includes('rain')) return '🌧️';
26
  if (effect.includes('sun')) return '☀️';