PkmnLib/src/Library/Species/PokemonSpecies.hpp

51 lines
2.2 KiB
C++

#ifndef PKMNLIB_POKEMONSPECIES_HPP
#define PKMNLIB_POKEMONSPECIES_HPP
#include <CreatureLib/Battling/Models/Creature.hpp>
#include "../Evolutions/EvolutionData.hpp"
#include "PokemonForme.hpp"
namespace PkmnLib::Library {
class PokemonSpecies : public CreatureLib::Library::CreatureSpecies {
private:
uint8_t _baseHappiness;
Arbutils::Collections::List<const EvolutionData*> _evolutions;
uint16_t _experienceGain;
public:
PokemonSpecies(uint16_t id, const Arbutils::CaseInsensitiveConstString& name, const PokemonForme* defaultForme,
float genderRatio, const Arbutils::CaseInsensitiveConstString& growthRate, uint8_t captureRate,
uint8_t baseHappiness, uint16_t experienceGain) noexcept
: CreatureSpecies(id, name, defaultForme, genderRatio, growthRate, captureRate),
_baseHappiness(baseHappiness), _experienceGain(experienceGain) {}
~PokemonSpecies() override {
for (auto evo : _evolutions) {
delete evo;
}
}
inline uint8_t GetBaseHappiness() const { return _baseHappiness; }
inline const PokemonForme* GetDefaultForme() const {
return reinterpret_cast<const PokemonForme*>(CreatureSpecies::GetVariant("default"_cnc.GetHash()));
}
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 {
return reinterpret_cast<const PokemonForme*>(CreatureSpecies::GetVariant(key));
}
inline void AddEvolution(const EvolutionData* data) noexcept { _evolutions.Append(data); }
const Arbutils::Collections::List<const EvolutionData*>& GetEvolutions() const noexcept { return _evolutions; }
inline uint16_t GetExperienceGains() const noexcept { return _experienceGain; }
};
}
#endif // PKMNLIB_POKEMONSPECIES_HPP