summaryrefslogtreecommitdiff
path: root/scripts/Entities/Actors
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-14 10:41:08 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-14 10:41:08 -0300
commit1e17a31e3eeed8ccf76982534002513cee6593f1 (patch)
tree74d8e4fbf706b1008edcd699b0ba7af2d6bb34ea /scripts/Entities/Actors
parent5958d9c071915ab71aea5a5c08d79e88024f6c58 (diff)
Magicas
Diffstat (limited to 'scripts/Entities/Actors')
-rw-r--r--scripts/Entities/Actors/Actor.cs36
1 files changed, 34 insertions, 2 deletions
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
@@ -35,6 +35,14 @@ public partial class Actor : Entity
public delegate void HealthChangedEventHandler(int hp, int maxHp);
/// <summary>
+ /// Sinal emitido toda vez que a mana mudar.
+ /// </summary>
+ /// <param name="mp">Nova mana</param>
+ /// <param name="maxMp">Quantidade máxima de mana</param>
+ [Signal]
+ public delegate void ManaChangedEventHandler(int mp, int maxMp);
+
+ /// <summary>
/// Sinal emitido se o ator morrer.
/// </summary>
[Signal]
@@ -106,6 +114,7 @@ public partial class Actor : Entity
set
{
mp = int.Clamp(value, 0, MaxMp);
+ EmitSignal(SignalName.ManaChanged, Mp, MaxMp);
}
}
@@ -125,6 +134,15 @@ public partial class Actor : Entity
public int Men { get; private set; }
/// <summary>
+ /// Quantos turnos para recarregar a mana.
+ /// </summary>
+ public int MpRegenRate { get; private set; } = 2;
+ /// <summary>
+ /// Quanto de mana para recarregar.
+ /// </summary>
+ public int MpRegenPerTurn { get; private set; } = 5;
+
+ /// <summary>
/// A definição do ator possui caracterísitcas padrões que definem
/// o ator em questão.
/// </summary>
@@ -139,14 +157,28 @@ public partial class Actor : Entity
#region Methods
/// <summary>
- /// Executado uma vez por turno,
+ /// Recarrega a energia do ator.
/// </summary>
- public void RechargeEnergy()
+ private void RechargeEnergy()
{
Energy += Speed;
}
/// <summary>
+ /// Executado uma vez por
+ /// </summary>
+ /// <param name="turn">Número do turno.</param>
+ public void OnTurnStart(int turn)
+ {
+ RechargeEnergy();
+
+ if (turn % MpRegenRate == 0 && Mp < MaxMp)
+ {
+ Mp += MpRegenPerTurn;
+ }
+ }
+
+ /// <summary>
/// Move o ator para uma localização. Veja MovementAction.
/// </summary>
/// <param name="offset">Vetor que parte da posição do ator até o seu destino.</param>