#ifndef PKMNLIB_EVOLUTIONDATA_HPP #define PKMNLIB_EVOLUTIONDATA_HPP #include #include #include "../TimeOfDay.hpp" #include "EvolutionMethod.hpp" namespace PkmnLib::Library { class PokemonSpecies; class MoveData; class Item; class EvolutionData { private: ArbUt::BorrowedPtr _evolvesInto; EvolutionMethod _method; ArbUt::UniquePtrList _evolutionData; EvolutionData(EvolutionMethod method, std::vector data, const PokemonSpecies* next) : _evolvesInto(next), _method(method), _evolutionData(std::move(data)) {} public: ~EvolutionData() = default; static inline const EvolutionData* CreateLevelEvolution(uint8_t level, const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::Level, {new CreatureLib::Library::EffectParameter((int64_t)level)}, into); } static inline const EvolutionData* CreateFriendshipEvolution(uint8_t friendship, const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::HighFriendship, {new CreatureLib::Library::EffectParameter((int64_t)friendship)}, into); } static inline const EvolutionData* CreateFriendshipTimeEvolution(uint8_t friendship, TimeOfDay startTime, TimeOfDay endTime, const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::HighFriendshipTime, {new CreatureLib::Library::EffectParameter((int64_t)friendship), new CreatureLib::Library::EffectParameter((int64_t)startTime), new CreatureLib::Library::EffectParameter((int64_t)endTime)}, into); } static const EvolutionData* CreateKnownMoveEvolution(const MoveData* move, const PokemonSpecies* into); static inline const EvolutionData* CreateLocationEvolution(const ArbUt::StringView& location, const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::LocationBased, {new CreatureLib::Library::EffectParameter(location)}, into); } static inline const EvolutionData* CreateTimeEvolution(TimeOfDay startTime, TimeOfDay endTime, const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::TimeBased, { new CreatureLib::Library::EffectParameter((int64_t)startTime), new CreatureLib::Library::EffectParameter((int64_t)endTime), }, into); } static const EvolutionData* CreateHeldItemEvolution(const Item* item, const PokemonSpecies* into); static const EvolutionData* CreateHeldItemTimeEvolution(const Item* item, TimeOfDay startTime, TimeOfDay endTime, const PokemonSpecies* into); static inline const EvolutionData* CreateGenderBasedEvolution(CreatureLib::Library::Gender gender, uint8_t level, const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::IsGenderAndLevel, {new CreatureLib::Library::EffectParameter((int64_t)gender), new CreatureLib::Library::EffectParameter((int64_t)level)}, into); } static const EvolutionData* CreateItemUseEvolution(const Item* item, const PokemonSpecies* into); static const EvolutionData* CreateItemUseWithGenderEvolution(const Item* item, CreatureLib::Library::Gender gender, const PokemonSpecies* into); static inline const EvolutionData* CreateTradeEvolution(const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::Trade, {}, into); } static const EvolutionData* CreateTradeWithItemEvolution(const Item* item, const PokemonSpecies* into); static const EvolutionData* CreateTradeWithSpeciesEvolution(const PokemonSpecies* traded, const PokemonSpecies* into); static inline const EvolutionData* CreateCustomEvolution(const std::vector& data, const PokemonSpecies* into) { return new EvolutionData(EvolutionMethod::Custom, data, into); } [[nodiscard]] inline ArbUt::BorrowedPtr GetNewSpecies() const noexcept { return _evolvesInto; } [[nodiscard]] inline EvolutionMethod GetMethod() const noexcept { return _method; } [[nodiscard]] inline size_t GetDataCount() const noexcept { return _evolutionData.Count(); } [[nodiscard]] inline const ArbUt::UniquePtrList& GetData() const { return _evolutionData; } [[nodiscard]] inline ArbUt::BorrowedPtr GetDataAt(size_t index) const { return _evolutionData.At(index); } }; } #endif // PKMNLIB_EVOLUTIONDATA_HPP