Helper method to restore all attack uses on a Creature.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
3d21b7c42d
commit
4ef24dd122
|
@ -57,6 +57,7 @@ export uint8_t CreatureLib_Creature_Damage(Creature* p, uint32_t damage, DamageS
|
|||
export uint8_t CreatureLib_Creature_Heal(Creature* p, uint32_t health, bool canRevive) {
|
||||
Try(p->Heal(health, canRevive);)
|
||||
}
|
||||
export uint8_t CreatureLib_Creature_RestoreAllAttackUses(Creature* p) { Try(p->RestoreAllAttackUses();) }
|
||||
export uint8_t CreatureLib_Creature_GetActiveTalent(const Creature* p, const char*& out) {
|
||||
Try(out = p->GetActiveTalent().c_str();)
|
||||
}
|
||||
|
|
|
@ -171,6 +171,14 @@ void Battling::Creature::Heal(uint32_t amount, bool canRevive) {
|
|||
_currentHealth = newHealth;
|
||||
}
|
||||
|
||||
void Battling::Creature::RestoreAllAttackUses() noexcept {
|
||||
for (auto& a : _attacks) {
|
||||
if (a != nullptr) {
|
||||
a->RestoreAllUses();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Battling::Creature::OverrideActiveTalent(const ArbUt::StringView& talent) {
|
||||
_hasOverridenTalent = true;
|
||||
if (_activeTalent != nullptr) {
|
||||
|
|
|
@ -120,6 +120,7 @@ namespace CreatureLib::Battling {
|
|||
void ChangeLevelBy(int8_t amount);
|
||||
void Damage(uint32_t damage, DamageSource source);
|
||||
void Heal(uint32_t amount, bool canRevive = false);
|
||||
void RestoreAllAttackUses () noexcept;
|
||||
void OverrideActiveTalent(const ArbUt::StringView& talent);
|
||||
void AddExperience(uint32_t amount);
|
||||
|
||||
|
|
Loading…
Reference in New Issue