summaryrefslogtreecommitdiff
path: root/scripts/actors/AI
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/actors/AI')
-rw-r--r--scripts/actors/AI/BaseAI.cs2
-rw-r--r--scripts/actors/AI/HostileEnemyAI.cs8
2 files changed, 10 insertions, 0 deletions
diff --git a/scripts/actors/AI/BaseAI.cs b/scripts/actors/AI/BaseAI.cs
index 23cdcf6..733a61a 100644
--- a/scripts/actors/AI/BaseAI.cs
+++ b/scripts/actors/AI/BaseAI.cs
@@ -19,6 +19,8 @@ public abstract partial class BaseAI : Node {
/// <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();
diff --git a/scripts/actors/AI/HostileEnemyAI.cs b/scripts/actors/AI/HostileEnemyAI.cs
index af87360..35d6d1a 100644
--- a/scripts/actors/AI/HostileEnemyAI.cs
+++ b/scripts/actors/AI/HostileEnemyAI.cs
@@ -25,6 +25,14 @@ public partial class HostileEnemyAI : BaseAI
// Só faz sentido atacar o jogador se o inimigo estiver visível.
if (body.Map_Data.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);