45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#include "LearnedAttack.hpp"
|
|
|
|
CreatureLib::Library::LearnedAttack::LearnedAttack(CreatureLib::Library::AttackData *attack, uint8_t maxUses, AttackLearnMethod learnMethod)
|
|
:_attack(attack), _maxUses(maxUses), _remainingUses(maxUses), _learnMethod(learnMethod)
|
|
{
|
|
|
|
}
|
|
|
|
const CreatureLib::Library::AttackData *CreatureLib::Library::LearnedAttack::GetAttack() const {
|
|
return _attack;
|
|
}
|
|
|
|
uint8_t CreatureLib::Library::LearnedAttack::GetMaxUses() const {
|
|
return _maxUses;
|
|
}
|
|
|
|
uint8_t CreatureLib::Library::LearnedAttack::GetRemainingUses() const {
|
|
return _remainingUses;
|
|
}
|
|
|
|
CreatureLib::Library::AttackLearnMethod CreatureLib::Library::LearnedAttack::GetLearnMethod() const {
|
|
return _learnMethod;
|
|
}
|
|
|
|
|
|
bool CreatureLib::Library::LearnedAttack::TryUse(uint8_t uses) {
|
|
if (uses > _remainingUses) return false;
|
|
_remainingUses -= uses;
|
|
return true;
|
|
}
|
|
|
|
void CreatureLib::Library::LearnedAttack::DecreaseUses(uint8_t amount) {
|
|
_remainingUses -= amount;
|
|
}
|
|
|
|
void CreatureLib::Library::LearnedAttack::RestoreUses(uint8_t amount) {
|
|
_remainingUses += amount;
|
|
}
|
|
|
|
void CreatureLib::Library::LearnedAttack::RestoreUses() {
|
|
_remainingUses = _maxUses;
|
|
}
|
|
|
|
|