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),
|
||||
_statBoost(Core::StatisticSet<int8_t >())
|
||||
{
|
||||
|
||||
// Initialize boosted stats. This initializes flat stats as well.
|
||||
RecalculateBoostedStats();
|
||||
}
|
||||
|
||||
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{
|
||||
return _flatStats.GetStat(stat);
|
||||
}
|
||||
|
@ -48,10 +59,9 @@ void Battling::BattleCreature::RecalculateBoostedStat(Core::Statistic 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);
|
||||
//endregion
|
||||
|
||||
void Battling::BattleCreature::ChangeLevel(int8_t amount) {
|
||||
this->__Level += amount;
|
||||
RecalculateFlatStats();
|
||||
}
|
|
@ -24,15 +24,19 @@ namespace CreatureLib::Battling{
|
|||
const Library::Creature* GetBackingCreature();
|
||||
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 RecalculateBoostedStats();
|
||||
void RecalculateFlatStat(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