Added canRevive parameter to Heal function, added Faint event.
This commit is contained in:
@@ -88,6 +88,9 @@ bool Battling::Creature::IsFainted() const { return this->_currentHealth <= 0; }
|
||||
|
||||
void Battling::Creature::OnFaint() {
|
||||
// HOOK: On Faint
|
||||
if (_battle != nullptr) {
|
||||
_battle->TriggerEventListener(new FaintEvent(this));
|
||||
}
|
||||
_library->GetExperienceLibrary()->HandleExperienceGain(this, _seenOpponents);
|
||||
|
||||
if (!_battle->CanSlotBeFilled(_side->GetSideIndex(), _side->GetCreatureIndex(this))) {
|
||||
@@ -113,7 +116,10 @@ void Battling::Creature::Damage(uint32_t damage, Battling::DamageSource source)
|
||||
}
|
||||
}
|
||||
|
||||
void Battling::Creature::Heal(uint32_t amount) {
|
||||
void Battling::Creature::Heal(uint32_t amount, bool canRevive) {
|
||||
if (_currentHealth == 0 && !canRevive) {
|
||||
return;
|
||||
}
|
||||
if (amount > GetMaxHealth() - _currentHealth) {
|
||||
amount = GetMaxHealth() - _currentHealth;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace CreatureLib::Battling {
|
||||
uint32_t GetMaxHealth() const { return _boostedStats.GetHealth(); }
|
||||
void ChangeLevelBy(int8_t amount);
|
||||
void Damage(uint32_t damage, DamageSource source);
|
||||
void Heal(uint32_t amount);
|
||||
void Heal(uint32_t amount, bool canRevive = false);
|
||||
void OverrideActiveTalent(const ConstString& talent);
|
||||
void AddExperience(uint32_t amount);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user