summaryrefslogtreecommitdiff
path: root/scripts/Entities/Actors
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Entities/Actors')
-rw-r--r--scripts/Entities/Actors/Actor.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/Entities/Actors/Actor.cs b/scripts/Entities/Actors/Actor.cs
index c68cc2b..e6b8867 100644
--- a/scripts/Entities/Actors/Actor.cs
+++ b/scripts/Entities/Actors/Actor.cs
@@ -101,6 +101,9 @@ public partial class Actor : Entity, ISaveable
get => hp;
set
{
+ if (MapData != null && MapData.Player == this && hp > value) {
+ Stats.Instance.DamageTaken += (hp - value);
+ }
// Esta propriedade impede que o HP seja maior que o máximo.
hp = int.Clamp(value, 0, MaxHp);
EmitSignal(SignalName.HealthChanged, Hp, MaxHp);
@@ -280,6 +283,9 @@ public partial class Actor : Entity, ISaveable
else
{
deathMessage = $"{DisplayName} morreu!";
+ if (!inLoading) {
+ Stats.Instance.EnemiesKilled++;
+ }
}