Change AttackData type to byte instead of string.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-01-18 13:41:01 +01:00
parent e3bbc369fc
commit d66bcee979
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
3 changed files with 9 additions and 9 deletions

View File

@ -1,12 +1,12 @@
#include "AttackData.hpp" #include "AttackData.hpp"
#include <utility> #include <utility>
CreatureLib::Library::AttackData::AttackData(std::string name, std::string type, CreatureLib::Library::AttackData::AttackData(std::string name, uint8_t type,
CreatureLib::Library::AttackCategory category, uint8_t power, CreatureLib::Library::AttackCategory category, uint8_t power,
uint8_t accuracy, uint8_t baseUsage, uint8_t accuracy, uint8_t baseUsage,
CreatureLib::Library::AttackTarget target, uint8_t priority, CreatureLib::Library::AttackTarget target, uint8_t priority,
std::unordered_set<std::string> flags) std::unordered_set<std::string> flags)
: _name(std::move(name)), _type(std::move(type)), _category(category), _basePower(power), _accuracy(accuracy), : _name(std::move(name)), _type(type), _category(category), _basePower(power), _accuracy(accuracy),
_baseUsages(baseUsage), _target(target), _priority(priority), _flags(std::move(flags)) {} _baseUsages(baseUsage), _target(target), _priority(priority), _flags(std::move(flags)) {}
bool CreatureLib::Library::AttackData::HasFlag(const std::string& key) const { bool CreatureLib::Library::AttackData::HasFlag(const std::string& key) const {

View File

@ -10,7 +10,7 @@ namespace CreatureLib::Library {
class AttackData { class AttackData {
protected: protected:
const std::string _name; const std::string _name;
const std::string _type; uint8_t _type;
AttackCategory _category; AttackCategory _category;
uint8_t _basePower; uint8_t _basePower;
uint8_t _accuracy; uint8_t _accuracy;
@ -20,11 +20,11 @@ namespace CreatureLib::Library {
std::unordered_set<std::string> _flags; std::unordered_set<std::string> _flags;
public: public:
AttackData(std::string name, std::string type, AttackCategory category, uint8_t power, uint8_t accuracy, AttackData(std::string name, uint8_t type, AttackCategory category, uint8_t power, uint8_t accuracy,
uint8_t baseUsage, AttackTarget target, uint8_t priority, std::unordered_set<std::string> flags); uint8_t baseUsage, AttackTarget target, uint8_t priority, std::unordered_set<std::string> flags);
inline const std::string& GetName() const { return _name; } inline const std::string& GetName() const { return _name; }
inline const std::string& GetType() const { return _type; } inline const uint8_t GetType() const { return _type; }
inline AttackCategory GetCategory() const { return _category; } inline AttackCategory GetCategory() const { return _category; }
inline uint8_t GetBasePower() const { return _basePower; } inline uint8_t GetBasePower() const { return _basePower; }
inline uint8_t GetAccuracy() const { return _accuracy; } inline uint8_t GetAccuracy() const { return _accuracy; }

View File

@ -33,13 +33,13 @@ SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
AttackLibrary* TestLibrary::BuildAttackLibrary() { AttackLibrary* TestLibrary::BuildAttackLibrary() {
auto l = new AttackLibrary(); auto l = new AttackLibrary();
l->LoadAttack("standard", new AttackData("standard", "normal", AttackCategory::Physical, 20, 100, 30, l->LoadAttack("standard", new AttackData("standard", 0, AttackCategory::Physical, 20, 100, 30,
AttackTarget::AdjacentOpponent, 0, {})); AttackTarget::AdjacentOpponent, 0, {}));
l->LoadAttack("highPriority", new AttackData("highPriority", "normal", AttackCategory::Physical, 20, 100, 30, l->LoadAttack("highPriority", new AttackData("highPriority", 0, AttackCategory::Physical, 20, 100, 30,
AttackTarget::AdjacentOpponent, 1, {})); AttackTarget::AdjacentOpponent, 1, {}));
l->LoadAttack("higherPriority", new AttackData("higherPriority", "normal", AttackCategory::Physical, 20, 100, 30, l->LoadAttack("higherPriority", new AttackData("higherPriority", 0, AttackCategory::Physical, 20, 100, 30,
AttackTarget::AdjacentOpponent, 2, {})); AttackTarget::AdjacentOpponent, 2, {}));
l->LoadAttack("lowPriority", new AttackData("lowPriority", "normal", AttackCategory::Physical, 20, 100, 30, l->LoadAttack("lowPriority", new AttackData("lowPriority", 0, AttackCategory::Physical, 20, 100, 30,
AttackTarget::AdjacentOpponent, -1, {})); AttackTarget::AdjacentOpponent, -1, {}));
return l; return l;
} }