diff --git a/src/Battling/Library/BattleStatCalculator.cpp b/src/Battling/Library/BattleStatCalculator.cpp index 25c39c6..30cdbb5 100644 --- a/src/Battling/Library/BattleStatCalculator.cpp +++ b/src/Battling/Library/BattleStatCalculator.cpp @@ -4,15 +4,27 @@ using namespace CreatureLib; Core::StatisticSet -Battling::BattleStatCalculator::CalculateStats(Battling::BattleCreature *creature) const { +Battling::BattleStatCalculator::CalculateFlatStats(Battling::BattleCreature *creature) const { return Core::StatisticSet( - CalculateStat(creature, Core::Statistic::Health), - CalculateStat(creature, Core::Statistic::PhysicalAttack), - CalculateStat(creature, Core::Statistic::PhysicalDefense), - CalculateStat(creature, Core::Statistic::MagicalAttack), - CalculateStat(creature, Core::Statistic::MagicalDefense), - CalculateStat(creature, Core::Statistic::Speed) - ); + CalculateFlatStat(creature, Core::Statistic::Health), + CalculateFlatStat(creature, Core::Statistic::PhysicalAttack), + CalculateFlatStat(creature, Core::Statistic::PhysicalDefense), + CalculateFlatStat(creature, Core::Statistic::MagicalAttack), + CalculateFlatStat(creature, Core::Statistic::MagicalDefense), + CalculateFlatStat(creature, Core::Statistic::Speed) + ); +} + +Core::StatisticSet +Battling::BattleStatCalculator::CalculateBoostedStats(Battling::BattleCreature *creature) const { +return Core::StatisticSet( + CalculateBoostedStat(creature, Core::Statistic::Health), + CalculateBoostedStat(creature, Core::Statistic::PhysicalAttack), + CalculateBoostedStat(creature, Core::Statistic::PhysicalDefense), + CalculateBoostedStat(creature, Core::Statistic::MagicalAttack), + CalculateBoostedStat(creature, Core::Statistic::MagicalDefense), + CalculateBoostedStat(creature, Core::Statistic::Speed) +); } uint32_t CalculateHealthStat(Battling::BattleCreature *creature){ @@ -32,8 +44,12 @@ uint32_t CalculateOtherStat(Battling::BattleCreature *creature, Core::Statistic } -uint32_t Battling::BattleStatCalculator::CalculateStat(Battling::BattleCreature *creature, Core::Statistic stat) const{ +uint32_t Battling::BattleStatCalculator::CalculateFlatStat(Battling::BattleCreature *creature, Core::Statistic stat) const{ if (stat == Core::Statistic::Health) return CalculateHealthStat(creature); return CalculateOtherStat(creature, stat); } + +uint32_t Battling::BattleStatCalculator::CalculateBoostedStat(Battling::BattleCreature *creature, Core::Statistic stat) const{ + throw "TODO"; +} diff --git a/src/Battling/Library/BattleStatCalculator.hpp b/src/Battling/Library/BattleStatCalculator.hpp index 0c35c81..88ccbd1 100644 --- a/src/Battling/Library/BattleStatCalculator.hpp +++ b/src/Battling/Library/BattleStatCalculator.hpp @@ -9,8 +9,10 @@ namespace CreatureLib::Battling { class BattleStatCalculator { public: - virtual Core::StatisticSet CalculateStats(BattleCreature* creature) const; - virtual uint32_t CalculateStat(BattleCreature* creature, Core::Statistic stat) const; + virtual Core::StatisticSet CalculateFlatStats(BattleCreature* creature) const; + virtual Core::StatisticSet CalculateBoostedStats(BattleCreature* creature) const; + virtual uint32_t CalculateFlatStat(BattleCreature* creature, Core::Statistic stat) const; + virtual uint32_t CalculateBoostedStat(BattleCreature* creature, Core::Statistic stat) const; }; } diff --git a/src/Battling/Models/BattleCreature.cpp b/src/Battling/Models/BattleCreature.cpp index 372b414..ac1a6c8 100644 --- a/src/Battling/Models/BattleCreature.cpp +++ b/src/Battling/Models/BattleCreature.cpp @@ -21,17 +21,27 @@ void Battling::BattleCreature::ApplyPostBattleEffects() { } -uint32_t Battling::BattleCreature::GetStat(Core::Statistic stat) { - return _fullStats.GetStat(stat); +uint32_t Battling::BattleCreature::GetFlatStat(Core::Statistic stat) { + return _flatStats.GetStat(stat); } -void Battling::BattleCreature::RecalculateStats() { - this->_fullStats = this->__Battle->GetLibrary()->GetStatCalculator()->CalculateStats(this); +uint32_t Battling::BattleCreature::GetBoostedStat(Core::Statistic stat) { + return _boostedStats.GetStat(stat); } -void Battling::BattleCreature::RecalculateStat(Core::Statistic stat) { - auto s = this->__Battle->GetLibrary()->GetStatCalculator()->CalculateStat(this, stat); - this->_fullStats.SetStat(stat, s); +void Battling::BattleCreature::RecalculateFlatStats() { + this->_flatStats = this->__Battle->GetLibrary()->GetStatCalculator()->CalculateFlatStats(this); +} +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); +} +void Battling::BattleCreature::RecalculateBoostedStat(Core::Statistic stat) { + auto s = this->__Battle->GetLibrary()->GetStatCalculator()->CalculateBoostedStat(this, stat); + this->_boostedStats.SetStat(stat, s); +} \ No newline at end of file diff --git a/src/Battling/Models/BattleCreature.hpp b/src/Battling/Models/BattleCreature.hpp index c5d31ac..7fadec1 100644 --- a/src/Battling/Models/BattleCreature.hpp +++ b/src/Battling/Models/BattleCreature.hpp @@ -15,7 +15,8 @@ namespace CreatureLib::Battling{ private: Library::Creature* _creature; Core::StatisticSet _statBoost; - Core::StatisticSet _fullStats; + Core::StatisticSet _flatStats; + Core::StatisticSet _boostedStats; public: BattleCreature(Battle* battle, Library::Creature* creature); @@ -23,10 +24,13 @@ namespace CreatureLib::Battling{ const Library::Creature* GetBackingCreature(); void ApplyPostBattleEffects(); - uint32_t GetStat(Core::Statistic stat); - void RecalculateStats(); + uint32_t GetFlatStat(Core::Statistic stat); + uint32_t GetBoostedStat(Core::Statistic stat); + void RecalculateFlatStats(); + void RecalculateBoostedStats(); - void RecalculateStat(Core::Statistic); + void RecalculateFlatStat(Core::Statistic); + void RecalculateBoostedStat(Core::Statistic); }; } diff --git a/src/Core/StatisticSet.cpp b/src/Core/StatisticSet.cpp index 44a6a70..e69de29 100644 --- a/src/Core/StatisticSet.cpp +++ b/src/Core/StatisticSet.cpp @@ -1,10 +0,0 @@ -#include -#include "StatisticSet.hpp" - - -template -CreatureLib::Core::StatisticSet::StatisticSet() -: _health(0), _physicalAttack(0), _physicalDefense(0), _magicalAttack(0), _magicalDefense(0), _speed(0) -{ - -} \ No newline at end of file diff --git a/src/Core/StatisticSet.hpp b/src/Core/StatisticSet.hpp index 3e57dda..63d2e42 100644 --- a/src/Core/StatisticSet.hpp +++ b/src/Core/StatisticSet.hpp @@ -20,7 +20,9 @@ namespace CreatureLib::Core{ : _health(health), _physicalAttack(physicalAttack), _physicalDefense(physicalDefense), _magicalAttack(magicalAttack), _magicalDefense(magicalDefense), _speed(speed){} - StatisticSet(); + StatisticSet() + : _health(0), _physicalAttack(0), _physicalDefense(0), _magicalAttack(0), _magicalDefense(0), _speed(0) + {} inline T GetHealth() const{ return _health; } inline T GetPhysicalAttack() const{ return _physicalAttack; }