CreatureLib/src/Battling/Models/BattleCreature.cpp

49 lines
1.7 KiB
C++

#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 >())
{
}
const Library::Creature* Battling::BattleCreature::GetBackingCreature() {
return _creature;
}
void Battling::BattleCreature::ApplyPostBattleEffects() {
}
uint32_t Battling::BattleCreature::GetFlatStat(Core::Statistic stat) {
return _flatStats.GetStat(stat);
}
uint32_t Battling::BattleCreature::GetBoostedStat(Core::Statistic stat) {
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);
}