42 lines
1.5 KiB
C++
42 lines
1.5 KiB
C++
#ifndef CREATURELIB_LEARNEDATTACK_HPP
|
|
#define CREATURELIB_LEARNEDATTACK_HPP
|
|
|
|
#include <Arbutils/Memory/Memory.hpp>
|
|
#include "../../Library/Attacks/AttackData.hpp"
|
|
#include "AttackLearnMethod.hpp"
|
|
|
|
namespace CreatureLib::Battling {
|
|
class LearnedAttack {
|
|
ArbUt::BorrowedPtr<const Library::AttackData> _attack;
|
|
u8 _maxUses;
|
|
u8 _remainingUses;
|
|
AttackLearnMethod _learnMethod;
|
|
|
|
public:
|
|
LearnedAttack(const ArbUt::BorrowedPtr<const CreatureLib::Library::AttackData>& attack, u8 maxUses,
|
|
AttackLearnMethod learnMethod);
|
|
LearnedAttack(const ArbUt::BorrowedPtr<const CreatureLib::Library::AttackData>& attack,
|
|
AttackLearnMethod learnMethod);
|
|
|
|
virtual ~LearnedAttack() = default;
|
|
|
|
const ArbUt::BorrowedPtr<const Library::AttackData>& GetAttack() const noexcept;
|
|
u8 GetMaxUses() const noexcept;
|
|
u8 GetRemainingUses() const noexcept;
|
|
AttackLearnMethod GetLearnMethod() const noexcept;
|
|
|
|
virtual bool TryUse(u8 uses) noexcept;
|
|
virtual void DecreaseUses(u8 amount) noexcept;
|
|
virtual void RestoreUses(u8 amount) noexcept;
|
|
virtual void RestoreAllUses() noexcept;
|
|
|
|
virtual LearnedAttack* Clone() const {
|
|
auto* attack = new LearnedAttack(_attack, _maxUses, _learnMethod);
|
|
attack->_remainingUses = _remainingUses;
|
|
return attack;
|
|
}
|
|
};
|
|
}
|
|
|
|
#endif // CREATURELIB_LEARNEDATTACK_HPP
|