From 1e17a31e3eeed8ccf76982534002513cee6593f1 Mon Sep 17 00:00:00 2001 From: Matheus Date: Sun, 14 Sep 2025 10:41:08 -0300 Subject: Magicas --- scripts/Entities/Actors/Actor.cs | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'scripts/Entities/Actors/Actor.cs') diff --git a/scripts/Entities/Actors/Actor.cs b/scripts/Entities/Actors/Actor.cs index 8eee4e2..7e228f8 100644 --- a/scripts/Entities/Actors/Actor.cs +++ b/scripts/Entities/Actors/Actor.cs @@ -34,6 +34,14 @@ public partial class Actor : Entity [Signal] public delegate void HealthChangedEventHandler(int hp, int maxHp); + /// + /// Sinal emitido toda vez que a mana mudar. + /// + /// Nova mana + /// Quantidade máxima de mana + [Signal] + public delegate void ManaChangedEventHandler(int mp, int maxMp); + /// /// Sinal emitido se o ator morrer. /// @@ -106,6 +114,7 @@ public partial class Actor : Entity set { mp = int.Clamp(value, 0, MaxMp); + EmitSignal(SignalName.ManaChanged, Mp, MaxMp); } } @@ -124,6 +133,15 @@ public partial class Actor : Entity /// public int Men { get; private set; } + /// + /// Quantos turnos para recarregar a mana. + /// + public int MpRegenRate { get; private set; } = 2; + /// + /// Quanto de mana para recarregar. + /// + public int MpRegenPerTurn { get; private set; } = 5; + /// /// A definição do ator possui caracterísitcas padrões que definem /// o ator em questão. @@ -139,13 +157,27 @@ public partial class Actor : Entity #region Methods /// - /// Executado uma vez por turno, + /// Recarrega a energia do ator. /// - public void RechargeEnergy() + private void RechargeEnergy() { Energy += Speed; } + /// + /// Executado uma vez por + /// + /// Número do turno. + public void OnTurnStart(int turn) + { + RechargeEnergy(); + + if (turn % MpRegenRate == 0 && Mp < MaxMp) + { + Mp += MpRegenPerTurn; + } + } + /// /// Move o ator para uma localização. Veja MovementAction. /// -- cgit v1.2.3