Implements clamped statistics for stat boost.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-22 21:48:00 +02:00
parent 75baf19ebd
commit 97fa37ea7d
3 changed files with 105 additions and 5 deletions

View File

@@ -50,12 +50,14 @@ void Battling::Creature::SetBattleData(Battling::Battle* battle, Battling::Battl
// region Stat APIs
void Battling::Creature::ChangeStatBoost(Library::Statistic stat, int8_t diffAmount) {
bool Battling::Creature::ChangeStatBoost(Library::Statistic stat, int8_t diffAmount) {
bool changed = false;
if (diffAmount > 0)
this->_statBoost.IncreaseStatBy(stat, diffAmount);
changed = this->_statBoost.IncreaseStatBy(stat, diffAmount);
else
this->_statBoost.DecreaseStatBy(stat, -diffAmount);
changed = this->_statBoost.DecreaseStatBy(stat, -diffAmount);
this->RecalculateBoostedStat(stat);
return changed;
}
uint32_t Battling::Creature::GetFlatStat(Library::Statistic stat) const noexcept { return _flatStats.GetStat(stat); }