52 lines
2.1 KiB
C++
52 lines
2.1 KiB
C++
#ifndef CREATURELIB_ATTACKDATA_HPP
|
|
#define CREATURELIB_ATTACKDATA_HPP
|
|
|
|
#include <unordered_set>
|
|
#include "AttackCategory.hpp"
|
|
#include "AttackTarget.hpp"
|
|
#include "SecondaryEffect.hpp"
|
|
|
|
namespace CreatureLib::Library {
|
|
class AttackData {
|
|
protected:
|
|
ArbUt::StringView _name;
|
|
uint8_t _type;
|
|
AttackCategory _category;
|
|
uint8_t _basePower;
|
|
uint8_t _accuracy;
|
|
uint8_t _baseUsages;
|
|
AttackTarget _target;
|
|
int8_t _priority;
|
|
std::unique_ptr<const SecondaryEffect> _effect = nullptr;
|
|
std::unordered_set<uint32_t> _flags;
|
|
|
|
public:
|
|
AttackData(const ArbUt::StringView& name, uint8_t type, AttackCategory category, uint8_t power,
|
|
uint8_t accuracy, uint8_t baseUsage, AttackTarget target, int8_t priority,
|
|
const SecondaryEffect* effect, std::unordered_set<uint32_t> flags);
|
|
virtual ~AttackData() = default;
|
|
|
|
inline const ArbUt::StringView& GetName() const noexcept { return _name; }
|
|
inline uint8_t GetType() const noexcept { return _type; }
|
|
inline AttackCategory GetCategory() const noexcept { return _category; }
|
|
inline uint8_t GetBasePower() const noexcept { return _basePower; }
|
|
inline uint8_t GetAccuracy() const noexcept { return _accuracy; }
|
|
inline uint8_t GetBaseUsages() const noexcept { return _baseUsages; }
|
|
inline AttackTarget GetTarget() const noexcept { return _target; }
|
|
inline int8_t GetPriority() const noexcept { return _priority; }
|
|
inline bool HasSecondaryEffect() const noexcept {
|
|
return _effect != nullptr && !_effect->GetEffectName().IsEmpty();
|
|
}
|
|
inline const std::unique_ptr<const SecondaryEffect>& GetSecondaryEffect() const noexcept { return _effect; }
|
|
|
|
inline bool HasFlag(const ArbUt::StringView& key) const noexcept {
|
|
return this->_flags.find(key) != this->_flags.end();
|
|
}
|
|
inline bool HasFlag(uint32_t keyHash) const noexcept {
|
|
return this->_flags.find(keyHash) != this->_flags.end();
|
|
}
|
|
};
|
|
}
|
|
|
|
#endif // CREATURELIB_ATTACKDATA_HPP
|