Added lots of security using asserts.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-03-22 13:42:26 +01:00
parent 970ca8ddd5
commit 899e432271
35 changed files with 138 additions and 56 deletions

View File

@@ -76,24 +76,24 @@ namespace CreatureLib::Battling {
_currentHealth = GetBoostedStat(Library::Statistic::Health);
}
inline const Library::CreatureSpecies* GetSpecies() const { return _species; }
inline const Library::SpeciesVariant* GetVariant() const { return _variant; }
inline uint8_t GetLevel() const { return _level; }
inline uint32_t GetExperience() const { return _experience; }
inline Library::Gender GetGender() const { return _gender; }
inline uint8_t GetColoring() const { return _coloring; }
inline bool HasHeldItem(const ConstString& name) const {
inline const Library::CreatureSpecies* GetSpecies() const noexcept { return _species; }
inline const Library::SpeciesVariant* GetVariant() const noexcept { return _variant; }
inline uint8_t GetLevel() const noexcept { return _level; }
inline uint32_t GetExperience() const noexcept { return _experience; }
inline Library::Gender GetGender() const noexcept { return _gender; }
inline uint8_t GetColoring() const noexcept { return _coloring; }
inline bool HasHeldItem(const ConstString& name) const noexcept {
return _heldItem != nullptr && _heldItem->GetName() == name;
}
inline bool HasHeldItem(uint32_t nameHash) const {
inline bool HasHeldItem(uint32_t nameHash) const noexcept {
return _heldItem != nullptr && _heldItem->GetName() == nameHash;
}
inline const Library::Item* GetHeldItem() const { return _heldItem; }
inline const Library::Item* GetHeldItem() const noexcept { return _heldItem; }
void SetHeldItem(const ConstString& itemName);
void SetHeldItem(uint32_t itemNameHash);
inline void SetHeldItem(const Library::Item* item) { _heldItem = item; };
inline void SetHeldItem(const Library::Item* item) noexcept { _heldItem = item; };
inline uint32_t GetCurrentHealth() const { return _currentHealth; }
inline uint32_t GetCurrentHealth() const noexcept { return _currentHealth; }
void SetBattleData(Battle* battle, BattleSide* side);
Battle* GetBattle() const;
@@ -101,14 +101,14 @@ namespace CreatureLib::Battling {
void SetOnBattleField(bool value) { _onBattleField = value; }
bool IsOnBattleField() const { return _onBattleField; }
const std::string& GetNickname() const { return _nickname; }
const std::string& GetNickname() const noexcept { return _nickname; }
const ConstString& GetActiveTalent() const;
[[nodiscard]] bool IsFainted() const;
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const;
[[nodiscard]] bool HasType(uint8_t type) const;
[[nodiscard]] bool IsFainted() const noexcept;
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const noexcept;
[[nodiscard]] bool HasType(uint8_t type) const noexcept;
uint32_t GetMaxHealth() const { return _boostedStats.GetHealth(); }
uint32_t GetMaxHealth() const noexcept { return _boostedStats.GetHealth(); }
void ChangeLevelBy(int8_t amount);
void Damage(uint32_t damage, DamageSource source);
void Heal(uint32_t amount, bool canRevive = false);