Turn SecondaryEffect class into pointer type, owned by AttackData.
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:
@@ -5,7 +5,7 @@ CreatureLib::Library::AttackData::AttackData(const ConstString& name, uint8_t ty
|
||||
CreatureLib::Library::AttackCategory category, uint8_t power,
|
||||
uint8_t accuracy, uint8_t baseUsage,
|
||||
CreatureLib::Library::AttackTarget target, int8_t priority,
|
||||
SecondaryEffect effect, std::unordered_set<uint32_t> flags)
|
||||
const SecondaryEffect* effect, std::unordered_set<uint32_t> flags)
|
||||
: _name(std::move(name)), _type(type), _category(category), _basePower(power), _accuracy(accuracy),
|
||||
_baseUsages(baseUsage), _target(target), _priority(priority), _effect(effect), _flags(std::move(flags)) {}
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ namespace CreatureLib::Library {
|
||||
uint8_t _baseUsages;
|
||||
AttackTarget _target;
|
||||
int8_t _priority;
|
||||
SecondaryEffect _effect;
|
||||
const SecondaryEffect* _effect;
|
||||
std::unordered_set<uint32_t> _flags;
|
||||
|
||||
public:
|
||||
AttackData(const ConstString& name, uint8_t type, AttackCategory category, uint8_t power, uint8_t accuracy,
|
||||
uint8_t baseUsage, AttackTarget target, int8_t priority, SecondaryEffect effect,
|
||||
uint8_t baseUsage, AttackTarget target, int8_t priority, const SecondaryEffect* effect,
|
||||
std::unordered_set<uint32_t> flags);
|
||||
virtual ~AttackData() = default;
|
||||
virtual ~AttackData() { delete _effect; };
|
||||
|
||||
inline const ConstString& GetName() const noexcept { return _name; }
|
||||
inline const uint8_t GetType() const noexcept { return _type; }
|
||||
@@ -39,9 +39,9 @@ namespace CreatureLib::Library {
|
||||
inline AttackTarget GetTarget() const noexcept { return _target; }
|
||||
inline int8_t GetPriority() const noexcept { return _priority; }
|
||||
inline bool HasSecondaryEffect() const noexcept {
|
||||
return _effect.GetChance() != 0 && _effect.GetEffectName() != ""_cnc;
|
||||
return _effect->GetChance() != 0 && _effect->GetEffectName() != ""_cnc;
|
||||
}
|
||||
inline const SecondaryEffect& GetSecondaryEffect() const noexcept { return _effect; }
|
||||
inline const SecondaryEffect* GetSecondaryEffect() const noexcept { return _effect; }
|
||||
|
||||
bool HasFlag(const ConstString& key) const noexcept;
|
||||
bool HasFlag(uint32_t keyHash) const noexcept;
|
||||
|
||||
@@ -26,9 +26,11 @@ namespace CreatureLib::Library {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr float GetChance() const noexcept { return _chance; }
|
||||
constexpr const Arbutils::CaseInsensitiveConstString& GetEffectName() const noexcept { return _effectName; }
|
||||
const List<EffectParameter*>& GetParameters() const noexcept { return _parameters; }
|
||||
constexpr inline float GetChance() const noexcept { return _chance; }
|
||||
constexpr inline const Arbutils::CaseInsensitiveConstString& GetEffectName() const noexcept {
|
||||
return _effectName;
|
||||
}
|
||||
const inline List<EffectParameter*>& GetParameters() const noexcept { return _parameters; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user