Furter fixes for changing stats.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-01-05 14:39:10 +01:00
parent f9494d4c38
commit fbfcc53a02
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 19 additions and 19 deletions

View File

@ -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));
}

View File

@ -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();
}
}