Support for Heal function for Creatures.
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:
@@ -112,6 +112,19 @@ void Battling::Creature::Damage(uint32_t damage, Battling::DamageSource source)
|
||||
}
|
||||
}
|
||||
|
||||
void Battling::Creature::Heal(uint32_t amount) {
|
||||
if (amount > GetMaxHealth() - _currentHealth) {
|
||||
amount = GetMaxHealth() - _currentHealth;
|
||||
}
|
||||
// HOOK: On Heal
|
||||
auto newHealth = _currentHealth + amount;
|
||||
auto battle = this->GetBattle();
|
||||
if (battle != nullptr) {
|
||||
battle->TriggerEventListener(new HealEvent(this, _currentHealth, newHealth));
|
||||
}
|
||||
_currentHealth = newHealth;
|
||||
}
|
||||
|
||||
void Battling::Creature::OverrideActiveTalent(const std::string& talent) {
|
||||
_hasOverridenTalent = true;
|
||||
_activeTalent->OnRemove();
|
||||
|
||||
Reference in New Issue
Block a user