summaryrefslogtreecommitdiff
path: root/scripts/actors/actions/BumpAction.cs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/actors/actions/BumpAction.cs')
-rw-r--r--scripts/actors/actions/BumpAction.cs24
1 files changed, 24 insertions, 0 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);
+ }
+}