Adds Creature specific weight and height, which can be modified dynamically during battles.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
2e2abfe122
commit
a12972472b
|
@ -17,7 +17,8 @@ namespace CreatureLib::Battling {
|
|||
bool allowedExperienceGain)
|
||||
: _library(library), _species(species), _variant(variant), _level(level), _experience(experience),
|
||||
_uniqueIdentifier(uid), _gender(gender), _coloring(coloring), _heldItem(heldItem),
|
||||
_nickname(std::move(nickname)), _talentIndex(talent), _hasOverridenTalent(false), _attacks(attacks),
|
||||
_weight(variant->GetWeight()), _height(variant->GetHeight()), _nickname(std::move(nickname)),
|
||||
_talentIndex(talent), _hasOverridenTalent(false), _attacks(attacks),
|
||||
_allowedExperienceGain(allowedExperienceGain) {
|
||||
_activeTalent =
|
||||
std::unique_ptr<BattleScript>(_library->LoadScript(this, ScriptCategory::Talent, GetActiveTalent()));
|
||||
|
@ -108,6 +109,8 @@ namespace CreatureLib::Battling {
|
|||
_battleData = {};
|
||||
_battleData.SeenOpponents = {};
|
||||
ResetActiveScripts();
|
||||
_weight = _variant->GetWeight();
|
||||
_height = _variant->GetHeight();
|
||||
}
|
||||
|
||||
bool Creature::ChangeStatBoost(Library::Statistic stat, int8_t diffAmount) {
|
||||
|
|
|
@ -36,6 +36,9 @@ namespace CreatureLib::Battling {
|
|||
ArbUt::OptionalBorrowedPtr<const Library::Item> _heldItem;
|
||||
uint32_t _currentHealth = -1;
|
||||
|
||||
f32 _weight;
|
||||
f32 _height;
|
||||
|
||||
Library::ClampedStatisticSet<int8_t, -6, 6> _statBoost;
|
||||
Library::StatisticSet<uint32_t> _flatStats;
|
||||
Library::StatisticSet<uint32_t> _boostedStats;
|
||||
|
@ -108,6 +111,22 @@ namespace CreatureLib::Battling {
|
|||
|
||||
inline uint32_t GetCurrentHealth() const noexcept { return _currentHealth; }
|
||||
|
||||
inline f32 GetWeight() const noexcept { return _weight; }
|
||||
inline void SetWeight(f32 weight) noexcept {
|
||||
if (weight < 0.1f) {
|
||||
weight = 0.1f;
|
||||
}
|
||||
_weight = weight;
|
||||
}
|
||||
|
||||
inline f32 GetHeight() const noexcept { return _height; }
|
||||
inline void SetHeight(f32 height) noexcept {
|
||||
if (height < 0.1f) {
|
||||
height = 0.1f;
|
||||
}
|
||||
_height = height;
|
||||
}
|
||||
|
||||
void SetBattleData(const ArbUt::BorrowedPtr<Battle>& battle, const ArbUt::BorrowedPtr<BattleSide>& side);
|
||||
void ClearBattleData() noexcept;
|
||||
inline const ArbUt::OptionalBorrowedPtr<Battle>& GetBattle() const { return _battleData.Battle; }
|
||||
|
|
|
@ -25,4 +25,7 @@ using i16 = int16_t;
|
|||
using i32 = int32_t;
|
||||
using i64 = int64_t;
|
||||
|
||||
using f32 = float;
|
||||
using f64 = double;
|
||||
|
||||
#endif // CREATURELIB_DEFINES_HPP
|
||||
|
|
Loading…
Reference in New Issue