Add changing level API to BattleCreature
This commit is contained in:
parent
cd21e6c685
commit
1e4f422117
|
@ -10,7 +10,8 @@ Battling::BattleCreature::BattleCreature(Battling::Battle *battle,
|
||||||
_creature(creature),
|
_creature(creature),
|
||||||
_statBoost(Core::StatisticSet<int8_t >())
|
_statBoost(Core::StatisticSet<int8_t >())
|
||||||
{
|
{
|
||||||
|
// Initialize boosted stats. This initializes flat stats as well.
|
||||||
|
RecalculateBoostedStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Library::Creature* Battling::BattleCreature::GetBackingCreature() {
|
const Library::Creature* Battling::BattleCreature::GetBackingCreature() {
|
||||||
|
@ -21,6 +22,16 @@ void Battling::BattleCreature::ApplyPostBattleEffects() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//region Stat APIs
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t Battling::BattleCreature::GetFlatStat(Core::Statistic stat) const{
|
uint32_t Battling::BattleCreature::GetFlatStat(Core::Statistic stat) const{
|
||||||
return _flatStats.GetStat(stat);
|
return _flatStats.GetStat(stat);
|
||||||
}
|
}
|
||||||
|
@ -48,10 +59,9 @@ void Battling::BattleCreature::RecalculateBoostedStat(Core::Statistic stat) {
|
||||||
this->_boostedStats.SetStat(stat, s);
|
this->_boostedStats.SetStat(stat, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battling::BattleCreature::ChangeStatBoost(Core::Statistic stat, int8_t diffAmount){
|
//endregion
|
||||||
if (diffAmount > 0)
|
|
||||||
this->_statBoost.IncreaseStatBy(stat, diffAmount);
|
void Battling::BattleCreature::ChangeLevel(int8_t amount) {
|
||||||
else
|
this->__Level += amount;
|
||||||
this->_statBoost.DecreaseStatBy(stat, diffAmount);
|
RecalculateFlatStats();
|
||||||
this->RecalculateBoostedStat(stat);
|
|
||||||
}
|
}
|
|
@ -24,15 +24,19 @@ namespace CreatureLib::Battling{
|
||||||
const Library::Creature* GetBackingCreature();
|
const Library::Creature* GetBackingCreature();
|
||||||
void ApplyPostBattleEffects();
|
void ApplyPostBattleEffects();
|
||||||
|
|
||||||
uint32_t GetFlatStat(Core::Statistic stat) const;
|
|
||||||
uint32_t GetBoostedStat(Core::Statistic stat) const;
|
|
||||||
|
|
||||||
|
//region Stat APIs
|
||||||
|
|
||||||
|
void ChangeStatBoost(Core::Statistic stat, int8_t diffAmount);
|
||||||
|
[[nodiscard]] uint32_t GetFlatStat(Core::Statistic stat) const;
|
||||||
|
[[nodiscard]] uint32_t GetBoostedStat(Core::Statistic stat) const;
|
||||||
void RecalculateFlatStats();
|
void RecalculateFlatStats();
|
||||||
void RecalculateBoostedStats();
|
void RecalculateBoostedStats();
|
||||||
void RecalculateFlatStat(Core::Statistic);
|
void RecalculateFlatStat(Core::Statistic);
|
||||||
void RecalculateBoostedStat(Core::Statistic);
|
void RecalculateBoostedStat(Core::Statistic);
|
||||||
|
//endregion
|
||||||
|
|
||||||
void ChangeStatBoost(Core::Statistic stat, int8_t diffAmount);
|
void ChangeLevel(int8_t amount);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue