2020-01-02 12:45:39 +00:00
|
|
|
#ifndef PKMNLIB_EVOLUTIONDATA_HPP
|
|
|
|
#define PKMNLIB_EVOLUTIONDATA_HPP
|
|
|
|
|
2020-04-16 12:25:20 +00:00
|
|
|
#include <CreatureLib/Library/EffectParameter.hpp>
|
2020-02-08 18:22:29 +00:00
|
|
|
#include <CreatureLib/Library/Gender.hpp>
|
2020-01-02 12:45:39 +00:00
|
|
|
#include "../TimeOfDay.hpp"
|
|
|
|
#include "EvolutionMethod.hpp"
|
2020-06-02 18:37:21 +00:00
|
|
|
|
2020-01-02 12:45:39 +00:00
|
|
|
namespace PkmnLib::Library {
|
|
|
|
class PokemonSpecies;
|
2020-04-16 12:25:20 +00:00
|
|
|
class MoveData;
|
2020-01-02 12:45:39 +00:00
|
|
|
class Item;
|
|
|
|
|
|
|
|
class EvolutionData {
|
|
|
|
private:
|
2020-06-02 18:37:21 +00:00
|
|
|
ArbUt::BorrowedPtr<const PokemonSpecies> _evolvesInto;
|
2020-01-02 12:45:39 +00:00
|
|
|
EvolutionMethod _method;
|
2020-06-02 18:37:21 +00:00
|
|
|
ArbUt::UniquePtrList<const CreatureLib::Library::EffectParameter> _evolutionData;
|
2020-01-02 12:45:39 +00:00
|
|
|
|
2020-06-02 18:37:21 +00:00
|
|
|
EvolutionData(EvolutionMethod method, std::vector<const CreatureLib::Library::EffectParameter*> data,
|
2020-04-16 12:25:20 +00:00
|
|
|
const PokemonSpecies* next)
|
2020-01-02 12:45:39 +00:00
|
|
|
: _evolvesInto(next), _method(method), _evolutionData(std::move(data)) {}
|
|
|
|
|
|
|
|
public:
|
2020-06-02 18:37:21 +00:00
|
|
|
~EvolutionData() = default;
|
2020-04-16 12:25:20 +00:00
|
|
|
|
|
|
|
static inline const EvolutionData* CreateLevelEvolution(uint8_t level, const PokemonSpecies* into) {
|
|
|
|
return new EvolutionData(EvolutionMethod::Level,
|
|
|
|
{new CreatureLib::Library::EffectParameter((int64_t)level)}, into);
|
2020-01-02 12:45:39 +00:00
|
|
|
}
|
2020-04-16 12:25:20 +00:00
|
|
|
static inline const EvolutionData* CreateFriendshipEvolution(uint8_t friendship, const PokemonSpecies* into) {
|
|
|
|
return new EvolutionData(EvolutionMethod::HighFriendship,
|
|
|
|
{new CreatureLib::Library::EffectParameter((int64_t)friendship)}, into);
|
2020-01-02 12:45:39 +00:00
|
|
|
}
|
2021-06-26 14:20:25 +00:00
|
|
|
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);
|
|
|
|
}
|
2020-04-16 12:25:20 +00:00
|
|
|
static const EvolutionData* CreateKnownMoveEvolution(const MoveData* move, const PokemonSpecies* into);
|
2020-07-04 13:50:30 +00:00
|
|
|
static inline const EvolutionData* CreateLocationEvolution(const ArbUt::StringView& location,
|
2020-04-16 12:25:20 +00:00
|
|
|
const PokemonSpecies* into) {
|
|
|
|
return new EvolutionData(EvolutionMethod::LocationBased,
|
|
|
|
{new CreatureLib::Library::EffectParameter(location)}, into);
|
2020-01-02 12:45:39 +00:00
|
|
|
}
|
2021-06-26 14:20:25 +00:00
|
|
|
static inline const EvolutionData* CreateTimeEvolution(TimeOfDay startTime, TimeOfDay endTime,
|
|
|
|
const PokemonSpecies* into) {
|
2020-04-16 12:25:20 +00:00
|
|
|
return new EvolutionData(EvolutionMethod::TimeBased,
|
2021-06-26 14:20:25 +00:00
|
|
|
{
|
|
|
|
new CreatureLib::Library::EffectParameter((int64_t)startTime),
|
|
|
|
new CreatureLib::Library::EffectParameter((int64_t)endTime),
|
|
|
|
},
|
|
|
|
into);
|
2020-01-02 12:45:39 +00:00
|
|
|
}
|
2020-04-16 14:18:09 +00:00
|
|
|
static const EvolutionData* CreateHeldItemEvolution(const Item* item, const PokemonSpecies* into);
|
2021-06-26 14:20:25 +00:00
|
|
|
static const EvolutionData* CreateHeldItemTimeEvolution(const Item* item, TimeOfDay startTime,
|
|
|
|
TimeOfDay endTime, const PokemonSpecies* into);
|
2020-04-16 12:25:20 +00:00
|
|
|
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);
|
2020-01-02 12:45:39 +00:00
|
|
|
}
|
2020-04-16 14:18:09 +00:00
|
|
|
static const EvolutionData* CreateItemUseEvolution(const Item* item, const PokemonSpecies* into);
|
|
|
|
static const EvolutionData* CreateItemUseWithGenderEvolution(const Item* item,
|
|
|
|
CreatureLib::Library::Gender gender,
|
|
|
|
const PokemonSpecies* into);
|
2020-04-16 12:25:20 +00:00
|
|
|
static inline const EvolutionData* CreateTradeEvolution(const PokemonSpecies* into) {
|
|
|
|
return new EvolutionData(EvolutionMethod::Trade, {}, into);
|
2020-01-02 12:45:39 +00:00
|
|
|
}
|
2020-04-16 14:18:09 +00:00
|
|
|
static const EvolutionData* CreateTradeWithItemEvolution(const Item* item, const PokemonSpecies* into);
|
|
|
|
static const EvolutionData* CreateTradeWithSpeciesEvolution(const PokemonSpecies* traded,
|
|
|
|
const PokemonSpecies* into);
|
2020-04-16 12:25:20 +00:00
|
|
|
static inline const EvolutionData*
|
2020-06-02 18:37:21 +00:00
|
|
|
CreateCustomEvolution(const std::vector<const CreatureLib::Library::EffectParameter*>& data,
|
2020-04-16 12:25:20 +00:00
|
|
|
const PokemonSpecies* into) {
|
|
|
|
return new EvolutionData(EvolutionMethod::Custom, data, into);
|
2020-01-02 12:45:39 +00:00
|
|
|
}
|
|
|
|
|
2020-06-02 18:37:21 +00:00
|
|
|
[[nodiscard]] inline ArbUt::BorrowedPtr<const PokemonSpecies> GetNewSpecies() const noexcept {
|
|
|
|
return _evolvesInto;
|
|
|
|
}
|
2020-04-16 14:18:09 +00:00
|
|
|
[[nodiscard]] inline EvolutionMethod GetMethod() const noexcept { return _method; }
|
|
|
|
[[nodiscard]] inline size_t GetDataCount() const noexcept { return _evolutionData.Count(); }
|
2021-09-25 15:56:31 +00:00
|
|
|
[[nodiscard]] inline const ArbUt::UniquePtrList<const CreatureLib::Library::EffectParameter>& GetData() const {
|
|
|
|
return _evolutionData;
|
|
|
|
}
|
2020-06-02 18:37:21 +00:00
|
|
|
[[nodiscard]] inline ArbUt::BorrowedPtr<const CreatureLib::Library::EffectParameter>
|
2021-09-25 15:56:31 +00:00
|
|
|
GetDataAt(size_t index) const {
|
2020-04-16 12:25:20 +00:00
|
|
|
return _evolutionData.At(index);
|
|
|
|
}
|
2020-01-02 12:45:39 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // PKMNLIB_EVOLUTIONDATA_HPP
|