2019-11-04 16:58:26 +00:00
|
|
|
#ifndef CREATURELIB_TYPELIBRARY_HPP
|
|
|
|
#define CREATURELIB_TYPELIBRARY_HPP
|
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
namespace CreatureLib::Library {
|
2019-11-04 16:58:26 +00:00
|
|
|
class TypeLibrary {
|
2019-11-28 11:55:22 +00:00
|
|
|
std::unordered_map<std::string, uint8_t> _types;
|
2019-11-04 16:58:26 +00:00
|
|
|
std::vector<std::vector<float>> _effectiveness;
|
2019-11-28 11:55:22 +00:00
|
|
|
|
2019-11-04 16:58:26 +00:00
|
|
|
public:
|
2019-12-31 09:48:52 +00:00
|
|
|
TypeLibrary(size_t initialCapacity = 20) : _types(std::unordered_map<std::string, uint8_t>(initialCapacity)) {}
|
|
|
|
|
2019-11-04 16:58:26 +00:00
|
|
|
uint8_t GetTypeId(const std::string& s) const;
|
|
|
|
float GetSingleEffectiveness(uint8_t attacking, uint8_t defensive) const;
|
|
|
|
float GetEffectiveness(uint8_t attacking, const std::vector<uint8_t>& defensive) const;
|
|
|
|
|
|
|
|
uint8_t RegisterType(const std::string& typeName);
|
|
|
|
void SetEffectiveness(uint8_t attacking, uint8_t defensive, float effectiveness);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
#endif // CREATURELIB_TYPELIBRARY_HPP
|