#pragma once // Species selection for wild spawns (habitat, rarity, zone type weights and // time/weather conditions) and the weather Markov chain. #include "Protocol.h" #include "Rng.h" #include "Roster.h" #include #include namespace bs { enum class SpawnHabitat { Land = 0, Water = 1 }; inline bool isNight(float hour) { return hour < 5.5f || hour > 19.5f; } class SpawnTables { public: // Rebuilds the cumulative tables when (night, weather) differs from the cached condition. void update(const Roster& roster, const std::string& zoneId, float hour, Weather weather); // Returns false when no species fits the habitat. bool pick(Rng& rng, SpawnHabitat h, uint16_t& species) const; private: struct Table { std::vector cumulative; std::vector ids; }; Table tables_[2]; int key_ = -1; const Roster* roster_ = nullptr; }; // Next weather state; called every 3-8 real minutes. Weather nextWeather(Rng& rng, Weather current, float hour); } // namespace bs