50 lines
2.0 KiB
C++
50 lines
2.0 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;
|
|
u8 _type;
|
|
AttackCategory _category;
|
|
u8 _basePower;
|
|
u8 _accuracy;
|
|
u8 _baseUsages;
|
|
AttackTarget _target;
|
|
i8 _priority;
|
|
std::unique_ptr<const SecondaryEffect> _effect = nullptr;
|
|
std::unordered_set<u32> _flags;
|
|
|
|
public:
|
|
AttackData(const ArbUt::StringView& name, u8 type, AttackCategory category, u8 power, u8 accuracy, u8 baseUsage,
|
|
AttackTarget target, i8 priority, const SecondaryEffect* nullable effect,
|
|
std::unordered_set<u32> flags);
|
|
virtual ~AttackData() = default;
|
|
|
|
inline const ArbUt::StringView& GetName() const noexcept { return _name; }
|
|
inline u8 GetType() const noexcept { return _type; }
|
|
inline AttackCategory GetCategory() const noexcept { return _category; }
|
|
inline u8 GetBasePower() const noexcept { return _basePower; }
|
|
inline u8 GetAccuracy() const noexcept { return _accuracy; }
|
|
inline u8 GetBaseUsages() const noexcept { return _baseUsages; }
|
|
inline AttackTarget GetTarget() const noexcept { return _target; }
|
|
inline i8 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(u32 keyHash) const noexcept { return this->_flags.find(keyHash) != this->_flags.end(); }
|
|
};
|
|
}
|
|
|
|
#endif // CREATURELIB_ATTACKDATA_HPP
|