Remove creature classes from Library lib, merged with Battling lib.
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:
11
src/Battling/Models/AttackLearnMethod.hpp
Normal file
11
src/Battling/Models/AttackLearnMethod.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef CREATURELIB_ATTACKLEARNMETHOD_HPP
|
||||
#define CREATURELIB_ATTACKLEARNMETHOD_HPP
|
||||
|
||||
namespace CreatureLib::Battling {
|
||||
enum class AttackLearnMethod {
|
||||
Unknown,
|
||||
Level
|
||||
};
|
||||
}
|
||||
|
||||
#endif //CREATURELIB_ATTACKLEARNMETHOD_HPP
|
||||
@@ -1,67 +0,0 @@
|
||||
#include "BattleCreature.hpp"
|
||||
#include "../Models/Battle.hpp"
|
||||
|
||||
using namespace CreatureLib;
|
||||
|
||||
Battling::BattleCreature::BattleCreature(Battling::Battle *battle,
|
||||
Library::Creature *creature)
|
||||
:__Battle(battle),
|
||||
__Level(creature->GetLevel()),
|
||||
_creature(creature),
|
||||
_statBoost(Core::StatisticSet<int8_t >())
|
||||
{
|
||||
// Initialize boosted stats. This initializes flat stats as well.
|
||||
RecalculateBoostedStats();
|
||||
}
|
||||
|
||||
const Library::Creature* Battling::BattleCreature::GetBackingCreature() {
|
||||
return _creature;
|
||||
}
|
||||
|
||||
void Battling::BattleCreature::ApplyPostBattleEffects() {
|
||||
|
||||
}
|
||||
|
||||
//region Stat APIs
|
||||
|
||||
void Battling::BattleCreature::ChangeStatBoost(Core::Statistic stat, int8_t diffAmount){
|
||||
if (diffAmount > 0)
|
||||
this->_statBoost.IncreaseStatBy(stat, diffAmount);
|
||||
else
|
||||
this->_statBoost.DecreaseStatBy(stat, diffAmount);
|
||||
this->RecalculateBoostedStat(stat);
|
||||
}
|
||||
|
||||
uint32_t Battling::BattleCreature::GetFlatStat(Core::Statistic stat) const{
|
||||
return _flatStats.GetStat(stat);
|
||||
}
|
||||
|
||||
uint32_t Battling::BattleCreature::GetBoostedStat(Core::Statistic stat) const{
|
||||
return _boostedStats.GetStat(stat);
|
||||
}
|
||||
|
||||
void Battling::BattleCreature::RecalculateFlatStats() {
|
||||
this->_flatStats = this->__Battle->GetLibrary()->GetStatCalculator()->CalculateFlatStats(this);
|
||||
RecalculateBoostedStats();
|
||||
}
|
||||
void Battling::BattleCreature::RecalculateBoostedStats() {
|
||||
this->_boostedStats = this->__Battle->GetLibrary()->GetStatCalculator()->CalculateFlatStats(this);
|
||||
}
|
||||
|
||||
void Battling::BattleCreature::RecalculateFlatStat(Core::Statistic stat) {
|
||||
auto s = this->__Battle->GetLibrary()->GetStatCalculator()->CalculateFlatStat(this, stat);
|
||||
this->_flatStats.SetStat(stat, s);
|
||||
RecalculateBoostedStat(stat);
|
||||
}
|
||||
|
||||
void Battling::BattleCreature::RecalculateBoostedStat(Core::Statistic stat) {
|
||||
auto s = this->__Battle->GetLibrary()->GetStatCalculator()->CalculateBoostedStat(this, stat);
|
||||
this->_boostedStats.SetStat(stat, s);
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
void Battling::BattleCreature::ChangeLevel(int8_t amount) {
|
||||
this->__Level += amount;
|
||||
RecalculateFlatStats();
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
#ifndef CREATURELIB_BATTLECREATURE_HPP
|
||||
#define CREATURELIB_BATTLECREATURE_HPP
|
||||
|
||||
#include "../../GenericTemplates.cpp"
|
||||
#include "../../Library/Living/Creature.hpp"
|
||||
|
||||
namespace CreatureLib::Battling{
|
||||
// Forward declare battle class
|
||||
class Battle;
|
||||
|
||||
class BattleCreature {
|
||||
GetProperty(Battle*, Battle);
|
||||
GetProperty(uint8_t, Level);
|
||||
|
||||
private:
|
||||
Library::Creature* _creature;
|
||||
Core::StatisticSet<int8_t > _statBoost;
|
||||
Core::StatisticSet<uint32_t > _flatStats;
|
||||
Core::StatisticSet<uint32_t > _boostedStats;
|
||||
|
||||
public:
|
||||
BattleCreature(Battle* battle, Library::Creature* creature);
|
||||
|
||||
const Library::Creature* GetBackingCreature();
|
||||
void ApplyPostBattleEffects();
|
||||
|
||||
|
||||
//region Stat APIs
|
||||
|
||||
void ChangeStatBoost(Core::Statistic stat, int8_t diffAmount);
|
||||
[[nodiscard]] uint32_t GetFlatStat(Core::Statistic stat) const;
|
||||
[[nodiscard]] uint32_t GetBoostedStat(Core::Statistic stat) const;
|
||||
void RecalculateFlatStats();
|
||||
void RecalculateBoostedStats();
|
||||
void RecalculateFlatStat(Core::Statistic);
|
||||
void RecalculateBoostedStat(Core::Statistic);
|
||||
//endregion
|
||||
|
||||
void ChangeLevel(int8_t amount);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //CREATURELIB_BATTLECREATURE_HPP
|
||||
@@ -2,11 +2,11 @@
|
||||
#define CREATURELIB_BATTLESIDE_HPP
|
||||
|
||||
#include <vector>
|
||||
#include "BattleCreature.hpp"
|
||||
#include "Creature.hpp"
|
||||
|
||||
namespace CreatureLib::Battling{
|
||||
class BattleSide {
|
||||
std::vector<BattleCreature*> _creatures;
|
||||
std::vector<Creature*> _creatures;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
101
src/Battling/Models/CreateCreature.cpp
Normal file
101
src/Battling/Models/CreateCreature.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
#include "CreateCreature.hpp"
|
||||
#include <utility>
|
||||
|
||||
using namespace CreatureLib::Battling;
|
||||
|
||||
CreateCreature* CreateCreature::WithVariant(std::string variant) {
|
||||
this->_variant = std::move(variant);
|
||||
return this;
|
||||
}
|
||||
|
||||
CreateCreature *CreateCreature::WithNickname(std::string nickname) {
|
||||
this->_nickname = std::move(nickname);
|
||||
return this;
|
||||
}
|
||||
|
||||
CreateCreature *CreateCreature::WithStatPotential(CreatureLib::Core::Statistic stat, uint32_t value) {
|
||||
switch (stat){
|
||||
case Core::Health:_healthPotential = value;
|
||||
case Core::PhysicalAttack: _physAttackPotential = value;
|
||||
case Core::PhysicalDefense: _physDefensePotential = value;
|
||||
case Core::MagicalAttack: _magAttackPotential = value;
|
||||
case Core::MagicalDefense:_magDefensePotential = value;
|
||||
case Core::Speed: _speedPotential = value;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
CreateCreature * CreateCreature::WithStatPotentials(uint32_t health, uint32_t physAttack, uint32_t physDefense,
|
||||
uint32_t magAttack, uint32_t magDefense, uint32_t speed) {
|
||||
_healthPotential = health;
|
||||
_physAttackPotential = physAttack;
|
||||
_physDefensePotential = physDefense;
|
||||
_magAttackPotential = magAttack;
|
||||
_magDefensePotential = magDefense;
|
||||
_speedPotential = speed;
|
||||
return this;
|
||||
}
|
||||
|
||||
CreateCreature* CreateCreature::WithStatExperience(Core::Statistic stat, uint32_t value) {
|
||||
switch (stat){
|
||||
case Core::Health:_healthExperience = value;
|
||||
case Core::PhysicalAttack: _physAttackExperience = value;
|
||||
case Core::PhysicalDefense: _physDefenseExperience = value;
|
||||
case Core::MagicalAttack: _magAttackExperience = value;
|
||||
case Core::MagicalDefense:_magDefenseExperience = value;
|
||||
case Core::Speed: _speedExperience = value;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
CreateCreature *
|
||||
CreateCreature::WithStatExperiences(uint32_t health, uint32_t physAttack, uint32_t physDefense, uint32_t magAttack,
|
||||
uint32_t magDefense, uint32_t speed) {
|
||||
_healthExperience = health;
|
||||
_physAttackExperience = physAttack;
|
||||
_physDefenseExperience = physDefense;
|
||||
_magAttackExperience = magAttack;
|
||||
_magDefenseExperience = magDefense;
|
||||
_speedExperience = speed;
|
||||
return this;
|
||||
}
|
||||
|
||||
CreateCreature *CreateCreature::WithGender(Library::Gender gender) {
|
||||
this->_gender = gender;
|
||||
return this;
|
||||
}
|
||||
|
||||
Creature *CreateCreature::Create() {
|
||||
auto rand = Core::Random();
|
||||
auto species = this->_library->GetSpeciesLibrary()->GetSpecies(this->_species);
|
||||
auto variant = species->GetVariant(this->_variant);
|
||||
int8_t talent;
|
||||
if (this->_talent.empty()){
|
||||
talent = variant->GetRandomTalent(&rand);
|
||||
}
|
||||
else{
|
||||
talent = variant->GetTalentIndex(this->_talent);
|
||||
}
|
||||
auto identifier = this->_identifier;
|
||||
if (identifier == 0){
|
||||
identifier = rand.Get();
|
||||
}
|
||||
auto gender = this->_gender;
|
||||
if (gender == static_cast<Library::Gender >(-1)){
|
||||
gender = species->GetRandomGender(rand);
|
||||
}
|
||||
const Library::Item* heldItem = nullptr;
|
||||
if (!this->_heldItem.empty()){
|
||||
heldItem = _library->GetItemLibrary()->GetItem(this->_heldItem);
|
||||
}
|
||||
//FIXME: implement experience
|
||||
auto experience = 0;
|
||||
|
||||
auto statExperience = Core::StatisticSet(_healthExperience, _physAttackExperience,_physDefenseExperience, _magAttackExperience,
|
||||
_magDefenseExperience, _speedExperience);
|
||||
auto statPotential = Core::StatisticSet(_healthPotential, _physAttackPotential,_physDefensePotential, _magAttackPotential,
|
||||
_magDefensePotential, _speedPotential);
|
||||
|
||||
return new Creature(species, variant, _level, experience, statExperience,statPotential, identifier,gender, _coloring,
|
||||
heldItem, _nickname, talent, {});
|
||||
}
|
||||
58
src/Battling/Models/CreateCreature.hpp
Normal file
58
src/Battling/Models/CreateCreature.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef CREATURELIB_CREATECREATURE_HPP
|
||||
#define CREATURELIB_CREATECREATURE_HPP
|
||||
|
||||
|
||||
#include "../../Library/DataLibrary.hpp"
|
||||
#include "Creature.hpp"
|
||||
|
||||
namespace CreatureLib::Battling {
|
||||
class CreateCreature {
|
||||
const BattleLibrary *_library;
|
||||
std::string _species;
|
||||
std::string _variant = "default";
|
||||
uint8_t _level;
|
||||
std::string _nickname = "";
|
||||
|
||||
uint8_t _healthPotential = 0;
|
||||
uint8_t _physAttackPotential = 0;
|
||||
uint8_t _physDefensePotential = 0;
|
||||
uint8_t _magAttackPotential = 0;
|
||||
uint8_t _magDefensePotential = 0;
|
||||
uint8_t _speedPotential = 0;
|
||||
|
||||
uint8_t _healthExperience = 0;
|
||||
uint8_t _physAttackExperience = 0;
|
||||
uint8_t _physDefenseExperience = 0;
|
||||
uint8_t _magAttackExperience = 0;
|
||||
uint8_t _magDefenseExperience = 0;
|
||||
uint8_t _speedExperience = 0;
|
||||
|
||||
std::string _talent = "";
|
||||
Library::Gender _gender = static_cast<Library::Gender>(-1);
|
||||
uint8_t _coloring = 0;
|
||||
std::string _heldItem = "";
|
||||
uint32_t _identifier = 0;
|
||||
|
||||
public:
|
||||
CreateCreature(const BattleLibrary *library, std::string species, uint8_t level)
|
||||
: _library(library), _species(std::move(species)), _level(level)
|
||||
{
|
||||
}
|
||||
|
||||
CreateCreature* WithVariant(std::string variant);
|
||||
CreateCreature* WithNickname(std::string nickname);
|
||||
CreateCreature* WithStatPotential(Core::Statistic stat, uint32_t value);
|
||||
CreateCreature* WithStatPotentials(uint32_t health, uint32_t physAttack, uint32_t physDefense, uint32_t magAttack,
|
||||
uint32_t magDefense,uint32_t speed);
|
||||
CreateCreature* WithStatExperience(Core::Statistic stat, uint32_t value);
|
||||
CreateCreature* WithStatExperiences(uint32_t health, uint32_t physAttack, uint32_t physDefense, uint32_t magAttack,
|
||||
uint32_t magDefense,uint32_t speed);
|
||||
CreateCreature* WithGender(Library::Gender gender);
|
||||
|
||||
|
||||
Creature* Create();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //CREATURELIB_CREATECREATURE_HPP
|
||||
101
src/Battling/Models/Creature.cpp
Normal file
101
src/Battling/Models/Creature.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
#include "Creature.hpp"
|
||||
#include "../Models/Battle.hpp"
|
||||
|
||||
using namespace CreatureLib;
|
||||
|
||||
Battling::Creature::Creature(const Library::CreatureSpecies* species, const Library::SpeciesVariant* variant,
|
||||
uint8_t level, uint32_t experience, Core::StatisticSet<uint8_t> statExp,
|
||||
Core::StatisticSet<uint8_t> statPotential, uint32_t uid, Library::Gender gender,
|
||||
uint8_t coloring, const Library::Item *heldItem, std::string nickname, int8_t talent,
|
||||
std::vector<LearnedAttack *> attacks)
|
||||
:
|
||||
__Species(species),
|
||||
__Variant(variant),
|
||||
__Level(level),
|
||||
__Experience(experience),
|
||||
__StatExperience(statExp),
|
||||
__StatPotential(statPotential),
|
||||
__UniqueIdentifier(uid),
|
||||
__Gender(gender),
|
||||
__Coloring(coloring),
|
||||
__HeldItem(heldItem),
|
||||
_nickname(nickname),
|
||||
_talentIndex(talent),
|
||||
_attacks(attacks)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
void Battling::Creature::ChangeLevel(int8_t amount) {
|
||||
this->__Level += amount;
|
||||
RecalculateFlatStats();
|
||||
}
|
||||
|
||||
void Battling::Creature::SetBattle(Battling::Battle *battle) {
|
||||
this->_battle = battle;
|
||||
}
|
||||
|
||||
void Battling::Creature::SetBattleLibrary(Battling::BattleLibrary *library) {
|
||||
this->_library = library;
|
||||
}
|
||||
|
||||
const std::string &Battling::Creature::GetNickname() const {
|
||||
if (_nickname.empty())
|
||||
return __Species->GetName();
|
||||
return _nickname;
|
||||
}
|
||||
|
||||
const std::string &Battling::Creature::GetTalent() const {
|
||||
return __Variant->GetTalent(_talentIndex);
|
||||
}
|
||||
|
||||
//region Stat APIs
|
||||
|
||||
void Battling::Creature::ChangeStatBoost(Core::Statistic stat, int8_t diffAmount){
|
||||
if (diffAmount > 0)
|
||||
this->_statBoost.IncreaseStatBy(stat, diffAmount);
|
||||
else
|
||||
this->_statBoost.DecreaseStatBy(stat, diffAmount);
|
||||
this->RecalculateBoostedStat(stat);
|
||||
}
|
||||
|
||||
uint32_t Battling::Creature::GetFlatStat(Core::Statistic stat) const{
|
||||
return _flatStats.GetStat(stat);
|
||||
}
|
||||
|
||||
uint32_t Battling::Creature::GetBoostedStat(Core::Statistic stat) const{
|
||||
return _boostedStats.GetStat(stat);
|
||||
}
|
||||
|
||||
uint32_t Battling::Creature::GetBaseStat(Core::Statistic stat) const {
|
||||
return __Variant->GetStatistic(stat);
|
||||
}
|
||||
|
||||
uint32_t Battling::Creature::GetStatPotential(Core::Statistic stat) const {
|
||||
return __StatPotential.GetStat(stat);
|
||||
}
|
||||
|
||||
uint32_t Battling::Creature::GetStatExperience(Core::Statistic stat) const {
|
||||
return __StatExperience.GetStat(stat);
|
||||
}
|
||||
|
||||
void Battling::Creature::RecalculateFlatStats() {
|
||||
this->_flatStats = this->_library->GetStatCalculator()->CalculateFlatStats(this);
|
||||
RecalculateBoostedStats();
|
||||
}
|
||||
void Battling::Creature::RecalculateBoostedStats() {
|
||||
this->_boostedStats = this->_library->GetStatCalculator()->CalculateFlatStats(this);
|
||||
}
|
||||
|
||||
void Battling::Creature::RecalculateFlatStat(Core::Statistic stat) {
|
||||
auto s = this->_library->GetStatCalculator()->CalculateFlatStat(this, stat);
|
||||
this->_flatStats.SetStat(stat, s);
|
||||
RecalculateBoostedStat(stat);
|
||||
}
|
||||
|
||||
void Battling::Creature::RecalculateBoostedStat(Core::Statistic stat) {
|
||||
auto s = this->_library->GetStatCalculator()->CalculateBoostedStat(this, stat);
|
||||
this->_boostedStats.SetStat(stat, s);
|
||||
}
|
||||
|
||||
//endregion
|
||||
69
src/Battling/Models/Creature.hpp
Normal file
69
src/Battling/Models/Creature.hpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#ifndef CREATURELIB_BATTLECREATURE_HPP
|
||||
#define CREATURELIB_BATTLECREATURE_HPP
|
||||
|
||||
#include "../../GenericTemplates.cpp"
|
||||
#include "../Library/BattleLibrary.hpp"
|
||||
#include "LearnedAttack.hpp"
|
||||
|
||||
namespace CreatureLib::Battling{
|
||||
// Forward declare battle class
|
||||
class Battle;
|
||||
|
||||
class Creature {
|
||||
GetProperty(const Library::CreatureSpecies*, Species);
|
||||
GetProperty(const Library::SpeciesVariant*, Variant);
|
||||
GetProperty(uint8_t, Level);
|
||||
GetProperty(uint32_t, Experience);
|
||||
GetProperty(Core::StatisticSet<uint8_t >, StatExperience);
|
||||
GetProperty(Core::StatisticSet<uint8_t >, StatPotential);
|
||||
GetProperty(uint32_t, UniqueIdentifier);
|
||||
GetProperty(Library::Gender, Gender);
|
||||
GetProperty(uint8_t, Coloring);
|
||||
GetProperty(const Library::Item*, HeldItem);
|
||||
GetProperty(uint32_t, CurrentHealth);
|
||||
|
||||
|
||||
private:
|
||||
Core::StatisticSet<int8_t > _statBoost;
|
||||
Core::StatisticSet<uint32_t > _flatStats;
|
||||
Core::StatisticSet<uint32_t > _boostedStats;
|
||||
|
||||
Battle* _battle;
|
||||
BattleLibrary* _library;
|
||||
|
||||
std::string _nickname = "";
|
||||
int8_t _talentIndex;
|
||||
std::vector<LearnedAttack*> _attacks;
|
||||
|
||||
public:
|
||||
Creature(const Library::CreatureSpecies* species, const Library::SpeciesVariant* variant, uint8_t level,
|
||||
uint32_t experience, Core::StatisticSet<uint8_t > statExp, Core::StatisticSet<uint8_t > statPotential,
|
||||
uint32_t uid, Library::Gender gender, uint8_t coloring, const Library::Item* heldItem, std::string nickname,
|
||||
int8_t talent, std::vector<LearnedAttack*> attacks);
|
||||
|
||||
const std::string& GetNickname() const;
|
||||
const std::string& GetTalent() const;
|
||||
|
||||
void ChangeLevel(int8_t amount);
|
||||
|
||||
//region Stat APIs
|
||||
|
||||
void SetBattle(Battle* battle);
|
||||
void SetBattleLibrary(BattleLibrary* library);
|
||||
|
||||
void ChangeStatBoost(Core::Statistic stat, int8_t diffAmount);
|
||||
[[nodiscard]] uint32_t GetFlatStat(Core::Statistic stat) const;
|
||||
[[nodiscard]] uint32_t GetBoostedStat(Core::Statistic stat) const;
|
||||
[[nodiscard]] uint32_t GetBaseStat(Core::Statistic stat) const;
|
||||
[[nodiscard]] uint32_t GetStatPotential(Core::Statistic stat) const;
|
||||
[[nodiscard]] uint32_t GetStatExperience(Core::Statistic stat) const;
|
||||
void RecalculateFlatStats();
|
||||
void RecalculateBoostedStats();
|
||||
void RecalculateFlatStat(Core::Statistic);
|
||||
void RecalculateBoostedStat(Core::Statistic);
|
||||
//endregion
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //CREATURELIB_CREATURE_HPP
|
||||
44
src/Battling/Models/LearnedAttack.cpp
Normal file
44
src/Battling/Models/LearnedAttack.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "LearnedAttack.hpp"
|
||||
|
||||
CreatureLib::Battling::LearnedAttack::LearnedAttack(CreatureLib::Library::AttackData *attack, uint8_t maxUses, AttackLearnMethod learnMethod)
|
||||
:_attack(attack), _maxUses(maxUses), _remainingUses(maxUses), _learnMethod(learnMethod)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const CreatureLib::Library::AttackData *CreatureLib::Battling::LearnedAttack::GetAttack() const {
|
||||
return _attack;
|
||||
}
|
||||
|
||||
uint8_t CreatureLib::Battling::LearnedAttack::GetMaxUses() const {
|
||||
return _maxUses;
|
||||
}
|
||||
|
||||
uint8_t CreatureLib::Battling::LearnedAttack::GetRemainingUses() const {
|
||||
return _remainingUses;
|
||||
}
|
||||
|
||||
CreatureLib::Battling::AttackLearnMethod CreatureLib::Battling::LearnedAttack::GetLearnMethod() const {
|
||||
return _learnMethod;
|
||||
}
|
||||
|
||||
|
||||
bool CreatureLib::Battling::LearnedAttack::TryUse(uint8_t uses) {
|
||||
if (uses > _remainingUses) return false;
|
||||
_remainingUses -= uses;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CreatureLib::Battling::LearnedAttack::DecreaseUses(uint8_t amount) {
|
||||
_remainingUses -= amount;
|
||||
}
|
||||
|
||||
void CreatureLib::Battling::LearnedAttack::RestoreUses(uint8_t amount) {
|
||||
_remainingUses += amount;
|
||||
}
|
||||
|
||||
void CreatureLib::Battling::LearnedAttack::RestoreUses() {
|
||||
_remainingUses = _maxUses;
|
||||
}
|
||||
|
||||
|
||||
29
src/Battling/Models/LearnedAttack.hpp
Normal file
29
src/Battling/Models/LearnedAttack.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef CREATURELIB_LEARNEDATTACK_HPP
|
||||
#define CREATURELIB_LEARNEDATTACK_HPP
|
||||
|
||||
#include "../../Library/Attacks/AttackData.hpp"
|
||||
#include "AttackLearnMethod.hpp"
|
||||
|
||||
namespace CreatureLib::Battling{
|
||||
class LearnedAttack {
|
||||
const Library::AttackData* _attack;
|
||||
uint8_t _maxUses;
|
||||
uint8_t _remainingUses;
|
||||
AttackLearnMethod _learnMethod;
|
||||
public:
|
||||
LearnedAttack(Library::AttackData* attack, uint8_t maxUses, AttackLearnMethod learnMethod);
|
||||
|
||||
const Library::AttackData* GetAttack() const;
|
||||
uint8_t GetMaxUses() const;
|
||||
uint8_t GetRemainingUses() const;
|
||||
AttackLearnMethod GetLearnMethod() const;
|
||||
|
||||
bool TryUse(uint8_t uses);
|
||||
void DecreaseUses(uint8_t amount);
|
||||
void RestoreUses(uint8_t amount);
|
||||
void RestoreUses();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //CREATURELIB_LEARNEDATTACK_HPP
|
||||
Reference in New Issue
Block a user