Functions to set Creature Held Item, and helper function to check whether Creature is holding a specific held item.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
75bce0e329
commit
ce31309b2a
|
@ -178,3 +178,10 @@ const Library::SpeciesVariant* Battling::Creature::GetDisplayVariant() const {
|
|||
variant = _variant;
|
||||
return variant;
|
||||
}
|
||||
void Battling::Creature::SetHeldItem(const std::string& itemName) {
|
||||
const Library::Item* item;
|
||||
if (!_library->GetItemLibrary()->TryGet(itemName, item)) {
|
||||
throw CreatureException("Item not found.");
|
||||
}
|
||||
_heldItem = item;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,13 @@ namespace CreatureLib::Battling {
|
|||
inline uint32_t GetExperience() const { return _experience; }
|
||||
inline Library::Gender GetGender() const { return _gender; }
|
||||
inline uint8_t GetColoring() const { return _coloring; }
|
||||
inline const bool HasHeldItem(const std::string& name) const {
|
||||
return _heldItem != nullptr && _heldItem->GetName() == name;
|
||||
}
|
||||
inline const Library::Item* GetHeldItem() const { return _heldItem; }
|
||||
void SetHeldItem(const std::string& itemName);
|
||||
inline void SetHeldItem(Library::Item* item) { _heldItem = item; };
|
||||
|
||||
inline uint32_t GetCurrentHealth() const { return _currentHealth; }
|
||||
|
||||
void SetBattleData(Battle* battle, BattleSide* side);
|
||||
|
|
Loading…
Reference in New Issue