Update to newer Arbutils version.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#define CREATURELIB_BATTLECREATURE_HPP
|
||||
|
||||
#include <Arbutils/Collections/List.hpp>
|
||||
#include <Arbutils/Memory/borrowed_ptr.hpp>
|
||||
#include <Arbutils/Memory/BorrowedPtr.hpp>
|
||||
#include "../../Library/ClampedStatisticSet.hpp"
|
||||
#include "../../Library/CreatureData/CreatureSpecies.hpp"
|
||||
#include "../../Library/Items/Item.hpp"
|
||||
@@ -12,8 +12,6 @@
|
||||
#include "DamageSource.hpp"
|
||||
#include "LearnedAttack.hpp"
|
||||
|
||||
using namespace Arbutils::Collections;
|
||||
|
||||
namespace CreatureLib::Battling {
|
||||
// Forward declare battle class
|
||||
class Battle;
|
||||
@@ -24,18 +22,18 @@ namespace CreatureLib::Battling {
|
||||
protected:
|
||||
const BattleLibrary* _library;
|
||||
|
||||
borrowed_ptr<const Library::CreatureSpecies> _species;
|
||||
borrowed_ptr<const Library::SpeciesVariant> _variant;
|
||||
ArbUt::BorrowedPtr<const Library::CreatureSpecies> _species;
|
||||
ArbUt::BorrowedPtr<const Library::SpeciesVariant> _variant;
|
||||
|
||||
borrowed_ptr<const Library::CreatureSpecies> _displaySpecies = nullptr;
|
||||
borrowed_ptr<const Library::SpeciesVariant> _displayVariant = nullptr;
|
||||
ArbUt::BorrowedPtr<const Library::CreatureSpecies> _displaySpecies = nullptr;
|
||||
ArbUt::BorrowedPtr<const Library::SpeciesVariant> _displayVariant = nullptr;
|
||||
|
||||
uint8_t _level;
|
||||
uint32_t _experience;
|
||||
uint32_t _uniqueIdentifier;
|
||||
Library::Gender _gender;
|
||||
uint8_t _coloring;
|
||||
borrowed_ptr<const Library::Item> _heldItem;
|
||||
ArbUt::BorrowedPtr<const Library::Item> _heldItem;
|
||||
uint32_t _currentHealth;
|
||||
|
||||
Library::ClampedStatisticSet<int8_t, -6, 6> _statBoost;
|
||||
@@ -51,10 +49,10 @@ namespace CreatureLib::Battling {
|
||||
Script* _activeTalent = nullptr;
|
||||
|
||||
bool _hasOverridenTalent;
|
||||
ConstString _overridenTalentName = ""_cnc;
|
||||
ArbUt::CaseInsensitiveConstString _overridenTalentName = ""_cnc;
|
||||
std::unordered_set<Creature*> _seenOpponents = {};
|
||||
|
||||
List<LearnedAttack*> _attacks;
|
||||
ArbUt::List<LearnedAttack*> _attacks;
|
||||
bool _allowedExperienceGain;
|
||||
|
||||
Script* _status = nullptr;
|
||||
@@ -64,11 +62,11 @@ namespace CreatureLib::Battling {
|
||||
void OnFaint();
|
||||
|
||||
public:
|
||||
Creature(const BattleLibrary* library, const borrowed_ptr<const Library::CreatureSpecies>& species,
|
||||
const borrowed_ptr<const Library::SpeciesVariant>& variant, uint8_t level, uint32_t experience,
|
||||
Creature(const BattleLibrary* library, const ArbUt::BorrowedPtr<const Library::CreatureSpecies>& species,
|
||||
const ArbUt::BorrowedPtr<const Library::SpeciesVariant>& variant, uint8_t level, uint32_t experience,
|
||||
uint32_t uid, Library::Gender gender, uint8_t coloring,
|
||||
const borrowed_ptr<const Library::Item> heldItem, std::string nickname,
|
||||
const Library::TalentIndex& talent, const List<LearnedAttack*>& attacks,
|
||||
const ArbUt::BorrowedPtr<const Library::Item> heldItem, std::string nickname,
|
||||
const Library::TalentIndex& talent, const ArbUt::List<LearnedAttack*>& attacks,
|
||||
bool allowedExperienceGain = true);
|
||||
|
||||
virtual ~Creature() {
|
||||
@@ -84,22 +82,24 @@ namespace CreatureLib::Battling {
|
||||
_currentHealth = GetBoostedStat(Library::Statistic::Health);
|
||||
}
|
||||
|
||||
inline const borrowed_ptr<const Library::CreatureSpecies>& GetSpecies() const noexcept { return _species; }
|
||||
inline const borrowed_ptr<const Library::SpeciesVariant>& GetVariant() const noexcept { return _variant; }
|
||||
inline const ArbUt::BorrowedPtr<const Library::CreatureSpecies>& GetSpecies() const noexcept {
|
||||
return _species;
|
||||
}
|
||||
inline const ArbUt::BorrowedPtr<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 {
|
||||
inline bool HasHeldItem(const ArbUt::CaseInsensitiveConstString& name) const noexcept {
|
||||
return _heldItem != nullptr && _heldItem->GetName() == name;
|
||||
}
|
||||
inline bool HasHeldItem(uint32_t nameHash) const noexcept {
|
||||
return _heldItem != nullptr && _heldItem->GetName() == nameHash;
|
||||
}
|
||||
inline const borrowed_ptr<const Library::Item>& GetHeldItem() const noexcept { return _heldItem; }
|
||||
void SetHeldItem(const ConstString& itemName);
|
||||
inline const ArbUt::BorrowedPtr<const Library::Item>& GetHeldItem() const noexcept { return _heldItem; }
|
||||
void SetHeldItem(const ArbUt::CaseInsensitiveConstString& itemName);
|
||||
void SetHeldItem(uint32_t itemNameHash);
|
||||
inline void SetHeldItem(const borrowed_ptr<const Library::Item>& item) noexcept { _heldItem = item; };
|
||||
inline void SetHeldItem(const ArbUt::BorrowedPtr<const Library::Item>& item) noexcept { _heldItem = item; };
|
||||
|
||||
inline uint32_t GetCurrentHealth() const noexcept { return _currentHealth; }
|
||||
|
||||
@@ -110,37 +110,37 @@ namespace CreatureLib::Battling {
|
||||
bool IsOnBattleField() const { return _onBattleField; }
|
||||
|
||||
const std::string& GetNickname() const noexcept { return _nickname; }
|
||||
const ConstString& GetActiveTalent() const;
|
||||
const ArbUt::CaseInsensitiveConstString& GetActiveTalent() const;
|
||||
|
||||
[[nodiscard]] bool IsFainted() const noexcept;
|
||||
[[nodiscard]] const List<uint8_t>& GetTypes() const noexcept;
|
||||
[[nodiscard]] const ArbUt::List<uint8_t>& GetTypes() const noexcept;
|
||||
[[nodiscard]] bool HasType(uint8_t type) const noexcept;
|
||||
|
||||
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);
|
||||
void OverrideActiveTalent(const ConstString& talent);
|
||||
void OverrideActiveTalent(const ArbUt::CaseInsensitiveConstString& talent);
|
||||
void AddExperience(uint32_t amount);
|
||||
|
||||
void MarkOpponentAsSeen(Creature* creature) { _seenOpponents.insert(creature); }
|
||||
const std::unordered_set<Creature*>& GetSeenOpponents() const { return _seenOpponents; }
|
||||
|
||||
size_t ScriptCount() const override;
|
||||
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override;
|
||||
void GetActiveScripts(ArbUt::List<ScriptWrapper>& scripts) override;
|
||||
void ClearVolatileScripts();
|
||||
void AddVolatileScript(const ConstString& name);
|
||||
void AddVolatileScript(const ArbUt::CaseInsensitiveConstString& name);
|
||||
void AddVolatileScript(Script* script);
|
||||
void RemoveVolatileScript(const ConstString& name);
|
||||
void RemoveVolatileScript(const ArbUt::CaseInsensitiveConstString& name);
|
||||
void RemoveVolatileScript(Script* script);
|
||||
bool HasVolatileScript(const ConstString& name) const;
|
||||
bool HasVolatileScript(const ArbUt::CaseInsensitiveConstString& name) const;
|
||||
|
||||
const List<LearnedAttack*>& GetAttacks() noexcept { return _attacks; }
|
||||
const ArbUt::List<LearnedAttack*>& GetAttacks() noexcept { return _attacks; }
|
||||
|
||||
borrowed_ptr<const Library::CreatureSpecies> GetDisplaySpecies() const noexcept;
|
||||
borrowed_ptr<const Library::SpeciesVariant> GetDisplayVariant() const noexcept;
|
||||
ArbUt::BorrowedPtr<const Library::CreatureSpecies> GetDisplaySpecies() const noexcept;
|
||||
ArbUt::BorrowedPtr<const Library::SpeciesVariant> GetDisplayVariant() const noexcept;
|
||||
|
||||
void SetDisplaySpecies(const borrowed_ptr<const Library::CreatureSpecies>& species) noexcept {
|
||||
void SetDisplaySpecies(const ArbUt::BorrowedPtr<const Library::CreatureSpecies>& species) noexcept {
|
||||
_displaySpecies = species;
|
||||
}
|
||||
void SetDisplayVariant(const Library::SpeciesVariant* variant) noexcept { _displayVariant = variant; };
|
||||
|
||||
Reference in New Issue
Block a user