summaryrefslogtreecommitdiff
path: root/scripts/actors
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-08-17 20:49:03 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-08-17 20:49:03 -0300
commitbd8a14e5d22ee7e4e53a1b3c8bfe2b35328632e5 (patch)
treec91a87d683884e468a8c4e2079dbf0d80b81396c /scripts/actors
parentbf74afcdd07e59b1a48dbfacdce9d52fad765865 (diff)
Attack
Diffstat (limited to 'scripts/actors')
-rw-r--r--scripts/actors/actions/BumpAction.cs24
-rw-r--r--scripts/actors/actions/BumpAction.cs.uid1
-rw-r--r--scripts/actors/actions/DirectionalAction.cs11
-rw-r--r--scripts/actors/actions/DirectionalAction.cs.uid1
-rw-r--r--scripts/actors/actions/MeleeAction.cs21
-rw-r--r--scripts/actors/actions/MeleeAction.cs.uid1
-rw-r--r--scripts/actors/actions/MovementAction.cs6
7 files changed, 61 insertions, 4 deletions
diff --git a/scripts/actors/actions/BumpAction.cs b/scripts/actors/actions/BumpAction.cs
new file mode 100644
index 0000000..e1fb706
--- /dev/null
+++ b/scripts/actors/actions/BumpAction.cs
@@ -0,0 +1,24 @@
+using Godot;
+using System;
+
+public partial class BumpAction : DirectionalAction
+{
+ public BumpAction(Vector2I offset) : base(offset)
+ {
+ }
+
+ public override void Perform(Game game, Actor actor)
+ {
+ Vector2I destination = actor.GridPosition + Offset;
+
+ Action action;
+
+ if (game.Map.GetBlockingActorAtPosition(destination) != null) {
+ action = new MeleeAction(Offset);
+ } else {
+ action = new MovementAction(Offset);
+ }
+
+ action.Perform(game, actor);
+ }
+}
diff --git a/scripts/actors/actions/BumpAction.cs.uid b/scripts/actors/actions/BumpAction.cs.uid
new file mode 100644
index 0000000..f5ce3f8
--- /dev/null
+++ b/scripts/actors/actions/BumpAction.cs.uid
@@ -0,0 +1 @@
+uid://p6ij0dsuvv7y
diff --git a/scripts/actors/actions/DirectionalAction.cs b/scripts/actors/actions/DirectionalAction.cs
new file mode 100644
index 0000000..7512141
--- /dev/null
+++ b/scripts/actors/actions/DirectionalAction.cs
@@ -0,0 +1,11 @@
+using Godot;
+using System;
+
+public abstract partial class DirectionalAction : Action
+{
+ public Vector2I Offset { get; private set; }
+ public DirectionalAction(Vector2I offset)
+ {
+ Offset = offset;
+ }
+}
diff --git a/scripts/actors/actions/DirectionalAction.cs.uid b/scripts/actors/actions/DirectionalAction.cs.uid
new file mode 100644
index 0000000..901756a
--- /dev/null
+++ b/scripts/actors/actions/DirectionalAction.cs.uid
@@ -0,0 +1 @@
+uid://cxotc2adk05j8
diff --git a/scripts/actors/actions/MeleeAction.cs b/scripts/actors/actions/MeleeAction.cs
new file mode 100644
index 0000000..1a74c22
--- /dev/null
+++ b/scripts/actors/actions/MeleeAction.cs
@@ -0,0 +1,21 @@
+using Godot;
+using System;
+using System.Net.NetworkInformation;
+
+public partial class MeleeAction : DirectionalAction
+{
+ public MeleeAction(Vector2I offset) : base(offset)
+ {
+ }
+
+ public override void Perform(Game game, Actor actor)
+ {
+ Vector2I destination = actor.GridPosition + Offset;
+
+ Actor target = game.Map.GetBlockingActorAtPosition(destination);
+
+ if (target == null) return;
+
+ GD.Print($"Você tenta socar {target.ActorName}, mas como não sobra nada para o beta, você ainda não tem um método de ataque.");
+ }
+}
diff --git a/scripts/actors/actions/MeleeAction.cs.uid b/scripts/actors/actions/MeleeAction.cs.uid
new file mode 100644
index 0000000..bc97619
--- /dev/null
+++ b/scripts/actors/actions/MeleeAction.cs.uid
@@ -0,0 +1 @@
+uid://vbptt0gl1ud0
diff --git a/scripts/actors/actions/MovementAction.cs b/scripts/actors/actions/MovementAction.cs
index 6fa3491..3b203ca 100644
--- a/scripts/actors/actions/MovementAction.cs
+++ b/scripts/actors/actions/MovementAction.cs
@@ -1,12 +1,10 @@
using Godot;
using System;
-public partial class MovementAction : Action
+public partial class MovementAction : DirectionalAction
{
- public Vector2I Offset { get; private set; }
- public MovementAction(Vector2I offset)
+ public MovementAction(Vector2I offset) : base(offset)
{
- Offset = offset;
}
public override void Perform(Game game, Actor actor)