2019-12-29 14:29:52 +00:00
|
|
|
#ifndef PKMNLIB_POKEMONSPECIES_HPP
|
|
|
|
#define PKMNLIB_POKEMONSPECIES_HPP
|
2020-02-08 18:22:29 +00:00
|
|
|
#include <CreatureLib/Battling/Models/Creature.hpp>
|
2020-01-02 12:45:39 +00:00
|
|
|
#include "../Evolutions/EvolutionData.hpp"
|
2019-12-29 14:29:52 +00:00
|
|
|
#include "PokemonForme.hpp"
|
|
|
|
|
|
|
|
namespace PkmnLib::Library {
|
|
|
|
class PokemonSpecies : public CreatureLib::Library::CreatureSpecies {
|
|
|
|
private:
|
|
|
|
uint8_t _baseHappiness;
|
2020-05-27 15:26:25 +00:00
|
|
|
ArbUt::List<const EvolutionData*> _evolutions;
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
public:
|
2020-05-27 15:26:25 +00:00
|
|
|
PokemonSpecies(uint16_t id, const ArbUt::CaseInsensitiveConstString& name, const PokemonForme* defaultForme,
|
|
|
|
float genderRatio, const ArbUt::CaseInsensitiveConstString& growthRate, uint8_t captureRate,
|
2020-05-22 11:43:02 +00:00
|
|
|
uint8_t baseHappiness) noexcept
|
2020-04-16 13:04:53 +00:00
|
|
|
: CreatureSpecies(id, name, defaultForme, genderRatio, growthRate, captureRate),
|
2020-05-22 11:43:02 +00:00
|
|
|
_baseHappiness(baseHappiness) {}
|
2019-12-29 14:29:52 +00:00
|
|
|
|
2020-04-16 12:25:20 +00:00
|
|
|
~PokemonSpecies() override {
|
|
|
|
for (auto evo : _evolutions) {
|
|
|
|
delete evo;
|
|
|
|
}
|
|
|
|
}
|
2020-02-09 10:02:29 +00:00
|
|
|
|
2019-12-29 14:29:52 +00:00
|
|
|
inline uint8_t GetBaseHappiness() const { return _baseHappiness; }
|
|
|
|
|
2020-05-27 15:26:25 +00:00
|
|
|
inline ArbUt::BorrowedPtr<const PokemonForme> GetDefaultForme() const {
|
|
|
|
return CreatureSpecies::GetVariant("default"_cnc.GetHash()).As<const PokemonForme>();
|
2019-12-29 14:29:52 +00:00
|
|
|
}
|
|
|
|
|
2020-05-27 15:26:25 +00:00
|
|
|
inline bool HasForme(const ArbUt::CaseInsensitiveConstString& key) const { return HasVariant(key); }
|
2020-02-13 17:00:23 +00:00
|
|
|
|
2020-05-27 15:26:25 +00:00
|
|
|
inline bool TryGetForme(const ArbUt::CaseInsensitiveConstString& key,
|
|
|
|
ArbUt::BorrowedPtr<const PokemonForme>& forme) const {
|
|
|
|
auto v = forme.As<const PokemonForme::SpeciesVariant>();
|
|
|
|
auto res = TryGetVariant(key, v);
|
|
|
|
forme = v.As<const PokemonForme>();
|
|
|
|
return res;
|
2020-02-13 17:00:23 +00:00
|
|
|
}
|
|
|
|
|
2020-05-27 15:26:25 +00:00
|
|
|
inline ArbUt::BorrowedPtr<const PokemonForme> GetForme(const ArbUt::CaseInsensitiveConstString& key) const {
|
|
|
|
return CreatureSpecies::GetVariant(key).As<const PokemonForme>();
|
2019-12-29 14:29:52 +00:00
|
|
|
}
|
2020-01-02 12:45:39 +00:00
|
|
|
|
2020-04-16 13:04:53 +00:00
|
|
|
inline void AddEvolution(const EvolutionData* data) noexcept { _evolutions.Append(data); }
|
2020-05-27 15:26:25 +00:00
|
|
|
const ArbUt::List<const EvolutionData*>& GetEvolutions() const noexcept { return _evolutions; }
|
2019-12-29 14:29:52 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // PKMNLIB_POKEMONSPECIES_HPP
|