diff --git a/src/Battling/Library/BattleStatCalculator.cpp b/src/Battling/Library/BattleStatCalculator.cpp index 87fdddd..c5c8d42 100644 --- a/src/Battling/Library/BattleStatCalculator.cpp +++ b/src/Battling/Library/BattleStatCalculator.cpp @@ -42,5 +42,5 @@ uint32_t Battling::BattleStatCalculator::CalculateFlatStat(Battling::Creature* c uint32_t Battling::BattleStatCalculator::CalculateBoostedStat(Battling::Creature* creature, Core::Statistic stat) const { - throw NotImplementedException(); + return creature->GetFlatStat(stat) + (creature->GetBoostedStat(stat)); } diff --git a/src/Core/StatisticSet.hpp b/src/Core/StatisticSet.hpp index 659adc0..36dba4a 100644 --- a/src/Core/StatisticSet.hpp +++ b/src/Core/StatisticSet.hpp @@ -44,35 +44,35 @@ namespace CreatureLib::Core { inline void SetStat(Statistic stat, T value) { switch (stat) { - case Health: _health = value; - case PhysicalAttack: _physicalAttack = value; - case PhysicalDefense: _physicalDefense = value; - case MagicalAttack: _magicalAttack = value; - case MagicalDefense: _magicalDefense = value; - case Speed: _speed = value; + case Health: _health = value; break; + case PhysicalAttack: _physicalAttack = value; break; + case PhysicalDefense: _physicalDefense = value; break; + case MagicalAttack: _magicalAttack = value; break; + case MagicalDefense: _magicalDefense = value; break; + case Speed: _speed = value; break; default: throw NotReachableException(); } } inline void IncreaseStatBy(Statistic stat, T amount) { switch (stat) { - case Health: _health += amount; - case PhysicalAttack: _physicalAttack += amount; - case PhysicalDefense: _physicalDefense += amount; - case MagicalAttack: _magicalAttack += amount; - case MagicalDefense: _magicalDefense += amount; - case Speed: _speed += amount; + case Health: _health += amount; break; + case PhysicalAttack: _physicalAttack += amount; break; + case PhysicalDefense: _physicalDefense += amount; break; + case MagicalAttack: _magicalAttack += amount; break; + case MagicalDefense: _magicalDefense += amount; break; + case Speed: _speed += amount; break; default: throw NotReachableException(); } } inline void DecreaseStatBy(Statistic stat, T amount) { switch (stat) { - case Health: _health -= amount; - case PhysicalAttack: _physicalAttack -= amount; - case PhysicalDefense: _physicalDefense -= amount; - case MagicalAttack: _magicalAttack -= amount; - case MagicalDefense: _magicalDefense -= amount; - case Speed: _speed -= amount; + case Health: _health -= amount; break; + case PhysicalAttack: _physicalAttack -= amount; break; + case PhysicalDefense: _physicalDefense -= amount; break; + case MagicalAttack: _magicalAttack -= amount; break; + case MagicalDefense: _magicalDefense -= amount; break; + case Speed: _speed -= amount; break; default: throw NotReachableException(); } }