Implementation of damage calculation.
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include "Creature.hpp"
|
||||
#include "../Models/Battle.hpp"
|
||||
|
||||
@@ -84,6 +85,10 @@ uint32_t Battling::Creature::GetStatExperience(Core::Statistic stat) const {
|
||||
return __StatExperience.GetStat(stat);
|
||||
}
|
||||
|
||||
int8_t Battling::Creature::GetStatBoost(Core::Statistic stat) const {
|
||||
return _statBoost.GetStat(stat);
|
||||
}
|
||||
|
||||
void Battling::Creature::RecalculateFlatStats() {
|
||||
this->_flatStats = this->_library->GetStatCalculator()->CalculateFlatStats(this);
|
||||
RecalculateBoostedStats();
|
||||
@@ -129,3 +134,8 @@ const std::vector<uint8_t>& Battling::Creature::GetTypes() const {
|
||||
//HOOK: override types.
|
||||
return this->__Variant->GetTypes();
|
||||
}
|
||||
|
||||
bool Battling::Creature::HasType(uint8_t type) const {
|
||||
auto t = GetTypes();
|
||||
return std::find(t.begin(), t.end(), type) != t.end();
|
||||
}
|
||||
|
||||
@@ -53,8 +53,9 @@ namespace CreatureLib::Battling{
|
||||
Battle* GetBattle() const;
|
||||
BattleSide* GetBattleSide() const;
|
||||
|
||||
bool IsFainted() const;
|
||||
const std::vector<uint8_t>& GetTypes() const;
|
||||
[[nodiscard]] bool IsFainted() const;
|
||||
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const;
|
||||
[[nodiscard]] bool HasType(uint8_t type) const;
|
||||
|
||||
//region Stat APIs
|
||||
|
||||
@@ -67,6 +68,7 @@ namespace CreatureLib::Battling{
|
||||
[[nodiscard]] uint32_t GetBaseStat(Core::Statistic stat) const;
|
||||
[[nodiscard]] uint32_t GetStatPotential(Core::Statistic stat) const;
|
||||
[[nodiscard]] uint32_t GetStatExperience(Core::Statistic stat) const;
|
||||
[[nodiscard]] int8_t GetStatBoost(Core::Statistic stat) const;
|
||||
void RecalculateFlatStats();
|
||||
void RecalculateBoostedStats();
|
||||
void RecalculateFlatStat(Core::Statistic);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace CreatureLib::Battling {
|
||||
inline void SetCritical(bool value) {_critical = value;}
|
||||
inline void SetBasePower(uint8_t value) { _basePower = value; }
|
||||
inline void SetEffectiveness(float value) {_effectiveness = value;}
|
||||
inline void OverrideDamage(uint32_t value) {_damage = value;}
|
||||
inline void SetDamage(uint32_t value) { _damage = value;}
|
||||
inline void SetType(uint8_t value) {_type = value;}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user