Support natures for Pokemon.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define PKMNLIB_NATURELIBRARY_HPP
|
||||
|
||||
#include <Core/Exceptions/CreatureException.hpp>
|
||||
#include <Core/Random.hpp>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include "Nature.hpp"
|
||||
@@ -39,6 +40,7 @@ namespace PkmnLib::Library {
|
||||
}
|
||||
|
||||
const Nature& GetNature(uint8_t id) const { return _natures[id]; }
|
||||
const Nature* GetNaturePtr(uint8_t id) const { return &_natures[id]; }
|
||||
|
||||
uint8_t GetNatureIdByName(const std::string& name) const {
|
||||
auto find = _keyLookup.find(name);
|
||||
@@ -47,6 +49,10 @@ namespace PkmnLib::Library {
|
||||
}
|
||||
return _keyLookup.at(name);
|
||||
}
|
||||
|
||||
uint8_t GetRandomNature(CreatureLib::Core::Random rand = CreatureLib::Core::Random()) const{
|
||||
return rand.Get(_current);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user