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 <Arbutils/Collections/List.hpp>
|
|
|
|
#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 <string>
|
|
|
|
#include <utility>
|
|
|
|
#include "../TimeOfDay.hpp"
|
|
|
|
#include "EvolutionMethod.hpp"
|
|
|
|
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:
|
|
|
|
const PokemonSpecies* _evolvesInto;
|
|
|
|
EvolutionMethod _method;
|
2020-04-16 12:25:20 +00:00
|
|
|
Arbutils::Collections::List<const CreatureLib::Library::EffectParameter*> _evolutionData;
|
2020-01-02 12:45:39 +00:00
|
|
|
|
2020-04-16 12:25:20 +00:00
|
|
|
EvolutionData(EvolutionMethod method,
|
|
|
|
Arbutils::Collections::List<const CreatureLib::Library::EffectParameter*> data,
|
|
|
|
const PokemonSpecies* next)
|
2020-01-02 12:45:39 +00:00
|
|
|
: _evolvesInto(next), _method(method), _evolutionData(std::move(data)) {}
|
|
|
|
|
|
|
|
public:
|
2020-04-16 12:25:20 +00:00
|
|
|
~EvolutionData() {
|
|
|
|
for (auto v : _evolutionData) {
|
|
|
|
delete v;
|
|
|
|
}
|
2020-01-02 12:45:39 +00:00
|
|
|
}
|
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
|
|
|
}
|
2020-04-16 12:25:20 +00:00
|
|
|
static const EvolutionData* CreateKnownMoveEvolution(const MoveData* move, const PokemonSpecies* into);
|
|
|
|
static inline const EvolutionData* CreateLocationEvolution(const Arbutils::CaseInsensitiveConstString& location,
|
|
|
|
const PokemonSpecies* into) {
|
|
|
|
return new EvolutionData(EvolutionMethod::LocationBased,
|
|
|
|
{new CreatureLib::Library::EffectParameter(location)}, into);
|
2020-01-02 12:45:39 +00:00
|
|
|
}
|
2020-04-16 12:25:20 +00:00
|
|
|
static inline const EvolutionData* CreateTimeEvolution(TimeOfDay time, const PokemonSpecies* into) {
|
|
|
|
return new EvolutionData(EvolutionMethod::TimeBased,
|
|
|
|
{new CreatureLib::Library::EffectParameter((int64_t)time)}, 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);
|
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*
|
|
|
|
CreateCustomEvolution(const Arbutils::Collections::List<const CreatureLib::Library::EffectParameter*>& data,
|
|
|
|
const PokemonSpecies* into) {
|
|
|
|
return new EvolutionData(EvolutionMethod::Custom, data, into);
|
2020-01-02 12:45:39 +00:00
|
|
|
}
|
|
|
|
|
2020-04-16 14:18:09 +00:00
|
|
|
[[nodiscard]] inline const PokemonSpecies* GetNewSpecies() const noexcept { return _evolvesInto; }
|
|
|
|
[[nodiscard]] inline EvolutionMethod GetMethod() const noexcept { return _method; }
|
|
|
|
[[nodiscard]] inline size_t GetDataCount() const noexcept { return _evolutionData.Count(); }
|
2020-04-16 12:25:20 +00:00
|
|
|
[[nodiscard]] inline const CreatureLib::Library::EffectParameter* GetData(size_t index) const {
|
|
|
|
return _evolutionData.At(index);
|
|
|
|
}
|
2020-01-02 12:45:39 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // PKMNLIB_EVOLUTIONDATA_HPP
|