PkmnLib/src/Library/Species/PokemonSpecies.hpp

49 lines
2.0 KiB
C++
Raw Normal View History

2019-12-29 14:29:52 +00:00
#ifndef PKMNLIB_POKEMONSPECIES_HPP
#define PKMNLIB_POKEMONSPECIES_HPP
#include <CreatureLib/Battling/Models/Creature.hpp>
#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;
std::vector<const EvolutionData*> _evolutions;
2019-12-29 14:29:52 +00:00
public:
PokemonSpecies(uint16_t id, const Arbutils::CaseInsensitiveConstString& name,
const PokemonForme* defaultVariant, float genderRatio,
const Arbutils::CaseInsensitiveConstString& growthRate, uint8_t captureRate,
uint8_t baseHappiness)
2019-12-29 14:29:52 +00:00
: CreatureSpecies(id, name, defaultVariant, genderRatio, growthRate, captureRate),
_baseHappiness(baseHappiness) {}
~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; }
inline const PokemonForme* GetDefaultForme() const {
return reinterpret_cast<const PokemonForme*>(CreatureSpecies::GetVariant("default"_cnc.GetHash()));
2019-12-29 14:29:52 +00:00
}
inline bool HasForme(const Arbutils::CaseInsensitiveConstString& key) const { return HasVariant(key); }
inline bool TryGetForme(const Arbutils::CaseInsensitiveConstString& key, const PokemonForme*& forme) const {
return TryGetVariant(key, (const CreatureLib::Library::SpeciesVariant*&)forme);
}
inline const PokemonForme* GetForme(const Arbutils::CaseInsensitiveConstString& key) const {
2019-12-29 14:29:52 +00:00
return reinterpret_cast<const PokemonForme*>(CreatureSpecies::GetVariant(key));
}
inline void AddEvolution(const EvolutionData* data) { _evolutions.push_back(data); }
const std::vector<const EvolutionData*>& GetEvolutions() const { return _evolutions; }
2019-12-29 14:29:52 +00:00
};
}
#endif // PKMNLIB_POKEMONSPECIES_HPP