fish_lib/data/
encounter_data.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Default, Serialize, Deserialize, PartialEq)]
4pub struct EncounterData {
5    pub location_id: i32,
6    /// Minimum and maximum local time (24h-format) this fish can be encountered at
7    /// 16-16 means a fish will only appear from 4:00pm to 4:59pm
8    /// 16-17 means a fish will only appear from 4:00pm to 5:59pm
9    pub min_time_hour: u8,
10    pub max_time_hour: u8,
11    /// The higher, the rarer
12    pub rarity_level: u8,
13    #[serde(default = "default_false")]
14    pub needs_rain: bool,
15}
16
17fn default_false() -> bool {
18    false
19}
20
21impl EncounterData {
22    pub fn get_hours(&self) -> Vec<u8> {
23        (self.min_time_hour..=self.max_time_hour).collect()
24    }
25}