2019-10-23 16:57:50 +00:00
|
|
|
#ifndef CREATURELIB_LEARNEDATTACK_HPP
|
|
|
|
#define CREATURELIB_LEARNEDATTACK_HPP
|
|
|
|
|
2019-10-24 11:37:55 +00:00
|
|
|
#include "../../Library/Attacks/AttackData.hpp"
|
2019-10-24 09:04:19 +00:00
|
|
|
#include "AttackLearnMethod.hpp"
|
2019-10-23 16:57:50 +00:00
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
namespace CreatureLib::Battling {
|
2019-10-23 16:57:50 +00:00
|
|
|
class LearnedAttack {
|
2020-05-26 16:31:06 +00:00
|
|
|
ArbUt::BorrowedPtr<const Library::AttackData> _attack;
|
2019-10-23 17:21:21 +00:00
|
|
|
uint8_t _maxUses;
|
|
|
|
uint8_t _remainingUses;
|
2019-10-24 09:04:19 +00:00
|
|
|
AttackLearnMethod _learnMethod;
|
2019-11-28 11:55:22 +00:00
|
|
|
|
2019-10-23 16:57:50 +00:00
|
|
|
public:
|
2020-05-26 16:31:06 +00:00
|
|
|
LearnedAttack(const ArbUt::BorrowedPtr<const CreatureLib::Library::AttackData>& attack, uint8_t maxUses,
|
2020-05-24 18:57:22 +00:00
|
|
|
AttackLearnMethod learnMethod);
|
2020-05-26 16:31:06 +00:00
|
|
|
LearnedAttack(const ArbUt::BorrowedPtr<const CreatureLib::Library::AttackData>& attack,
|
2020-05-24 18:57:22 +00:00
|
|
|
AttackLearnMethod learnMethod);
|
2019-10-23 17:21:21 +00:00
|
|
|
|
2020-01-25 11:37:05 +00:00
|
|
|
virtual ~LearnedAttack() = default;
|
|
|
|
|
2020-05-26 16:31:06 +00:00
|
|
|
const ArbUt::BorrowedPtr<const Library::AttackData>& GetAttack() const noexcept;
|
2020-04-04 11:36:13 +00:00
|
|
|
uint8_t GetMaxUses() const noexcept;
|
|
|
|
uint8_t GetRemainingUses() const noexcept;
|
|
|
|
AttackLearnMethod GetLearnMethod() const noexcept;
|
2019-10-24 09:04:19 +00:00
|
|
|
|
2020-04-04 11:36:13 +00:00
|
|
|
virtual bool TryUse(uint8_t uses) noexcept;
|
|
|
|
virtual void DecreaseUses(uint8_t amount) noexcept;
|
|
|
|
virtual void RestoreUses(uint8_t amount) noexcept;
|
|
|
|
virtual void RestoreAllUses() noexcept;
|
2021-04-11 13:20:50 +00:00
|
|
|
|
|
|
|
virtual LearnedAttack* Clone() {
|
|
|
|
auto* attack = new LearnedAttack(_attack, _maxUses, _learnMethod);
|
|
|
|
attack->_remainingUses = _remainingUses;
|
|
|
|
return attack;
|
|
|
|
}
|
2019-10-23 16:57:50 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
#endif // CREATURELIB_LEARNEDATTACK_HPP
|