Adds parameters to OnDamage to show the health change.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
0912483ba8
commit
9cb2a27007
|
@ -210,11 +210,9 @@ namespace CreatureLib::Battling {
|
||||||
if (battle.HasValue()) {
|
if (battle.HasValue()) {
|
||||||
battle.GetValue()->TriggerEventListener<DamageEvent>(this, source, _currentHealth, newHealth);
|
battle.GetValue()->TriggerEventListener<DamageEvent>(this, source, _currentHealth, newHealth);
|
||||||
battle.GetValue()->RegisterHistoryElement<DamageHistory>(this, damage, source);
|
battle.GetValue()->RegisterHistoryElement<DamageHistory>(this, damage, source);
|
||||||
|
HOOK(OnDamage, this, this, source, _currentHealth, newHealth);
|
||||||
}
|
}
|
||||||
_currentHealth = newHealth;
|
_currentHealth = newHealth;
|
||||||
if (battle.HasValue()) {
|
|
||||||
HOOK(OnDamage, this, this, source);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsFainted() && damage > 0 && battle != nullptr) {
|
if (IsFainted() && damage > 0 && battle != nullptr) {
|
||||||
OnFaint(source);
|
OnFaint(source);
|
||||||
|
|
|
@ -114,7 +114,8 @@ namespace CreatureLib::Battling {
|
||||||
[[maybe_unused]] bool* result){};
|
[[maybe_unused]] bool* result){};
|
||||||
|
|
||||||
virtual void OnEndTurn(){};
|
virtual void OnEndTurn(){};
|
||||||
virtual void OnDamage(Creature*, DamageSource){};
|
virtual void OnDamage(Creature*, DamageSource, [[maybe_unused]] u32 oldHealth,
|
||||||
|
[[maybe_unused]] u32 newHealth){};
|
||||||
virtual void OnFaint(Creature*, DamageSource){};
|
virtual void OnFaint(Creature*, DamageSource){};
|
||||||
virtual void OnSwitchIn(Creature*){};
|
virtual void OnSwitchIn(Creature*){};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue