summaryrefslogtreecommitdiff
path: root/scripts/Entities/Actors
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-09 19:09:34 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-09 19:09:34 -0300
commitc6bbb834f7758027c0df338f1520f34fad3befea (patch)
tree1818cd23c24be16fbe19b16dd0a510874d440d83 /scripts/Entities/Actors
parentf1b51bed52ffbd90b5b7cc8dcfc6f0484bbbeb3c (diff)
Organização
Diffstat (limited to 'scripts/Entities/Actors')
-rw-r--r--scripts/Entities/Actors/AI/BaseAI.cs54
-rw-r--r--scripts/Entities/Actors/AI/BaseAI.cs.uid1
-rw-r--r--scripts/Entities/Actors/AI/HostileEnemyAI.cs84
-rw-r--r--scripts/Entities/Actors/AI/HostileEnemyAI.cs.uid1
-rw-r--r--scripts/Entities/Actors/Actor.cs251
-rw-r--r--scripts/Entities/Actors/Actor.cs.uid1
-rw-r--r--scripts/Entities/Actors/ActorDefinition.cs32
-rw-r--r--scripts/Entities/Actors/ActorDefinition.cs.uid1
-rw-r--r--scripts/Entities/Actors/Enemy.cs54
-rw-r--r--scripts/Entities/Actors/Enemy.cs.uid1
-rw-r--r--scripts/Entities/Actors/EnemyDefinition.cs15
-rw-r--r--scripts/Entities/Actors/EnemyDefinition.cs.uid1
-rw-r--r--scripts/Entities/Actors/Inventory.cs46
-rw-r--r--scripts/Entities/Actors/Inventory.cs.uid1
-rw-r--r--scripts/Entities/Actors/Player.cs27
-rw-r--r--scripts/Entities/Actors/Player.cs.uid1
-rw-r--r--scripts/Entities/Actors/PlayerDefinition.cs11
-rw-r--r--scripts/Entities/Actors/PlayerDefinition.cs.uid1
18 files changed, 583 insertions, 0 deletions
diff --git a/scripts/Entities/Actors/AI/BaseAI.cs b/scripts/Entities/Actors/AI/BaseAI.cs
new file mode 100644
index 0000000..bdd1e61
--- /dev/null
+++ b/scripts/Entities/Actors/AI/BaseAI.cs
@@ -0,0 +1,54 @@
+using Godot;
+
+namespace TheLegendOfGustav.Entities.Actors.AI;
+
+/// <summary>
+/// Enum das diferentes IAs disponíveis.
+/// </summary>
+public enum AIType
+{
+ None,
+ DefaultHostile
+};
+
+/// <summary>
+/// base para as IAs do jogo.
+/// </summary>
+public abstract partial class BaseAI : Node
+{
+ /// <summary>
+ /// Corpo controlado pela IA.
+ /// O corpo é a marionete da alma.
+ /// </summary>
+ protected Actor Body { get; set; }
+
+ public override void _Ready()
+ {
+ base._Ready();
+ // Por padrão, a IA é filha do nó de seu corpo.
+ Body = GetParent<Actor>();
+ }
+
+ /// <summary>
+ /// Computa um único turno para o ator controlado.
+ /// Aviso: NPCs não possuem ações gratuitas.
+ /// A IA SEMPRE precisa executar uma ação que custe energia.
+ /// </summary>
+ public abstract void Perform();
+
+ /// <summary>
+ /// Utiliza o pathfinder do mapa para obter um caminho
+ /// da posição atual do ator para um destino qualquer.
+ /// </summary>
+ /// <param name="destination">Destino</param>
+ /// <returns>Vetor com vetores, passo a passo para chegar no destino.</returns>
+ public Godot.Collections.Array<Vector2> GetPathTo(Vector2I destination)
+ {
+ // Arrays do Godot são muito mais confortáveis de manipular, então
+ // eu converto o Array do C# em um array do Godot antes de retornar o caminho.
+ Godot.Collections.Array<Vector2> list = [];
+ Vector2[] path = Body.MapData.Pathfinder.GetPointPath(Body.GridPosition, destination);
+ list.AddRange(path);
+ return list;
+ }
+} \ No newline at end of file
diff --git a/scripts/Entities/Actors/AI/BaseAI.cs.uid b/scripts/Entities/Actors/AI/BaseAI.cs.uid
new file mode 100644
index 0000000..b23724c
--- /dev/null
+++ b/scripts/Entities/Actors/AI/BaseAI.cs.uid
@@ -0,0 +1 @@
+uid://jgm5qk02hism
diff --git a/scripts/Entities/Actors/AI/HostileEnemyAI.cs b/scripts/Entities/Actors/AI/HostileEnemyAI.cs
new file mode 100644
index 0000000..dbcf98d
--- /dev/null
+++ b/scripts/Entities/Actors/AI/HostileEnemyAI.cs
@@ -0,0 +1,84 @@
+using Godot;
+using TheLegendOfGustav.Entities.Actions;
+
+namespace TheLegendOfGustav.Entities.Actors.AI;
+
+/// <summary>
+/// Uma IA simples. Sempre tentará atacar o jogador com ataques corpo a corpo.
+/// </summary>
+public partial class HostileEnemyAI : BaseAI
+{
+ /// <summary>
+ /// Caminho até a última posição conhecida do jogador.
+ /// </summary>
+ private Godot.Collections.Array<Vector2> Path { get; set; } = [];
+
+ public override void Perform()
+ {
+ // O alvo da IA sempre é o jogador.
+ Player target = Body.MapData.Player;
+ // Vetor que parte do inimigo até o jogador.
+ Vector2I offset = target.GridPosition - Body.GridPosition;
+ // Distância entre o inimigo e o jogador. Leva em consideração somente
+ // um dos eixos.
+ int distance = int.Max(int.Abs(offset.X), int.Abs(offset.Y));
+
+ // A ação executada no turno pode ser de ataque ou de movimento.
+ Action action;
+
+ // Só faz sentido atacar o jogador se o inimigo estiver visível.
+ if (Body.MapData.GetTile(Body.GridPosition).IsInView)
+ {
+ // Se o inimigo consegue ver que o jogador está morto,
+ // IT'S OVER.
+ if (!target.IsAlive)
+ {
+ action = new WaitAction(Body);
+ action.Perform();
+ return;
+ }
+
+ // Se estiver do lado do jogador, ataque.
+ if (distance <= 1)
+ {
+ action = new MeleeAction(Body, offset);
+ action.Perform();
+ // Executada a ação, acabamos nosso turno aqui.
+ return;
+ }
+
+ // Se o inimigo estiver visível para o jogador,
+ // consideramos que ele também consiga ver o jogador.
+ // Logo, atualizamos o caminho para a posição atual do jogador.
+ Path = GetPathTo(target.GridPosition);
+ // O primeiro passo é a posição atual do inimigo, podemos remover.
+ Path.RemoveAt(0);
+ }
+
+ // Se existir um caminho conhecido para o jogador.
+ if (Path.Count > 0)
+ {
+ // Pegamos o próximo passo para o destino.
+ Vector2I destination = (Vector2I)Path[0];
+ // Se tiver o caminho estiver bloqueado, paramos o nosso turno aqui.
+ if (Body.MapData.GetBlockingEntityAtPosition(destination) != null)
+ {
+ action = new WaitAction(Body);
+ action.Perform();
+ return;
+ }
+
+ // Caso o contrário, criamos uma nova ação de movimentação e a executamos.
+ action = new MovementAction(Body, destination - Body.GridPosition);
+ action.Perform();
+ // Podemos remover o passo do caminho.
+ Path.RemoveAt(0);
+ return;
+ }
+
+ // Senão, espere.
+ action = new WaitAction(Body);
+ action.Perform();
+ return;
+ }
+} \ No newline at end of file
diff --git a/scripts/Entities/Actors/AI/HostileEnemyAI.cs.uid b/scripts/Entities/Actors/AI/HostileEnemyAI.cs.uid
new file mode 100644
index 0000000..0fa2c32
--- /dev/null
+++ b/scripts/Entities/Actors/AI/HostileEnemyAI.cs.uid
@@ -0,0 +1 @@
+uid://db28cxff4pl3t
diff --git a/scripts/Entities/Actors/Actor.cs b/scripts/Entities/Actors/Actor.cs
new file mode 100644
index 0000000..7e6685f
--- /dev/null
+++ b/scripts/Entities/Actors/Actor.cs
@@ -0,0 +1,251 @@
+using Godot;
+using TheLegendOfGustav.Map;
+using TheLegendOfGustav.Utils;
+
+namespace TheLegendOfGustav.Entities.Actors;
+
+/// <summary>
+/// A classe de ator define um personagem no jogo.
+/// </summary>
+[GlobalClass]
+public partial class Actor : Entity
+{
+ #region Fields
+ private int mp;
+ private int hp;
+
+ private int energy;
+ #endregion
+
+ #region Constructors
+ public Actor(Vector2I initialPosition, MapData map, ActorDefinition definition) : base(initialPosition, map, definition)
+ {
+ SetDefinition(definition);
+ }
+ #endregion
+
+ #region Signals
+ /// <summary>
+ /// Sinal emitido toda vez que o HP mudar.
+ /// </summary>
+ /// <param name="hp">Novo HP</param>
+ /// <param name="maxHp">Quantidade máxima de HP.</param>
+ [Signal]
+ public delegate void HealthChangedEventHandler(int hp, int maxHp);
+
+ /// <summary>
+ /// Sinal emitido se o ator morrer.
+ /// </summary>
+ [Signal]
+ public delegate void DiedEventHandler();
+ #endregion
+
+ #region Properties
+ /// <summary>
+ /// Se o ator está vivo.
+ /// </summary>
+ public bool IsAlive { get => Hp > 0; }
+
+ /// <summary>
+ /// Utilizado no sistema de turnos.
+ /// Enquanto o ator tiver energia, ele poderá realizar turnos.
+ /// </summary>
+ public int Energy
+ {
+ get => energy;
+ set
+ {
+ if (value > Speed)
+ {
+ energy = Speed;
+ }
+ else
+ {
+ energy = value;
+ }
+ }
+ }
+ /// <summary>
+ /// Taxa de recarga de energia.
+ /// </summary>
+ public int Speed { get => Definition.Speed; }
+
+ /// <summary>
+ /// HP máximo do ator.
+ /// </summary>
+ public int MaxHp { get; private set; }
+ /// <summary>
+ /// HP atual do ator.
+ /// </summary>
+ public int Hp
+ {
+ get => hp;
+ set
+ {
+ // Esta propriedade impede que o HP seja maior que o máximo.
+ hp = int.Clamp(value, 0, MaxHp);
+ EmitSignal(SignalName.HealthChanged, Hp, MaxHp);
+ if (hp <= 0)
+ {
+ Die();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Máximo de mana do ator.
+ /// </summary>
+ public int MaxMp { get; private set; }
+ /// <summary>
+ /// Mana atual do ator.
+ /// </summary>
+ public int Mp
+ {
+ get => mp;
+ set
+ {
+ mp = int.Clamp(value, 0, MaxMp);
+ }
+ }
+
+ /// <summary>
+ /// Estatística de ataque
+ /// </summary>
+ public int Atk { get; private set; }
+
+ /// <summary>
+ /// Estatística de defesa.
+ /// </summary>
+ public int Def { get; private set; }
+
+ /// <summary>
+ /// Estatística mental.
+ /// </summary>
+ public int Men { get; private set; }
+
+ /// <summary>
+ /// A definição do ator possui caracterísitcas padrões que definem
+ /// o ator em questão.
+ /// </summary>
+ private ActorDefinition Definition
+ {
+ get;
+ set;
+ }
+ #endregion
+
+ #region Methods
+ /// <summary>
+ /// Executado uma vez por turno,
+ /// </summary>
+ public void RechargeEnergy()
+ {
+ Energy += Speed;
+ }
+
+ /// <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>
+ public void Walk(Vector2I offset)
+ {
+ // Cada ator tem um peso no sistema de pathfinding.
+ // Sempre que ele se mover, removemos seu peso da posição antiga
+ MapData.UnregisterBlockingEntity(this);
+ GridPosition += offset;
+ // E colocamos na próxima.
+ MapData.RegisterBlockingEntity(this);
+ // Este peso influencia o algoritmo de pathfinding.
+ // Atores evitam caminhos bloqueados. por outros atores.
+ }
+
+
+ /// <summary>
+ /// Recupera uma quantidade de HP do ator.
+ /// </summary>
+ /// <param name="amount">HP para recuperar</param>
+ /// <returns>Quanto HP foi realmente recuperado.</returns>
+ public int Heal(int amount)
+ {
+ int neoHp = Hp + amount;
+
+ if (neoHp > MaxHp) neoHp = MaxHp;
+
+ int recovered = neoHp - Hp;
+ Hp = neoHp;
+ return recovered;
+ }
+
+ /// <summary>
+ /// Aplica uma definição de NPC para o ator.
+ /// Se o ator for um boneco de barro, este método é como um
+ /// sopro de vida.
+ /// </summary>
+ /// <param name="definition">A definição do ator.</param>
+ public virtual void SetDefinition(ActorDefinition definition)
+ {
+ base.SetDefinition(definition);
+ Definition = definition;
+
+ Type = definition.Type;
+
+ MaxHp = definition.Hp;
+ Hp = definition.Hp;
+ MaxMp = definition.Mp;
+ Mp = definition.Mp;
+
+ Atk = definition.Atk;
+ Def = definition.Def;
+ Men = definition.Men;
+ }
+
+ public virtual void Die()
+ {
+ //⠀⠀⠀⠀⢠⣤⣤⣤⢠⣤⣤⣤⣤⣄⢀⣠⣤⣤⣄⠀⠀⠀⢀⣠⣤⣤⣄⠀⣤⣤⠀⠀⣠⣤⣤⣤⣤⣤⡄⢠⣤⣤⣤⣄⠀⠀
+ //⠀⠀⠀⠀⠈⢹⣿⠉⠈⠉⣿⣿⠉⠉⢾⣿⣉⣉⠙⠀⠀⢀⣾⡟⠉⠉⣿⣧⢸⣿⡄⢠⣿⠏⣿⣿⣉⣉⡁⢸⣿⡏⢉⣿⡷⠀
+ //⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⣿⣿⠀⠀⠈⠿⠿⣿⣿⡀⠀⠸⣿⡇⠀⠀⣾⣿⠀⢿⣿⣸⡿⠀⣿⣿⠿⠿⠇⢸⣿⣿⣿⣿⠀⠀
+ //⠀⠀⠀⠀⢠⣼⣿⣤⠀⠀⣿⣿⠀⠀⢷⣦⣤⣼⡿⠁⠀⠀⠹⣿⣤⣴⡿⠋⠀⠘⣿⣿⠃⠀⣿⣿⣤⣤⡄⢸⣿⡇⠙⢿⣦⡀
+ //⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⠀⠀⠀⠀⠀⠀⢀⣰⣶⣶⣶⣿⣿⣿⣿⣷⣶⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⠿⠛⠛⠻⢿⣿⣿⣿⣿⣿⣿⣿⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⠀⠀⠀⢀⢾⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠈⠉⠉⠉⠻⢿⢿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⠀⠀⢠⠏⢸⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⢻⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⠀⢀⠇⠀⠈⠿⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⢀⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⡸⠀⠀⠀⠀⠀⠀⠀⠀⡼⠛⠳⣄⡀⠀⠐⢿⣦⡀⠀⠀⠀⢠⠃⠀⣸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⢠⠇⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⠉⣳⠟⠒⠻⣿⣦⡀⠀⡘⠀⢰⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⢀⠞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠃⢠⣄⡀⠈⠙⢿⡌⠁⠀⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⣄⣈⢻⡿⠃⢰⠟⠲⣼⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⠀⡰⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⡶⢴⠋⠀⠀⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⡴⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠞⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡴⢟⠒⠀⠀⠀⠀⢰⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⠏⠀⠀⠈⠉⣿⠇⠀⢀⡎⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠠⣤⣤⣀⢰⠏⠉⠙⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣠⠴⠢⠦⠽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⣿⣿⣿⣷⡄⣀⡀⠈⠉⠋⢹⠋⠁⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ //⠿⠿⠿⠿⠿⠦⠈⠀⠀⠀⠸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+
+ string deathMessage;
+
+ if (MapData.Player == this)
+ {
+ deathMessage = "Você morreu!";
+ }
+ else
+ {
+ deathMessage = $"{DisplayName} morreu!";
+ }
+
+ MessageLogData.Instance.AddMessage(deathMessage);
+
+ Texture = Definition.deathTexture;
+ BlocksMovement = false;
+ Type = EntityType.CORPSE;
+ DisplayName = $"Restos mortais de {DisplayName}";
+ MapData.UnregisterBlockingEntity(this);
+ EmitSignal(SignalName.Died);
+ }
+ #endregion
+} \ No newline at end of file
diff --git a/scripts/Entities/Actors/Actor.cs.uid b/scripts/Entities/Actors/Actor.cs.uid
new file mode 100644
index 0000000..cf29b40
--- /dev/null
+++ b/scripts/Entities/Actors/Actor.cs.uid
@@ -0,0 +1 @@
+uid://c0cm4woy8lawl
diff --git a/scripts/Entities/Actors/ActorDefinition.cs b/scripts/Entities/Actors/ActorDefinition.cs
new file mode 100644
index 0000000..5bd8073
--- /dev/null
+++ b/scripts/Entities/Actors/ActorDefinition.cs
@@ -0,0 +1,32 @@
+using Godot;
+
+namespace TheLegendOfGustav.Entities.Actors;
+
+/// <summary>
+/// Define de forma genérica as características de um ator.
+/// </summary>
+[GlobalClass]
+public partial class ActorDefinition : EntityDefinition
+{
+ [ExportCategory("Visuals")]
+ // Sprite de morto
+ [Export]
+ public Texture2D deathTexture;
+
+ [ExportCategory("Mechanics")]
+ [Export]
+ public int Speed { get; set; } = 10;
+
+ // Estatísticas padrão do ator.
+ [ExportCategory("Stats")]
+ [Export]
+ public int Hp;
+ [Export]
+ public int Mp;
+ [Export]
+ public int Atk;
+ [Export]
+ public int Def;
+ [Export]
+ public int Men;
+}
diff --git a/scripts/Entities/Actors/ActorDefinition.cs.uid b/scripts/Entities/Actors/ActorDefinition.cs.uid
new file mode 100644
index 0000000..ddcfe02
--- /dev/null
+++ b/scripts/Entities/Actors/ActorDefinition.cs.uid
@@ -0,0 +1 @@
+uid://crxw1e37xlrrt
diff --git a/scripts/Entities/Actors/Enemy.cs b/scripts/Entities/Actors/Enemy.cs
new file mode 100644
index 0000000..c152a0b
--- /dev/null
+++ b/scripts/Entities/Actors/Enemy.cs
@@ -0,0 +1,54 @@
+using Godot;
+using TheLegendOfGustav.Entities.Actors.AI;
+using TheLegendOfGustav.Map;
+
+namespace TheLegendOfGustav.Entities.Actors;
+
+/// <summary>
+/// Um inimigo é uma espécie de ator que é
+/// hostil ao jogador. Inimigos são controlados por IA.
+/// </summary>
+public partial class Enemy : Actor
+{
+ public Enemy(Vector2I initialPosition, MapData map, EnemyDefinition definition) : base(initialPosition, map, definition)
+ {
+ Definition = definition;
+ SetDefinition(definition);
+ }
+
+ /// <summary>
+ /// A alma do ator. Gera ações que são executadas todo turno.
+ /// </summary>
+ public BaseAI Soul { get; private set; }
+
+ private EnemyDefinition Definition { get; set; }
+
+ /// <summary>
+ /// Além de definir as características gerais de um ator,
+ /// também define qual IA utilizar.
+ /// </summary>
+ /// <param name="definition">Definição do inimigo.</param>
+ public void SetDefinition(EnemyDefinition definition)
+ {
+ // Definimos as características do ator.
+ base.SetDefinition(Definition);
+
+ // Definimos qual IA utilizar.
+ switch (definition.AI)
+ {
+ case AIType.None:
+ break;
+ case AIType.DefaultHostile:
+ Soul = new HostileEnemyAI();
+ AddChild(Soul);
+ break;
+ }
+ }
+
+ public override void Die()
+ {
+ Soul.QueueFree();
+ Soul = null;
+ base.Die();
+ }
+}
diff --git a/scripts/Entities/Actors/Enemy.cs.uid b/scripts/Entities/Actors/Enemy.cs.uid
new file mode 100644
index 0000000..93255b7
--- /dev/null
+++ b/scripts/Entities/Actors/Enemy.cs.uid
@@ -0,0 +1 @@
+uid://bef1fo3vgvxej
diff --git a/scripts/Entities/Actors/EnemyDefinition.cs b/scripts/Entities/Actors/EnemyDefinition.cs
new file mode 100644
index 0000000..97f8f13
--- /dev/null
+++ b/scripts/Entities/Actors/EnemyDefinition.cs
@@ -0,0 +1,15 @@
+using Godot;
+using TheLegendOfGustav.Entities.Actors.AI;
+
+namespace TheLegendOfGustav.Entities.Actors;
+
+/// <summary>
+/// Além das configurações do ator, também possui qual IA utilizar.
+/// </summary>
+[GlobalClass]
+public partial class EnemyDefinition : ActorDefinition
+{
+ [ExportCategory("AI")]
+ [Export]
+ public AIType AI;
+} \ No newline at end of file
diff --git a/scripts/Entities/Actors/EnemyDefinition.cs.uid b/scripts/Entities/Actors/EnemyDefinition.cs.uid
new file mode 100644
index 0000000..1ba03e1
--- /dev/null
+++ b/scripts/Entities/Actors/EnemyDefinition.cs.uid
@@ -0,0 +1 @@
+uid://dkfdm2m2scyks
diff --git a/scripts/Entities/Actors/Inventory.cs b/scripts/Entities/Actors/Inventory.cs
new file mode 100644
index 0000000..f65dc59
--- /dev/null
+++ b/scripts/Entities/Actors/Inventory.cs
@@ -0,0 +1,46 @@
+using Godot;
+using TheLegendOfGustav.Entities.Items;
+using TheLegendOfGustav.Map;
+using TheLegendOfGustav.Utils;
+
+namespace TheLegendOfGustav.Entities.Actors;
+
+public partial class Inventory(int capacity) : Node
+{
+ private Player Player { get; set; }
+ public int Capacity { get; private set; } = capacity;
+ public Godot.Collections.Array<ConsumableItem> Items { get; private set; } = [];
+
+ public override void _Ready()
+ {
+ base._Ready();
+ Player = GetParent<Player>();
+ }
+
+ public void Drop(ConsumableItem item)
+ {
+ Items.Remove(item);
+
+ MapData data = Player.MapData;
+
+ data.InsertEntity(item);
+ data.EmitSignal(MapData.SignalName.EntityPlaced, item);
+
+ item.MapData = data;
+ item.GridPosition = Player.GridPosition;
+
+ MessageLogData.Instance.AddMessage($"Você descarta {item.DisplayName}.");
+ }
+
+ public void Add(ConsumableItem item)
+ {
+ if (Items.Count >= Capacity) return;
+
+ Items.Add(item);
+ }
+
+ public void RemoveItem(ConsumableItem item)
+ {
+ Items.Remove(item);
+ }
+} \ No newline at end of file
diff --git a/scripts/Entities/Actors/Inventory.cs.uid b/scripts/Entities/Actors/Inventory.cs.uid
new file mode 100644
index 0000000..05c2beb
--- /dev/null
+++ b/scripts/Entities/Actors/Inventory.cs.uid
@@ -0,0 +1 @@
+uid://isaqxdpou22h
diff --git a/scripts/Entities/Actors/Player.cs b/scripts/Entities/Actors/Player.cs
new file mode 100644
index 0000000..7fd80d4
--- /dev/null
+++ b/scripts/Entities/Actors/Player.cs
@@ -0,0 +1,27 @@
+using Godot;
+using TheLegendOfGustav.Map;
+
+namespace TheLegendOfGustav.Entities.Actors;
+
+/// <summary>
+/// Classe do jogador. Por enquanto não é diferente do Ator, mas isso pode mudar.
+/// </summary>
+[GlobalClass]
+public partial class Player : Actor
+{
+ public Player(Vector2I initialPosition, MapData map, PlayerDefinition definition) : base(initialPosition, map, definition)
+ {
+ Definition = definition;
+ SetDefinition(definition);
+ }
+
+ private PlayerDefinition Definition { get; set; }
+ public Inventory Inventory { get; private set; }
+
+ public void SetDefinition(PlayerDefinition definition)
+ {
+ Inventory = new(definition.InventoryCapacity);
+
+ AddChild(Inventory);
+ }
+}
diff --git a/scripts/Entities/Actors/Player.cs.uid b/scripts/Entities/Actors/Player.cs.uid
new file mode 100644
index 0000000..8229b7f
--- /dev/null
+++ b/scripts/Entities/Actors/Player.cs.uid
@@ -0,0 +1 @@
+uid://c840l08453pu2
diff --git a/scripts/Entities/Actors/PlayerDefinition.cs b/scripts/Entities/Actors/PlayerDefinition.cs
new file mode 100644
index 0000000..58ae6b4
--- /dev/null
+++ b/scripts/Entities/Actors/PlayerDefinition.cs
@@ -0,0 +1,11 @@
+using Godot;
+
+namespace TheLegendOfGustav.Entities.Actors;
+
+[GlobalClass]
+public partial class PlayerDefinition : ActorDefinition
+{
+ [ExportCategory("Player Mechanics")]
+ [Export]
+ public int InventoryCapacity = 0;
+} \ No newline at end of file
diff --git a/scripts/Entities/Actors/PlayerDefinition.cs.uid b/scripts/Entities/Actors/PlayerDefinition.cs.uid
new file mode 100644
index 0000000..9d01ab9
--- /dev/null
+++ b/scripts/Entities/Actors/PlayerDefinition.cs.uid
@@ -0,0 +1 @@
+uid://bd78nfh1tsjq6