Implement stat boosting

This commit is contained in:
2019-10-23 18:41:45 +02:00
parent 3e9d030dc4
commit cd21e6c685
4 changed files with 38 additions and 5 deletions

View File

@@ -21,11 +21,11 @@ void Battling::BattleCreature::ApplyPostBattleEffects() {
}
uint32_t Battling::BattleCreature::GetFlatStat(Core::Statistic stat) {
uint32_t Battling::BattleCreature::GetFlatStat(Core::Statistic stat) const{
return _flatStats.GetStat(stat);
}
uint32_t Battling::BattleCreature::GetBoostedStat(Core::Statistic stat) {
uint32_t Battling::BattleCreature::GetBoostedStat(Core::Statistic stat) const{
return _boostedStats.GetStat(stat);
}
@@ -46,4 +46,12 @@ void Battling::BattleCreature::RecalculateFlatStat(Core::Statistic stat) {
void Battling::BattleCreature::RecalculateBoostedStat(Core::Statistic stat) {
auto s = this->__Battle->GetLibrary()->GetStatCalculator()->CalculateBoostedStat(this, stat);
this->_boostedStats.SetStat(stat, s);
}
void Battling::BattleCreature::ChangeStatBoost(Core::Statistic stat, int8_t diffAmount){
if (diffAmount > 0)
this->_statBoost.IncreaseStatBy(stat, diffAmount);
else
this->_statBoost.DecreaseStatBy(stat, diffAmount);
this->RecalculateBoostedStat(stat);
}

View File

@@ -24,13 +24,15 @@ namespace CreatureLib::Battling{
const Library::Creature* GetBackingCreature();
void ApplyPostBattleEffects();
uint32_t GetFlatStat(Core::Statistic stat);
uint32_t GetBoostedStat(Core::Statistic stat);
uint32_t GetFlatStat(Core::Statistic stat) const;
uint32_t GetBoostedStat(Core::Statistic stat) const;
void RecalculateFlatStats();
void RecalculateBoostedStats();
void RecalculateFlatStat(Core::Statistic);
void RecalculateBoostedStat(Core::Statistic);
void ChangeStatBoost(Core::Statistic stat, int8_t diffAmount);
};
}